Why is TF Keras inference way slower than Numpy operations?
问题 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 inference on a simple pretrained model, I noticed that using Keras' model.predict is WAY slower than just using Numpy on stored weights. Why is it that slow and how can I accelerate it? Using pure Numpy is not viable for complex models. import timeit import numpy as np from tensorflow.python.keras.models import Sequential from