checkEqualShape static method

void checkEqualShape(
  1. Layout a,
  2. Layout b, [
  3. String? name
])

Asserts that the layouts a and b share the same shape.

Implementation

static void checkEqualShape(Layout a, Layout b, [String? name]) {
  if (a.rank != b.rank) {
    throw LayoutError.rank(a, b, name);
  }
  for (var i = 0; i < a.rank; i++) {
    if (a.shape[i] != b.shape[i]) {
      throw LayoutError.shape(a, i, b, i, name);
    }
  }
}