问题
I am attempting to use tf.nn.conv3d_transpose
, however, I am getting an error indicating that my filter and output shape is not compatible.
- I have a tensor of size [1,16,16,4,192]
- I am attempting to use a filter of [1,1,1,192,192]
- I believe that the output shape would be [1,16,16,4,192]
- I am using "same" padding and a stride of 1.
Eventually, I want to have an output shape of [1,32,32,7,"does not matter"], but I am attempting to get a simple case to work first.
Since these tensors are compatible in a regular convolution, I believed that the opposite, a deconvolution, would also be possible.
Why is it not possible to perform a deconvolution on these tensors. Could I get an example of a valid filter size and output shape for a deconvolution on a tensor of shape [1,16,16,4,192]
Thank you.
回答1:
- I have a tensor of size [1,16,16,4,192]
- I am attempting to use a filter of [1,1,1,192,192]
- I believe that the output shape would be [1,16,16,4,192]
- I am using "same" padding and a stride of 1.
Yes the output shape will be [1,16,16,4,192]
Here is a simple example showing that the dimensions are compatible:
import tensorflow as tf
i = tf.Variable(tf.constant(1., shape=[1, 16, 16, 4, 192]))
w = tf.Variable(tf.constant(1., shape=[1, 1, 1, 192, 192]))
o = tf.nn.conv3d_transpose(i, w, [1, 16, 16, 4, 192], strides=[1, 1, 1, 1, 1])
print(o.get_shape())
There must be some other problem in your implementation than the dimensions.
来源:https://stackoverflow.com/questions/46590920/deconvolutions-transpose-convolutions-with-tensorflow