“tf.keras.preprocessing.timeseries_dataset_from_array 中的批量大小”和“model.fit 中的批量大小”有什么区别?

问题描述

正如您在本教程 (https://www.tensorflow.org/tutorials/structured_data/time_series) 中所见,我正在研究时间序列的预测。

我想问一下教程第 4 节中的 tf.keras.preprocessing.timeseries_dataset_from_array 中的批量大小与 model.fit 中的批量大小之间的区别。如果这两个参数相同,那么如果我也在 model.fit 中写了批大小会怎样?

谢谢。

解决方法

来自位于 here.model.fit 文档

batch_size: Integer or None. A number of samples per gradient update. If unspecified,batch_size will default to 32. 
Do not specify the batch_size if your data is in the form of datasets,generators,or keras. utils.Sequence instances (since they generate batches).

所以不要在model.fit中指定batch size