Table of Contents
Shortcuts

# Conv2dNormActivation

class torchvision.ops.Conv2dNormActivation(in_channels: int, out_channels: int, kernel_size: ~typing.Union[int, ~typing.Tuple[int, int]] = 3, stride: ~typing.Union[int, ~typing.Tuple[int, int]] = 1, padding: ~typing.Optional[~typing.Union[int, ~typing.Tuple[int, int], str]] = None, groups: int = 1, norm_layer: ~typing.Optional[~typing.Callable[[...], ~torch.nn.modules.module.Module]] = <class 'torch.nn.modules.batchnorm.BatchNorm2d'>, activation_layer: ~typing.Optional[~typing.Callable[[...], ~torch.nn.modules.module.Module]] = <class 'torch.nn.modules.activation.ReLU'>, dilation: ~typing.Union[int, ~typing.Tuple[int, int]] = 1, inplace: ~typing.Optional[bool] = True, bias: ~typing.Optional[bool] = None)

  Configurable block used for Convolution2d-Normalization-Activation blocks.

  Parameters:

    - in_channels (int) – Number of channels in the input image

    - out_channels (int) – Number of channels produced by the Convolution-Normalization-Activation block

    - kernel_size – (int, optional): Size of the convolving kernel. Default: 3

    - stride (int, optional) – Stride of the convolution. Default: 1

    - padding (int, tuple or str, optional) – Padding added to all four sides of the input. Default: None, in which case it will be calculated as `padding = (kernel_size - 1) // 2 * dilation`

    - groups (int, optional) – Number of blocked connections from input channels to output channels. Default: 1

    - norm_layer (Callable[..., torch.nn.Module], optional) – Norm layer that will be stacked on top of the convolution layer. If `None` this layer won’t be used. Default: `torch.nn.BatchNorm2d`

    - activation_layer (Callable[..., torch.nn.Module], optional) – Activation function which will be stacked on top of the normalization layer (if not None), otherwise on top of the conv layer. If `None` this layer won’t be used. Default: `torch.nn.ReLU`

    - dilation (int) – Spacing between kernel elements. Default: 1

    - inplace (bool) – Parameter for the activation layer, which can optionally do the operation in-place. Default `True`

    - bias (bool, optional) – Whether to use bias in the convolution layer. By default, biases are included if `norm_layer is None`.

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.