DecoderBlock¶

class DecoderBlock(in_channels, skip_channels, out_channels, attention_type='scse')[source]¶

Decoder block with upsampling, skip connection, and attention.

This block performs upsampling of the input features, concatenates with skip connections from the encoder, applies attention mechanisms, and processes through convolutions.

Parameters:
  • in_channels (int) – Number of input channels

  • skip_channels (int) – Number of channels from skip connection

  • out_channels (int) – Number of output channels

  • attention_type (str) – Type of attention mechanism. Default: ‘scse’.

Initialize DecoderBlock.

Parameters:
  • in_channels (int) – Number of input channels.

  • skip_channels (int) – Number of channels from skip connection.

  • out_channels (int) – Number of output channels.

  • attention_type (str) – Type of attention mechanism. Default: ‘scse’.

Methods

forward

Forward pass through decoder block.

Attributes

training

forward(x, skip=None)[source]¶

Forward pass through decoder block.

Parameters:
  • x (torch.Tensor) – Input tensor to be upsampled

  • skip (Optional[torch.Tensor]) – Skip connection tensor from encoder. Default: None

Returns:

Processed output tensor

Return type:

torch.Tensor