TorchLean API

NN.Tensor.Internal.Syntax.Parser.Einsum

Einsum-pattern parsing #

This module parses comma-separated operands, the output expression, and their canonical rendering round trip.

Split an einsum input token stream at top-level commas.

Instances For

    Compute the smallest span covering a token list, or use the fallback when empty.

    Instances For

      Parse comma-separated einsum operands in source order.

      Instances For

        Parse an einsum pattern with one or more comma-separated input expressions.

        Instances For

          Parsing a successful einsum pattern's canonical rendering succeeds with the same canonical syntax.

          The theorem applies to any number of input tensors. It preserves their order and comma boundaries, including empty expressions denoting scalar operands. Repeated labels and ellipses inside inputs are retained; only source locations and anonymous-axis occurrence offsets are intentionally refreshed.