具体的测试可以将keras中的第6.4程序
1、Sequential情况下
如果想要指定批次的大小,需要在第一层的输入形状中使用batch_input_shape
而不能使用input_shape,因为input_shape不能指定批次的大小,批次只能为None
input_shape和batch_input_shape。
input_shape 不包含批量大小,
batch_input_shape是全情投入的形状,包括批量大小。
2、函数式情况下
Input参数
shape: 一个尺寸元组(整数),不包含批量大小。A shape tuple (integer), not including the batch size. 例如,shape=(32,) 表明期望的输入是按批次的 32 维向量。
batch_shape: 一个尺寸元组(整数),包含批量大小。 例如,batch_shape=(10, 32) 表明期望的输入是 10 个 32 维向量。 batch_shape=(None, 32) 表明任意批次大小的 32 维向量。