下面3个指定输入shape的方法是严格等价的:
-
model = Sequential()
model.add(Dense(32, input_shape=(784, ))) -
model = Sequential()
model.add(Dense(32, batch_input_shape=(None, 784))) -
model = Sequential()
model.add(Dense(32, input_dim = 784))
下面三种方法也是严格等价的:
-
model = Sequential()
model.add(LSTM(32, input_shape = (10, 64))) -
model = Sequential()
model .add(LSTM(32, batch_input_shape=(None, 10, 64))) -
model = Sequential()
model.add(LSTM(32, input_length = 10, input_dim=64))
参考:keras中文档