def StepMeaning

bendtorch-core@0.1.0.0 · src/tensor/elementwise.bend:576

import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
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

576def StepMeaning(+operation: Operation, +plan: Shape.BroadcastPlan, -index: U32,
577  original: State<Shape.output_shape(plan)>, result: Step<Shape.output_shape(plan)>) -> Type:
578  State{original_left, original_right, original_output} = original
579  match result:
580    case Stop{left, right, error}:
581      Unit
582    case Continue{State{left, right, output}}:
583      SameSource(original_left, left) &
584        (SameSource(original_right, right) &
585          (Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), output}, index) &
586            ({Core.observe(Shape.output_shape(plan), output, index) == expected(operation, plan, original_left, original_right, index) : Maybe<&2, F32>} &
587              (@+other: U32 -> @checked: Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), original_output}, other) ->
588                @different: {Nat.is_eq(U32.to_nat(index), U32.to_nat(other)) == False{} : Bool} ->
589                  Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), output}, other) &
590                    {Core.observe(Shape.output_shape(plan), output, other) == Core.observe(Shape.output_shape(plan), original_output, other) : Maybe<&2, F32>}))))

Uses (18)

Used by (8)