Tensor.full constructor

Tensor.full(
  1. List<int> shape,
  2. double value
)

Creates a tensor filled with a constant value.

Implementation

factory Tensor.full(List<int> shape, double value) {
  final size = _productOfShape(shape);
  final data = Float32List(size);
  for (int i = 0; i < size; i++) {
    data[i] = value;
  }
  return Tensor(data, List<int>.from(shape));
}