def map_output

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

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

386def map_output(+input: Shape.Shape, +axes: List<&2, U32>, +plan: Plan<input, axes>, +i: U32,
387  oi: FlatIndex<output(input, axes, plan)>,
388  requested: {index_value(output(input, axes, plan), oi) == i : U32},
389  +words: List<&2, U32>,
390  decoded: {words == reverse_words(unflatten_words(reverse_words(Shape.dimensions(output(input, axes, plan))), i)) : List<&2, U32>},
391  checked: Result<&2, &2, Shape.Error, WordsValid(Shape.dimensions(output(input, axes, plan)), words)>) ->
392  Result<&2, &2, Error, Mapping<input, axes, plan, i>>:
393  match checked:
394    case Fail{error}:
395      Fail{ShapeError{error}}
396    case Done{valid}:
397      +oc = {CWord{words, valid} : CheckedCoordinate<output(input, axes, plan)>}
398      map_inverse(input, axes, plan, i, oi, oc, requested, decoded,
399        inverse_coordinates(Shape.dimensions(input), axes, words, 0), {==})

Uses (18)

Used by (2)