[Keras]reshape()

https://keras.io/layers/core/#reshape

  • keras.layers.Reshape(target_shape)
  • 将输出调整为特定形状。
  • 第一层时需要input_shape()确定输入形状。
    示例:
# as first layer in a Sequential model
model = Sequential()
model.add(Reshape((3, 4), input_shape=(12,)))
# now: model.output_shape == (None, 3, 4)
# note: `None` is the batch dimension

# as intermediate layer in a Sequential model
model.add(Reshape((6, 2)))
# now: model.output_shape == (None, 6, 2)

# also supports shape inference using `-1` as dimension
model.add(Reshape((-1, 2, 2)))
# now: model.output_shape == (None, 3, 2, 2)

你可能感兴趣的:(Keras)