Why is TF Keras inference way slower than Numpy operations?

前端 未结 3 956
挽巷
挽巷 2021-02-05 14:38

I\'m working on a reinforcement learning model implemented with Keras and Tensorflow. I have to do frequent calls to model.predict() on single inputs.

While testing infe

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 14:43

    The memory leak issue still seems to persist in Keras. The following lines of code mentioned in that issue did the trick for me:

    import ... as K
    import gc
    
    model = ....
    del model
    K.clear_session()
    gc.collect()
    

提交回复
热议问题