convBlock

class colibri.models.custom_layers.convBlock(in_channels=1, out_channels=1, kernel_size=3, bias=False, mode='CBR', factor=2)[source]

Bases: Module

Convolutional Block

default configuration: (Conv2D => Batchnorm => ReLU) * 2

Convolutional Block

Parameters:
  • out_channels (int, optional) – number of output channels. Defaults to 1.

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

  • bias (bool, optional) – whether to use bias or not. Defaults to False.

  • mode (str, optional) – mode of the convBlock, posible values are: [‘C’, ‘B’, ‘R’, ‘U’, ‘M’, ‘A’]. Defaults to ‘CBR’.

  • factor (int, optional) – factor for upsampling/downsampling. Defaults to 2.

forward(x)[source]

Forward pass of the convBlock.

Parameters:

x (torch.Tensor) – Input tensor

Returns:

Output tensor

Return type:

torch.Tensor

build_layer(c, params, factor)[source]

Build layer based on the mode.

Parameters:
  • c (str) – mode of the layer

  • params (dict) – parameters for the layer

  • factor (int) – factor for upsampling/downsampling

Returns:

Layer

Return type:

nn.Module