2

How to pad MNIST dataset images of size (?,28,28,1) with tf.pad() and make it (?,32,32,1) in tensorflow?

4

1 回答 1

3

这取决于您打算如何填充它。上的例子是这样的:

# Assuming input is a tensor with shape (?, 28, 28, 1)
output = tf.pad(input, [[0, 0], [2,2], [2,2], [0,0]])
# print(tf.shape(output)) should be (?, 32, 32, 1)
于 2017-10-19T22:59:47.013 回答