Skip to content

LowerTriangularLinear

Bases: BaseModule

Linear layer with a lower-triangular weight, optionally extended with dense rows.

Designed to support in-place inference with a buffer of size max(in_features, out_features):

  • When out <= in the weight is lower triangular with the triangular block flush against the right edge.
  • When out > in the last in rows are lower triangular (a square block) and the first out - in rows are fully dense.

Parameters:

Name Type Description Default
in_features int

Number of input features.

required
out_features int

Number of output features.

required
bias bool

Whether to include an additive bias term.

True
device str

Torch device for the parameters.

'cpu'
act_func str | None

Either "relu" or None.

None