def Mat.reshape

bend-ml-tensor@0.1.2.0 · main.bend:302

import bend-ml-tensor@0.1.2.0/main.bend as BendMlTensor
import Base

302# Reshape: compiles only with the PROOF that the number of elements does not change.
303def Mat.reshape(-r1: Nat, -c1: Nat, r2: Nat, +c2: Nat, -p: {Nat.mul(r1, c1) == Nat.mul(r2, c2) : Nat}, a: Mat<r1, c1>) -> Mat<r2, c2>:
304  match a:
305    case Mat{x}:
306      Mat{chunk.l(r2, c2, flatten.l(x))}

Uses (5)

Used by (2)