How to stack multiple layers of conv2d_transpose() of Tensorflow

前端 未结 1 516
青春惊慌失措
青春惊慌失措 2021-02-06 11:44

I\'m trying to stack 2 layers of tf.nn.conv2d_transpose() to up-sample a tensor. It works fine during feed forward, but I get an error during backward propagation:

相关标签:
1条回答
  • 2021-02-06 12:02

    I guess you need to change your 'stride' paramter in conv2d_transpose. conv2d_transpos is like conv2d but input and output are reversed.

    For conv2d, the stride and input shape will decide the output shape. For conv2d_transpose, the stride and output shape will decide the input shape. Now your stride is [1 1 1 1], which means output and input of conv2d_transpose is about same (ignoring boundary effect).

    For input H = W = 100, stride = [1 2 2 1], the output of conv2d_tranpose should be 200. (reversed of conv2d), if you set the padding to SAME. In short, input, output and stride need to be compatible.

    0 讨论(0)
提交回复
热议问题