Layout.internal constructor

  1. @internal
Layout.internal({
  1. required int rank,
  2. required int length,
  3. required int offset,
  4. required List<int> shape,
  5. required List<int> strides,
  6. required bool isContiguous,
})

Internal constructor of Layout object.

Implementation

@internal
Layout.internal({
  required this.rank,
  required this.length,
  required this.offset,
  required this.shape,
  required this.strides,
  required this.isContiguous,
})  : assert(shape is TypedData, '`shape` should be TypedData'),
      assert(shape.length == rank, '`shape` should be of length $rank'),
      assert(shape.every((s) => s > 0), '`shape` should be positive'),
      assert(strides is TypedData, '`strides` should be TypedData'),
      assert(strides.length == rank, '`strides` should be of length $rank'),
      assert(length == shape.product() || (length == 0 && rank == 0),
          '`length` should match `shape`'),
      assert(
          isContiguous == utils.isContiguous(shape: shape, strides: strides));