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. Empty operand expressions represent scalar tensors; leading, adjacent, and trailing commas therefore preserve empty operands. Dimension compatibility and supported axis forms belong to the einsum checker.

Split at commas without discarding empty scalar-operand expressions.

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.