xnn.cnn.models.steerable.GatedBlock#
- class xnn.cnn.models.steerable.GatedBlock(fields_in, fields_out, kernel_size=5, stride=1, padding=None, activation='relu', gate_activation='sigmoid', normalization=None, smooth_stride=True, bias=True, bandlimit='compromise', shell_width=0.6)[source]#
Bases:
ModuleSteerable convolution with the gated nonlinearity (Sec. 4.3, Fig. 5).
The convolution produces the output stack plus one extra scalar field per non-scalar output field. Scalar outputs pass through
activation(with a bias), the extra scalars throughgate_activation(with a bias) and multiply, as gates, the non-scalar fields they belong to. With astridethe result is low-pass filtered and subsampled (Sec. 4.4.2;smooth_stride=Falsestrides the convolution instead).normalization="batch"normalizes the input stack withSteerableBatchNorm, the “batch normalization merged with the convolution” of the supplement.- Parameters:
fields_in (sequence of int) – Multiplicities of the input and output stacks.
fields_out (sequence of int) – Multiplicities of the input and output stacks.
kernel_size (int, optional) – Side of the cubic kernels, by default 5.
stride (int, optional) – Downsampling factor, by default 1.
padding (int or None, optional) – Zero padding;
Nonekeeps the grid size.activation (str or None, optional) – Activation of the scalar fields, by default
"relu"(the paper);Noneleaves them linear.gate_activation (str or None, optional) – Activation of the gates, by default
"sigmoid";Noneleaves the non-scalar fields ungated (a linear block).normalization (str or None, optional) –
"batch"orNone.smooth_stride (bool, optional) – Low-pass filter before subsampling, by default
True.bias (bool, optional) – Biases on the scalar fields and gates, by default
True.bandlimit – See
SteerableConv3d.shell_width (float) – See
SteerableConv3d.
- Variables:
conv (SteerableConv3d) – The convolution (its
n_gatesextra scalar outputs are the gates).