def project_left_index

bendtorch-core@0.1.0.0 · src/shape/flat.bend:28

import bendtorch-core@0.1.0.0/src/shape/flat.bend as Flat
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape

28def project_left_index(+plan: Shape.BroadcastPlan, map: Shape.Index<Shape.extents(Shape.left_shape(plan)), Shape.extents(Shape.right_shape(plan)), Shape.extents(Shape.output_shape(plan))>, index: Shape.FlatIndex<Shape.output_shape(plan)>) -> Shape.FlatIndex<Shape.left_shape(plan)>:
29  match map index:
30    case Shape.Indexed{rows, exact} Shape.FIndex{+value, bound}:
31      Shape.FIndex{Shape.walk_left(rows, value), left_bound(plan, rows, exact, value, bound)}
32    case Shape.Unindexed{zero} Shape.FIndex{+value, bound}:
33      Empty.absurd(Shape.FlatIndex<Shape.left_shape(plan)>, hollow(Shape.output_shape(plan), value, zero, bound))

Uses (11)

Used by (7)