nntoolbox.vision.components.ho module

Some higher order layers

class nntoolbox.vision.components.ho.QuadraticPolynomialConv2D(in_channels, out_channels, kernel_size, rank: int, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', sqrt: bool = False, eps: float = 1e-06)[source]

Bases: torch.nn.modules.module.Module

h(x) = sum_k(A_k * x)^2 + b * x + c

where the * represents convolution

References:

Bergstra et al. “Quadratic Polynomials Learn Better Image Features.” http://www.iro.umontreal.ca/~lisa/publications2/index.php/attachments/single/205 (dead link, use web archive)

forward(input: torch.Tensor) → torch.Tensor[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.

training: bool