The transpose of `conv2d`. This operation is sometimes called "deconvolution" after [Deconvolutional Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is actually the transpose (gradient) of `conv2d` rather than an actual deconvolution. Args: input: A 4-D `Tenso
(
input, # pylint: disable=redefined-builtin
filters, # pylint: disable=redefined-builtin
output_shape,
strides,
padding="SAME",
data_format="NHWC",
dilations=None,
name=None)
| 2248 | |
| 2249 | @tf_export("nn.conv2d_transpose", v1=[]) |
| 2250 | def conv2d_transpose_v2( |
| 2251 | input, # pylint: disable=redefined-builtin |
| 2252 | filters, # pylint: disable=redefined-builtin |
| 2253 | output_shape, |
| 2254 | strides, |
| 2255 | padding="SAME", |
| 2256 | data_format="NHWC", |
| 2257 | dilations=None, |
| 2258 | name=None): |
| 2259 | """The transpose of `conv2d`. |
| 2260 | |
| 2261 | This operation is sometimes called "deconvolution" after [Deconvolutional |
| 2262 | Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is |
| 2263 | actually the transpose (gradient) of `conv2d` rather than an actual |
| 2264 | deconvolution. |
| 2265 | |
| 2266 | Args: |
| 2267 | input: A 4-D `Tensor` of type `float` and shape `[batch, height, width, |
| 2268 | in_channels]` for `NHWC` data format or `[batch, in_channels, height, |
| 2269 | width]` for `NCHW` data format. |
| 2270 | filters: A 4-D `Tensor` with the same type as `input` and shape `[height, |
| 2271 | width, output_channels, in_channels]`. `filter`'s `in_channels` dimension |
| 2272 | must match that of `input`. |
| 2273 | output_shape: A 1-D `Tensor` representing the output shape of the |
| 2274 | deconvolution op. |
| 2275 | strides: An int or list of `ints` that has length `1`, `2` or `4`. The |
| 2276 | stride of the sliding window for each dimension of `input`. If a single |
| 2277 | value is given it is replicated in the `H` and `W` dimension. By default |
| 2278 | the `N` and `C` dimensions are set to 0. The dimension order is determined |
| 2279 | by the value of `data_format`, see below for details. |
| 2280 | padding: A string, either `'VALID'` or `'SAME'`. The padding algorithm. See |
| 2281 | the "returns" section of `tf.nn.convolution` for details. |
| 2282 | data_format: A string. 'NHWC' and 'NCHW' are supported. |
| 2283 | dilations: An int or list of `ints` that has length `1`, `2` or `4`, |
| 2284 | defaults to 1. The dilation factor for each dimension of`input`. If a |
| 2285 | single value is given it is replicated in the `H` and `W` dimension. By |
| 2286 | default the `N` and `C` dimensions are set to 1. If set to k > 1, there |
| 2287 | will be k-1 skipped cells between each filter element on that dimension. |
| 2288 | The dimension order is determined by the value of `data_format`, see above |
| 2289 | for details. Dilations in the batch and depth dimensions if a 4-d tensor |
| 2290 | must be 1. |
| 2291 | name: Optional name for the returned tensor. |
| 2292 | |
| 2293 | Returns: |
| 2294 | A `Tensor` with the same type as `input`. |
| 2295 | |
| 2296 | Raises: |
| 2297 | ValueError: If input/output depth does not match `filter`'s shape, or if |
| 2298 | padding is other than `'VALID'` or `'SAME'`. |
| 2299 | """ |
| 2300 | with ops.name_scope(name, "conv2d_transpose", |
| 2301 | [input, filter, output_shape]) as name: |
| 2302 | if data_format is None: |
| 2303 | data_format = "NHWC" |
| 2304 | channel_index = 1 if data_format.startswith("NC") else 3 |
| 2305 | |
| 2306 | strides = _get_sequence(strides, 2, channel_index, "strides") |
| 2307 | dilations = _get_sequence(dilations, 2, channel_index, "dilations") |
no test coverage detected