我有一个CNN模型,其输出尺寸为(?,28,28,1)。
Resource res = resourceLoader.getResource("classpath:thermopylae.txt");
Map<String, Integer> words = countWords.getWordsCount(res);
for (String key : words.keySet()) {
System.out.println(key + ": " + words.get(key));
}
}
如何将输出形状更改为(?,32,32,3)?
模型的权重如下:
def forward(self, X, momentum=0.5):
z = tf.matmul(X, self.W1)
z = tf.nn.relu(z)
z = tf.reshape(z, [-1, 7, 7, 512])
z = UpSampling2D()(z)
z = conv2d(z, self.W2, [1, 1, 1, 1], padding="SAME")
# z = batch_norm(z)
z = batch_normalization(z, momentum=momentum)
z = tf.nn.leaky_relu(z)
z = UpSampling2D()(z)
z = conv2d(z, self.W3, [1, 1, 1, 1], padding="SAME")
# z = batch_norm(z)
z = batch_normalization(z, momentum=momentum)
z = tf.nn.leaky_relu(z)
z = conv2d(z, self.W4, [1, 1, 1, 1], padding="SAME")
return tf.nn.tanh(z)