Tensor<T>.generate constructor
Tensor<T>.generate (})
Constructs a Tensor filled with the results of callback
.
Implementation
factory Tensor.generate(T Function(List<int> key) callback,
{required List<int> shape, List<int>? strides, DataType<T>? type}) =>
Tensor.fromIterable(Layout(shape: shape).keys.map(callback),
shape: shape, strides: strides, type: type ?? DataType.fromType<T>());