In keras
, both model.fit
and model.predict
has a parameter of batch_size
. My understanding is that batch size in model.fit is related to batch optimization, what's the physical meaning of batch_size
in model_predict
? Does it need to be equal to the one used by model.fit
?
No it doesn‘t. Imagine inside your model there is a function which increases the amount of memory significantly. Therefore, you might run into resource errors if you try to predict all your data in one go. This is often the case when you use gpu with limited gpu memory for predicting. So instead you choose to predict only small batches at the same time. The batch_size parameter in the predict function will not alter your results in any way. So you can choose any batch_size you want for prediction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With