I am trying to use the tf.nn.deconv2d()
op on a variable-sized batch of data. However, it appears that I need to set the output_shape
argument as follows:
tf.nn.deconv2d(x, filter, output_shape=[12, 24, 24, 5], strides=[1, 2, 2, 1],
padding="SAME")
Why does tf.nn.deconv2d()
take a fixed output_shape
? Is there any way to specify a variable batch dimension? What happens if the input batch size varies?
N.B.
tf.nn.deconv2d()
will be calledtf.nn.conv2d_transpose()
in the next release of TensorFlow (0.7.0).The
output_shape
argument totf.nn.deconv2d()
accepts a computedTensor
as its value, which enables you specify a dynamic shape. For example, let's say your input is defined as follows:...then the batch size for a particular step can be computed at runtime:
With this value, you can then build the
output_shape
argument totf.nn.deconv2d()
usingtf.pack()
: