tf.nn.conv2d_transpose
View source on GitHub |
The transpose of conv2d
.
tf.nn.conv2d_transpose( input, filters, output_shape, strides, padding='SAME', data_format='NHWC', dilations=None, name=None )
This operation is sometimes called "deconvolution" after (Zeiler et al., 2010), but is really the transpose (gradient) of atrous_conv2d
rather than an actual deconvolution.
Args | ||
---|---|---|
input | A 4-D Tensor of type float and shape [batch, height, width, in_channels] for NHWC data format or [batch, in_channels, height, width] for NCHW data format. | |
filters | A 4-D Tensor with the same type as input and shape [height, width, output_channels, in_channels] . filter 's in_channels dimension must match that of input . | |
output_shape | A 1-D Tensor representing the output shape of the deconvolution op. | |
strides | An int or list of ints that has length 1 , 2 or 4 . The stride of the sliding window for each dimension of input . If a single value is given it is replicated in the H and W dimension. By default the N and C dimensions are set to 0. The dimension order is determined by the value of data_format , see below for details. | |
padding | Either the string "SAME"or "VALID"indicating the type of padding algorithm to use, or a list indicating the explicit paddings at the start and end of each dimension. When explicit padding is used and data_format is "NHWC", this should be in the form [[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]]. When explicit padding used and data_format is "NCHW", this should be in the form [[0, 0], [0, 0], [pad_top, pad_bottom], [pad_left, pad_right]]. </td> </tr><tr> <td> data_format</td> <td> A string. 'NHWC' and 'NCHW' are supported. </td> </tr><tr> <td> dilations</td> <td> An int or list of intsthat has length 1, 2or 4, defaults to 1. The dilation factor for each dimension of input. If a single value is given it is replicated in the Hand Wdimension. By default the Nand Cdimensions are set to 1. If set to k > 1, there will be k-1 skipped cells between each filter element on that dimension. The dimension order is determined by the value of data_format, see above for details. Dilations in the batch and depth dimensions if a 4-d tensor must be 1. </td> </tr><tr> <td> name` | Optional name for the returned tensor. |
Returns | |
---|---|
A Tensor with the same type as input . |
Raises | |
---|---|
ValueError | If input/output depth does not match filter 's shape, or if padding is other than 'VALID' or 'SAME' . |
References:
Deconvolutional Networks: Zeiler et al., 2010 (pdf)
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/nn/conv2d_transpose