我试图实现一个解码器,其输出形状是(None,32,32,1)
。下面的代码片段实现了一个输出形状为(None,28,28,1)
的解码器:
# Decoder
latent_dim = 2
latent_inputs = keras.Input(shape=(latent_dim,))
x = layers.Dense(7 * 7 * 64, activation="relu")(latent_inputs)
x = layers.Reshape((7, 7, 64))(x)
x = layers.Conv2DTranspose(64, 3, activation="relu", strides=2, padding="same")(x)
x = layers.Conv2DTranspose(32, 3, activation="relu", strides=2, padding="same")(x)
decoder_outputs = layers.Conv2DTranspose(1, 3, activation="sigmoid", padding="same")(x)
decoder = keras.Model(latent_inputs, decoder_outputs, name="decoder")
decoder.summary()
字符串
总结如下:
Model: "decoder"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_2 (InputLayer) [(None, 2)] 0
dense_1 (Dense) (None, 3136) 9408
reshape (Reshape) (None, 7, 7, 64) 0
conv2d_transpose (Conv2DTr (None, 14, 14, 64) 36928
anspose)
conv2d_transpose_1 (Conv2D (None, 28, 28, 32) 18464
Transpose)
conv2d_transpose_2 (Conv2D (None, 28, 28, 1) 289
Transpose)
=================================================================
Total params: 65089 (254.25 KB)
Trainable params: 65089 (254.25 KB)
Non-trainable params: 0 (0.00 Byte)
_________________________________________________________________
型
- 我怎么才能做到这一点?你能帮我吗?
1条答案
按热度按时间eqoofvh91#
如何简单地将7替换为8?
字符串