xnn.gnn.fast.linear.EquivariantLinear#

class xnn.gnn.fast.linear.EquivariantLinear(*args, **kwargs)[source]#

Bases: Linear, FastPathModule

e3nn.o3.Linear (same arguments, parameters and state_dict) with a fast path.

The fast path applies to shared weights without biases on inputs of shape (n, irreps_in.dim): one matrix product per output irrep block on the input split once, in place of e3nn’s slices of the input whose backward fills a zero gradient of the full width per block.

fast_supported(device, dtype)[source]#

Whether the fast path can run for inputs on device in dtype.

Parameters:
Return type:

bool

forward(features, weight=None, bias=None)[source]#

The linear map of features (shape (..., irreps_in.dim)); weight and bias replace the module’s own as in e3nn.o3.Linear.

Parameters:
Return type:

Tensor

scaled_ir_mul(features, scale)[source]#

self(features) * scale with every output irrep block laid out (2l + 1, mul), the scale folded into the weights (fast path only).

Parameters:
Return type:

Tensor