// matmul.mbt

///|
/// Matrix multiplication of two 2D Tensors.
pub fn Tensor::matmul(self : Tensor, other : Tensor) -> Tensor {
  let len1 = self.shape.length()
  let len2 = other.shape.length()
  if len1 != 2 || len2 != 2 {
    panic()
  }
  let m = self.shape[0]
  let k1 = self.shape[1]
  let k2 = other.shape[0]
  let n = other.shape[1]
  if k1 != k2 {
    panic()
  }

  let data = Array::make(m * n, 0.0)
  let out_shape = [m, n]

  for r in 0..