Float32Matrix.withFloat32List constructor

Float32Matrix.withFloat32List(
  1. Float32List rows, {
  2. required int width,
})

Constructs a matrix that uses the given Float32List for storing rows.

Implementation

factory Float32Matrix.withFloat32List(
  Float32List rows, {
  required int width,
}) {
  final length = rows.length;
  final height = length ~/ width;
  if (width * height != length) {
    throw ArgumentError.value(
        width, 'width', 'Invalid dimensions ($width * $height != $length)');
  }
  return Float32Matrix._(TensorShape(width, height), rows);
}