Checked parse_shape #
parse_shape matches one pattern position to each physical tensor dimension
and returns the lengths of named positions in source order. An underscore or
an ellipsis-expanded position is skipped. Unit and positive anonymous axes
are accepted only when their literal length agrees with the corresponding
physical dimension.
The checker returns the existing ordered SupplementaryLengths type. No
separate plan structure is needed because this operation neither transforms
tensor values nor carries data into a later lowering stage.
Expand the unique ellipsis to one skipped position per unmatched physical
dimension. A none entry records a physical dimension hidden by the
ellipsis; every other top-level pattern position is retained verbatim.
The concrete checker establishes the structural and rank preconditions under
which this list has exactly inputRank entries.
Instances For
Extract the named length contributed by one expanded pattern position. Underscores, literals, units, and ellipsis-expanded positions contribute no binding.
Instances For
The declarative dimension condition for one expanded parse-shape position. Named axes and wildcards accept any dimension; units and numeric axes must match their literal lengths.
Instances For
Check one expanded parse-shape axis against its physical dimension.
Instances For
Validate expanded parse-shape axes and physical dimensions in lockstep.
Instances For
Check a parsed parse_shape expression against a concrete tensor shape.
The result contains exactly the named, non-underscore axes in pattern order. The checker rejects genuine composite axes, malformed ellipses, rank mismatches, literal-length mismatches, and duplicate returned names.
Instances For
A successful result is the left-to-right filterMap of the expanded pattern
zipped with physical dimensions. This states both the returned order and the
fact that ellipsis and wildcard positions are skipped rather than reordered.
Successful parse-shape results never contain a duplicate axis name.
Every successful pattern position satisfies its declarative dimension condition. In particular, unit and anonymous numeric axes agree with the physical shape, including dimensions of length zero where allowed.
Each returned (name, length) is obtained from a named expanded pattern
position paired with that exact physical tensor dimension.