Skip to content
class

Conv2d

extendsOFTLayer
Conv2d(base_layer: nn.Module, adapter_name: str, config: C)

Implementing kernel

C++ engine symbols that back this Python API.

An nn.Conv2d with an OFT rotation of its flattened in x kernel axis: the convolution runs with the rotated filters.

The reference rotates every unfolded input patch and sums the overlapping patches back before convolving, which equals this only for 1x1 kernels. Here the rotation is applied to the filters, so the adapted layer and its merged form are the same computation.

Parameters

base_layernn.Conv2d
The layer to adapt; the other parameters are those of OFTLayer.
adapter_namestr
Name of the first rotation.
configOFTConfig
Block count or size, dropout, coft, block_share, the Cayley options, init_weights.

Used by 1