def plan_counted

bendtorch-core@0.1.0.0 · src/tensor/layout.bend:96

import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape

96def plan_counted(+input: Shape.Shape, +axes: List<&2, U32>, +out: Shape.Shape,
97  valid: {True{} == bijective(input, axes) : Bool},
98  ordered: {Some{Shape.dimensions(out)} == reorder(Shape.dimensions(input), axes) : Maybe<&2, List<&2, U32>>},
99  decision: Shape.BoolCase<Nat.is_eq(Shape.elements(input), Shape.elements(out))>) ->
100  Result<&2, &2, Error, Plan<input, axes>>:
101  match decision:
102    case Shape.BFalse{equal}:
103      Fail{ElementCountMismatch{}}
104    case Shape.BTrue{equal}:
105      Done{Permutation{out, valid, ordered, equal}}

Uses (14)

Used by (2)