I've got a keras.models.Model
that I load with tf.keras.models.load_model
.
Now there are two options to use this model. I can call model.predict(x)
or I can call model(x).numpy()
. Both options give me the same result, but model.predict(x)
takes over 10x longer to run.
The comments in the source code state:
Computation is done in batches. This method is designed for performance in large scale inputs. For small amount of inputs that fit in one batch, directly using
__call__
is recommended for faster execution, e.g.,model(x)
, ormodel(x, training=False)
I've tested with x
containing 1; 1,000,000; and 10,000,000 rows and model(x)
still performs better.
How large does the input need to be to be classified as a large scale input, and for the model.predict(x)
to perform better?