def Identity

bendtorch-core@0.1.0.0 · src/autograd/sum_to_size_LAWS.bend:9

import bendtorch-core@0.1.0.0/src/autograd/sum_to_size_LAWS.bend as SumToSizeLAWS
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/elementwise_totality.bend as Totality
import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce

9def Identity(-input: Core.Dynamic, +target: Shape.Shape, pair: Core.Dynamic & Result<&2, &1, Reduce.Error, Core.Dynamic>) -> Type:
10  (retained, result) = pair
11  match result:
12    case Fail{error}:
13      Empty
14    case Done{output}:
15      {Totality.dimensions(output) == Shape.dimensions(target) : List<&2, U32>} &
16        (@+index: U32 ->
17          {Core.checked_observe_dynamic(output, index) == Core.checked_observe_dynamic(input, index) : Maybe<&2, F32>} &
18            {Core.observe_dynamic(output, index) == Core.observe_dynamic(input, index) : Maybe<&2, F32>})

Uses (15)

Used by (4)