def StepMeaning

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

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/layout.bend as Layout

349def StepMeaning(+input: Shape.Shape, +axes: List<&2, U32>, +plan: Layout.Plan<input, axes>, -index: U32,
350  -original_source: Core.Tensor<input>, -original_target: Core.Tensor<Layout.output(input, axes, plan)>,
351  pair: Core.Tensor<input> & Result<&2, &1, Error, Core.Tensor<Layout.output(input, axes, plan)>>) -> Type:
352  (source, result) = pair
353  match result:
354    case Fail{error}:
355      Unit
356    case Done{target}:
357      SameSource(input, original_source, source) &
358        (Core.ObservationChecked(Core.Packed{Layout.output(input, axes, plan), target}, index) &
359          ({Core.checked_observe(Layout.output(input, axes, plan), target, index) ==
360            expected_output(input, axes, plan, original_source, index) : Maybe<&2, F32>} &
361            (@+other: U32 -> @checked: Core.ObservationChecked(Core.Packed{Layout.output(input, axes, plan), original_target}, other) ->
362              @different: {Nat.is_eq(U32.to_nat(index), U32.to_nat(other)) == False{} : Bool} ->
363                Core.ObservationChecked(Core.Packed{Layout.output(input, axes, plan), target}, other) &
364                  {Core.checked_observe(Layout.output(input, axes, plan), target, other) ==
365                    Core.checked_observe(Layout.output(input, axes, plan), original_target, other) : Maybe<&2, F32>})))

Uses (21)

Used by (11)