def batched_reduced

bendtorch-core@0.1.0.0 · src/autograd/tensor_backward.bend:566

import bendtorch-core@0.1.0.0/src/autograd/tensor_backward.bend as TensorBackward
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

566# A contribution for operand target from a product over the output's batch:
567# the product reduced to the operand's shape, as a broadcast operand of an
568# elementwise operation is.
569def batched_reduced(+target: Nat, +shape: Shape.Shape,
570  result: Result<&2, &1, Core.Error, Core.Dynamic & Core.Dynamic & Core.Dynamic>) -> Result<&2, &1, Error, Contribution>:
571  match result:
572    case Fail{error}:
573      Fail{TensorError{error}}
574    case Done{triple}:
575      (first, second, product) = triple
576      contribution_of(reduced(target, shape, product))

Uses (11)

Used by (2)