models.modules.Conv

Contents

models.modules.Conv#

class Conv(out_channels: int = None, kernel_size: int = 3, stride: int = 1)[source]#

Bases: LayerGen

Generator of standard 2d convolution

Uses torch.nn.Conv2d module. Bias defaults to False, padding is calculated automatically.

Parameters:
  • out_channels (int, optional) – Number of channels produced by the convolution. Defaults to None.

  • kernel_size (int, optional) – Size of the convolving kernel. Defaults to 3.

  • stride (int, optional) – Stride of the convolution. Defaults to 1.

Methods

get

Initializes and returns the network layer

get(in_channels: int) Tuple[Module, int][source]#

Initializes and returns the network layer

Parameters:

in_channels (int) – Number of input channels.

Returns:

The generated module and the number of channels that will be after applying this layer to a tensor with in_channels channels.

Return type:

Tuple[nn.Module, int]