def vjp_matmul_nt_right

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

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

427# d(x @ W^T)/dW alone, g^T @ x, for a product whose input x takes no
428# gradient: the second contribution of vjp_matmul_nt, computed the same way,
429# without g @ W.
430def vjp_matmul_nt_right(+b: Nat, +right: Shape.Shape, saved: Saved, g: Core.Dynamic) -> Pass:
431  match saved:
432    case Unsaved{}:
433      Pass{Unsaved{}, g, Fail{TensorError{Core.StorageLengthMismatch{}}}}
434    case Operands{x, y}:
435      nt_alone_first(b, right, x, y, Core.clone_dynamic(g))

Uses (10)

Used by (4)