Source code for aitemplate.frontend.nn.conv2d.transposed_conv2d_bias

#  Copyright (c) Meta Platforms, Inc. and affiliates.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
from aitemplate.frontend.nn.conv2d.transposed_conv2d_bias_act import (
    ConvTranspose2dBiasAct,
)


[docs]class ConvTranspose2dBias(ConvTranspose2dBiasAct): r"""Applies a 2D transposed convolution operator over an input image composed of several input planes. This module can be seen as the gradient of Conv2d with respect to its input. It is also known as a fractionally-strided convolution or a deconvolution (although it is not an actual deconvolution operation as it does not compute a true inverse of convolution). For more information, see the visualizations `here`_ and the `Deconvolutional Networks`_ paper. Args: in_channels (int): Number of channels in the input image out_channels (int): Number of channels produced by the convolution kernel_size (int): Size of the convolving kernel stride (int): Stride of the convolution padding (int, optional): Padding added to all four sides of the input. Default: 0 dilation (int, optional): Spacing between kernel elements. Default: 1 groups (int, optional): Number of blocked connections from input channels to output channels. Default: 1 dtype (string, optional): Data type. Default: "float16" Shape: - Input: :math:`(N, H_{in}, W_{in}, C_{in})` - Output: :math:`(N, H_{out}, W_{out}, C_{out})`, where .. math:: H_{out} = (H_{in} - 1) \times \text{stride} - 2 \times \text{padding} + \text{dilation} \times (\text{kernel_size} - 1) + \text{output_padding} + 1 .. math:: W_{out} = (W_{in} - 1) \times \text{stride} - 2 \times \text{padding} + \text{dilation} \times (\text{kernel_size} - 1) + \text{output_padding} + 1 Attributes: weight (Tensor): the learnable weights of the module of shape :math:`(\text{out_channels}, \text{kernel_size}, \text{kernel_size}, ` :math:`\frac{\text{in_channels}}{\text{groups}})`. bias (Tensor): the learnable bias of the module of shape (out_channels). .. _`here`: https://github.com/vdumoulin/conv_arithmetic/blob/master/README.md .. _`Deconvolutional Networks`: https://www.matthewzeiler.com/mattzeiler/deconvolutionalnetworks.pdf """ def __init__( self, in_channels, out_channels, kernel_size, stride, padding=0, dilation=1, groups=1, dtype="float16", ): super().__init__( "transposed_conv2d_bias", in_channels, out_channels, kernel_size, stride, padding, dilation, groups, dtype, )