BasicBlock#

class ctlearn.core.BasicBlock(in_channels, out_channels, stride=1, conv_shortcut=True, attention=None, conv_layer=<class 'torch.nn.modules.conv.Conv2d'>)[source]#

Bases: Module

Basic block for ResNet architectures.

Methods Summary

forward(x)

Perform the forward pass of the neural network.

setup_attention(channels)

Initialize and configure the attention mechanism for the block.

Methods Documentation

forward(x)[source]#

Perform the forward pass of the neural network.

Parameters#

xtorch.Tensor

The input tensor.

Returns#

torch.Tensor

The output tensor after processing.

setup_attention(channels)[source]#

Initialize and configure the attention mechanism for the block.

Parameters#

channelsint

The number of feature channels to apply attention on.