Tensor constructor

Tensor(
  1. Float32List data,
  2. List<int> shape
)

Creates a tensor from existing data and shape.

The data length must equal the product of shape dimensions.

Implementation

Tensor(this.data, this.shape) {
  assert(_productOfShape(shape) == data.length,
      'Data length ${data.length} != shape product ${_productOfShape(shape)}');
  strides = _computeStrides(shape);
}