TorchLean API

NN.Tensor.Packing

Packed Tensors #

The public result type shared by pack and unpack. Component shapes live in the type, so ordinary unpacking does not expose an anonymous metadata tuple.

structure TorchLean.Tensor.Packed (α : Type) (shape : Spec.Shape) (componentShapes : List Spec.Shape) [Storage α] :

A tensor produced by pack, indexed by the star shape of every source tensor.

Use unpack packed pattern to recover the source tensors. The packed tensor is available as packed.tensor, and packed.shapes exposes the certified component shapes when an application needs to inspect them.

  • tensor : Tensor α shape

    Contiguous tensor containing every packed component.

Instances For
    def TorchLean.Tensor.Packed.shapes {α : Type} {shape : Spec.Shape} {componentShapes : List Spec.Shape} [Storage α] :
    Packed α shape componentShapesList Spec.Shape

    Return the certified star shape of every component.

    Instances For