I have written a code for deconvolution layer,
def deconv2d(x, W,stride):
x_shape = tf.shape(x)
output_shape = tf.stack([x_shape[0], x_shape[1]*2, x_shape[2]*2, x_shape[3]//2])
decon = tf.nn.conv2d_transpose(x, W, output_shape, strides=[1, stride, stride, 1], padding='SAME')
layer_shape = get_layer_shape(decon)
print('DECONV Shape : ', layer_shape)
return decon
I have called the above function like this way,
deconvolution1 = deconv2d(x=cnn_layer10, W=[2,2,512,1024], stride=2)
getting this error,
File "u-net.py", line 84, in obj.computation() File "u-net.py", line 41, in computation deconvolution1 = deconv2d(x=cnn_layer10, W=[2,2,512,1024], stride=2) File "/home/shuvo/u-net/architecture.py", line 35, in deconv2d decon = tf.nn.conv2d_transpose(x, W, output_shape, strides=[1, stride, stride, 1], padding='SAME') File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/nn_ops.py", line 1019, in conv2d_transpose if not value.get_shape()[axis].is_compatible_with(filter.get_shape()[3]):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/tensor_shape.py", line 500, in getitem return self._dims[key] IndexError: list index out of range
My intention is to make a deconvolution layer where shape should be, [batch_size, 36,36,1024]=>[batch_size,72,72,512]. Please help me to fix this error,