![]() |
The transpose of conv2d
.
tf.compat.v2.nn.conv2d_transpose(
input,
filters,
output_shape,
strides,
padding='SAME',
data_format='NHWC',
dilations=None,
name=None
)
This operation is sometimes called "deconvolution" after Deconvolutional
Networks, but is
actually the transpose (gradient) of conv2d
rather than an actual
deconvolution.
Args:
input
: A 4-DTensor
of typefloat
and shape[batch, height, width, in_channels]
forNHWC
data format or[batch, in_channels, height, width]
forNCHW
data format.filters
: A 4-DTensor
with the same type asinput
and shape[height, width, output_channels, in_channels]
.filter
'sin_channels
dimension must match that ofinput
.output_shape
: A 1-DTensor
representing the output shape of the deconvolution op.strides
: An int or list ofints
that has length1
,2
or4
. The stride of the sliding window for each dimension ofinput
. If a single value is given it is replicated in theH
andW
dimension. By default theN
andC
dimensions are set to 0. The dimension order is determined by the value ofdata_format
, see below for details.padding
: A string, either'VALID'
or'SAME'
. The padding algorithm. See the "returns" section oftf.nn.convolution
for details.data_format
: A string. 'NHWC' and 'NCHW' are supported.dilations
: An int or list ofints
that has length1
,2
or4
, defaults to 1. The dilation factor for each dimension ofinput
. If a single value is given it is replicated in theH
andW
dimension. By default theN
andC
dimensions 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 ofdata_format
, see above for details. Dilations in the batch and depth dimensions if a 4-d tensor must be 1.name
: Optional name for the returned tensor.
Returns:
A Tensor
with the same type as input
.
Raises:
ValueError
: If input/output depth does not matchfilter
's shape, or if padding is other than'VALID'
or'SAME'
.