def left_product
bendtorch-core@0.1.0.0 · src/autograd/tensor_backward.bend:323
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
import bendtorch-core@0.1.0.0/src/tensor/matmul.bend as Matrix
import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
323
324
325def left_product(+target: Nat, +shape: Shape.Shape, copy: Core.Dynamic,
326 pair: Core.Dynamic & Result<&2, &1, Transforms.Error, Core.Dynamic>) -> Core.Dynamic & Result<&2, &1, Error, Contribution>:
327 (right, transposed) = pair
328 match transposed:
329 case Fail{error}:
330 (right, Fail{TransformError{error}})
331 case Done{flipped}:
332 (right, multiplied(target, shape, Matrix.matmul(copy, flipped)))