def product_01

bendtorch-core@0.1.0.0 · src/tensor/axis_algebra.bend:381

import bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend as AxisAlgebra
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/axis_spec.bend as Axis

381def product_01(+dims: List<&2, Nat>, length: {List.length(&2, Nat, dims) == 2n : Nat}) -> {Shape.numel(Axis.order(Nat, dims, [0n, 1n])) == Shape.numel(dims) : Nat}:
382  match dims:
383    case Nil{}:
384      Empty.absurd({Shape.numel(Axis.order(Nat, Nil{}, [0n, 1n])) == Shape.numel(Nil{}) : Nat}, nat_clash(0n, 2n, length, {==}))
385    case +x0 <> Nil{}:
386      Empty.absurd({Shape.numel(Axis.order(Nat, x0 <> Nil{}, [0n, 1n])) == Shape.numel(x0 <> Nil{}) : Nat}, nat_clash(1n, 2n, length, {==}))
387    case +x0 <> +x1 <> Nil{}:
388      {==}
389    case +x0 <> +x1 <> +x2 <> +tail:
390      Empty.absurd({Shape.numel(Axis.order(Nat, x0 <> x1 <> x2 <> tail, [0n, 1n])) == Shape.numel(x0 <> x1 <> x2 <> tail) : Nat}, nat_clash(3n+List.length(&2, Nat, tail), 2n, length, {==}))

Uses (7)

Used by (1)