type OneContract

bendtorch-core@0.1.0.0 · src/autograd/tensor_vjp_LAWS.bend:496

import bendtorch-core@0.1.0.0/src/autograd/tensor_vjp_LAWS.bend as TensorVjpLAWS
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/autograd/tensor_backward.bend as Backward
import bendtorch-core@0.1.0.0/src/autograd/tensor_backward_LAWS.bend as TensorBackward

496# What a VJP that sends one contribution promises: it goes to node a with the
497# target's dimensions and holds cell(i) at every in-bounds i.
498type OneContract<-a: Nat, -target: Shape.Shape, -cell: U32 -> Maybe<&2, F32>, -pass: Backward.Pass> is Type:
499  OneContract{
500    target_id: {TensorBackward.sole_target(TensorBackward.sole(pass)) == Some{a} : Maybe<&2, Nat>},
501    dimensions: {TensorBackward.sole_dimensions(TensorBackward.sole(pass)) == Some{Shape.dimensions(target)} : Maybe<&2, List<&2, U32>>},
502    value: @+index: U32 -> @inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(target))) == True{} : Bool} ->
503      {TensorBackward.sole_point(TensorBackward.sole(pass), index) == cell(index) : Maybe<&2, F32>}}

Uses (16)

Used by (2)