ActivationConv

class ActivationConv(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, activation=None, **activation_kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

A combination of convolution with optional same-padding and arbitrary activation

See also

Conv2dWithSamePadding

Parameters:
  • in_channels (int) – channels of convolution input
  • out_channels (int) – number of filters and output channes
  • kernel_size (int or Iterable) – specifies the kernel dimensions. If int: same kernel size is used for all dimensions
  • stride (int or Iterable, optional) – specifies the convolution strides (default: 1) If int: same stride is used for all dimensions
  • padding (int or Iterable, optional) – specifies the input padding (default: 0) If int: same padding is used for all dimensions
  • dilation (int or str or Iterable, optional) –

    specifies the convolution dilation (default: 1) If int: same dilation is used for all dimensions If str: only supported string is ‘same’, which calculates the

    necessary padding during forward
  • groups (int, optional) – number of convolution groups (default: 1)
  • bias (bool, optional) – whether to include a bias or not (default: True)
  • activation (str, optional) – the activation to apply; must be a valid name of module or function in torch.nn or torch.nn.functional (the default is None, which won’t apply any activation)
forward(input_tensor)[source]

convolves the input and applies activation afterwards

Parameters:input_tensor (torch.Tensor) – the input tensor to be convolved
Returns:tensor after convolution and activation
Return type:torch.Tensor