boundlab.linearop.ExpandOp#

class boundlab.linearop.ExpandOp[source]#

Bases: object

Broadcast-expand dimensions.

Implemented as an EinsumOp with a ones template tensor. When len(input_shape) < len(output_shape), leading size-1 dims are prepended to input_shape automatically.

Uses torch.tensor(1.0).expand(output_shape) as the einsum tensor to save memory (stride-zero storage).

Methods

__init__

static __new__(cls, input_shape, output_shape)[source]#