def right_scalar_routed

bendtorch-core@0.1.0.0 · src/tensor/batched_matmul_PROOF.bend:37

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

37# A rank-0 right operand: whatever the left dimensions, the pair is not two
38# matrices, and the plan fails at one rank or the other.
39def right_scalar_routed(+left: Shape.Shape, +right: Shape.Shape, a: Core.Tensor<left>, b: Core.Tensor<right>, +dims: List<&2, U32>) ->
40  {Batched.routed(left, right, a, b, dims, []) == Fail{Matrix.RankMismatch{}} :
41    Result<&2, &1, Matrix.Error, Core.Dynamic & Core.Dynamic & Core.Dynamic>}:
42  match dims:
43    case Nil{}:
44      {==}
45    case +k <> Nil{}:
46      {==}
47    case +m <> +k <> Nil{}:
48      {==}
49    case +x <> +m <> +k <> Nil{}:
50      {==}
51    case +x <> +y <> +m <> +k <> Nil{}:
52      {==}
53    case +x <> +y <> +z <> +t <> +u <> rest:
54      {==}

Uses (9)

Used by (1)