Blocks

class ezflow.modules.blocks.BasicBlock(in_channels, out_channels, stride=1, norm='group', activation='relu')[source]

Basic residual block for ResNet-style architectures

Parameters
  • in_channels (int) – Number of input channels

  • out_channels (int) – Number of output channels

  • stride (int, optional) – Stride of the convolution

  • norm (str, optional) – Normalization method. One of “group”, “batch”, “instance”, or None

  • activation (str, optional) – Activation function. One of “relu”, “leakyrelu”, or None

forward(x)[source]

Defines 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.

class ezflow.modules.blocks.BottleneckBlock(in_channels, out_channels, stride=1, norm='group', activation='relu')[source]

Bottleneck residual block for ResNet-style architectures

Parameters
  • in_channels (int) – Number of input channels

  • out_channels (int) – Number of output channels

  • stride (int, optional) – Stride of the convolution

  • norm (str, optional) – Normalization method. One of “group”, “batch”, “instance”, or None

  • activation (str, optional) – Activation function. One of “relu”, “leakyrelu”, or None

forward(x)[source]

Defines 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.