xnn.cnn.models.cnn3d.Conv3dBlock#

class xnn.cnn.models.cnn3d.Conv3dBlock(in_channels, out_channels, kernel_size=5, stride=1, padding=None, activation='relu', normalization=None, smooth_stride=True)[source]#

Bases: Module

One block of the conventional CNN: convolution, low-pass stride, normalization, activation.

Parameters:
  • in_channels (int) – Channels in and out.

  • out_channels (int) – Channels in and out.

  • kernel_size (int, optional) – Side of the cubic kernel, by default 5.

  • stride (int, optional) – Downsampling factor, by default 1.

  • padding (int or None, optional) – Zero padding; None keeps the grid size (kernel_size // 2).

  • activation (str or None, optional) – Element-wise activation (make_activation()), by default "relu"; None for a linear block.

  • normalization (str or None, optional) – "batch" inserts a BatchNorm3d after the convolution.

  • smooth_stride (bool, optional) – Low-pass filter before subsampling (default) instead of a strided convolution.

forward(x)[source]#

Apply the block to (B, C_in, X, Y, Z) fields.

Parameters:

x (Tensor)

Return type:

Tensor