user288609
user288609

Reputation: 13025

regarding tf.nn.conv1d and its corresponding transpose operation

In the latest tensorflow version, there is tf.nn.conv2d_transpose for the 2D deconvolution operation. However, there is no corresponding 1D deconvolution operation for tf.nn.conv1d. How to perform the deconvolution for 1D data?

Upvotes: 0

Views: 846

Answers (1)

Richard_wth
Richard_wth

Reputation: 702

Well, conv1d is actually conv2d with in_height=1. The nn_ops.py.conv1d states:

Internally, this op reshapes the input tensors and invokes `tf.nn.conv2d`. 
For example, if `data_format` does not start with "NC", a tensor of shape
  [batch, in_width, in_channels]
is reshaped to
  [batch, 1, in_width, in_channels],
and the filter is reshaped to
  [1, filter_width, in_channels, out_channels].
The result is then reshaped back to
  [batch, out_width, out_channels]
\(where out_width is a function of the stride and padding as in conv2d\) and
 returned to the caller.

Thus, tf.nn.conv2d_transpose can do the job.

Upvotes: 1

Related Questions