complextorch.nn.gauss.linear#

Classes#

Linear

Gauss-trick Complex-Valued Linear Layer

Module Contents#

class complextorch.nn.gauss.linear.Linear(in_features: int, out_features: int, bias: bool = True, device=None, dtype=None)[source]#

Bases: torch.nn.Module

Gauss-trick Complex-Valued Linear Layer#

Real/imag-split implementation of complex linear multiplication using Gauss’ multiplication trick (3 real matmuls instead of the naive 4). Mirrors torch.nn.Linear, analogous to the Gauss-trick convolutions complextorch.nn.gauss.Conv1d and siblings.

For ordinary use prefer complextorch.nn.Linear, which wraps torch.nn.Linear with dtype=torch.cfloat and is faster on modern PyTorch.

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(input: torch.Tensor) torch.Tensor[source]#

Computes multiplication 25% faster than naive method by using Gauss’ multiplication trick

property bias: torch.Tensor#
linear_i#
linear_r#
property weight: torch.Tensor#