Encoder#

class radionets.architecture.Encoder(in_channels: int, out_channels: int, kernel_size: int = 3, *, stride: int = 1, padding: int = 1, groups: int = 1, bias: bool = False, dropout: bool | int = False, batchnorm: bool = False)[source]#

Bases: NNBlock

Encoder block for UNets.

Parameters:
in_channelsint

Number of input channels.

out_channelsint

Number of output channels.

kernel_sizeint, optional

Size of the convolution kernel. Default: 3

strideint or tuple, optional

Stride for the cross-correlation. Default: 1

paddingint, optional

The amount of padding applied to the input. Default: 0

groupsint, optional

Controls the behavior of input and output groups. See Conv2d. Default: 1

biasbool

Whether to apply bias. Default: False

dropoutbool or float, optional

Wether to apply dropout. If float > 0 this is the dropout percentage. Default: False

batchnormbool, optional

If True, add a batchnorm layer to the encoder block. Default: False

Methods Summary

forward(x)

Define the computation performed at every call.

Methods Documentation

forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.