Why do we have to specify output shape during deconvolution in tensorflow?

懵懂的女人 提交于 2019-12-20 02:29:30

问题


The TF documentation has an output_shape parameter in tf.conv2d_transpose. Why is this needed? Don't the strides, filter size and padding parameters of the layer decide the output shape of that layer, similar to how it is decided during convolution?


回答1:


This question was already asked on TF github and received an answer:

output_shape is needed because the shape of the output can't necessarily be computed from the shape of the input, specifically if the output is smaller than the filter and we're using VALID padding so the input is an empty image. However, this degenerate case is unimportant most of the time, so it'd be reasonable to make the Python wrapper compute output_shape automatically if it isn't set.

It makes sense to read the whole thread.

If you assume the following notation, output = o, input = i, kernel = k, stride = s, padding = p, the shape of the output will be:



来源:https://stackoverflow.com/questions/43624625/why-do-we-have-to-specify-output-shape-during-deconvolution-in-tensorflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!