def left_gradient

bendtorch-core@0.1.0.0 · src/tensor/batched_matmul.bend:384

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

384# The left operand's gradient over the output's batch, g @ right^T, of
385# dimensions `left_dims(plan)`: g has the output's shape and right the right
386# operand's. A broadcast left operand still has to be summed to its shape.
387def left_gradient(+plan: Plan, g: Core.Dynamic, right: Core.Dynamic) ->
388  Result<&2, &1, Core.Error, Core.Dynamic & Core.Dynamic & Core.Dynamic>:
389  gradient_shaped(left_layout(plan), g, right, left_dims(plan), Shape.construct(left_dims(plan)))

Uses (9)

Used by (1)