def natural_decided

bendtorch-core@0.1.0.0 · src/tensor/transforms.bend:127

import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout

127def natural_decided(+input: Shape.Shape, +axes: List<&2, U32>, +plan: Layout.Plan<input, axes>, +cursor: Nat,
128  +index: U32, source: Core.Tensor<input>, target: Core.Tensor<Layout.output(input, axes, plan)>,
129  -candidate: {index == U32.from_nat(cursor) : U32},
130  decision: Shape.BoolCase<Nat.is_eq(U32.to_nat(index), cursor)>) -> NaturalCopy<input, axes, plan, cursor>:
131  match decision:
132    case Shape.BFalse{equal}:
133      NaturalError{source}
134    case Shape.BTrue{equal}:
135      natural_result(input, axes, plan, cursor, index, Lifecycle.natural_equal(U32.to_nat(index), cursor, equal), candidate,
136        copy_step(input, axes, plan, source, target, index))

Uses (15)

Used by (4)