Tensor<T> class
A multi-dimensional fixed-size container of items of a specific type.
- Available Extensions
- CollapseTensorExtension
- ComparisonTensorExtension
- ContiguousTensorExtension
- CopyTensorExtension
- ElementTensorExtension
- ExpandTensorExtension
- FlipTensorExtension
- LogicalTensorExtension
- MathTensorExtension
- OperationTensorExtension
- RangeTensorExtension
- ReshapeTensorExtension
- ToObjectTensorExtension
- TransposeTensorExtension
- Annotations
-
- @experimental
Constructors
-
Tensor.filled(T value, {List<
int> ? shape, List<int> ? strides, DataType<T> ? type}) -
Constructs a Tensor filled with
value
.factory -
Tensor.fromIterable(Iterable<
T> iterable, {List<int> ? shape, List<int> ? strides, DataType<T> ? type}) -
Constructs an Tensor from an
iterable
.factory -
Tensor.fromObject(dynamic object, {DataType<
T> ? type}) -
Constructs an Tensor from a nested
object
.factory -
Tensor.generate(T callback(List<
int> key), {required List<int> shape, List<int> ? strides, DataType<T> ? type}) -
Constructs a Tensor filled with the results of
callback
.factory -
Tensor.internal({required DataType<
T> type, required Layout layout, required List<T> data}) - Internal constructors of Tensor object.
Properties
-
data
→ List<
T> -
The underlying data storage.
final
- defaultToStringPrinter → ObjectPrinter
-
Override to configure the empty
ObjectPrinter
.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- layout → Layout
-
The layout of the data in the underlying storage.
final
- length → int
-
The number of elements.
no setter
- rank → int
-
The number of dimensions.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- toStringPrinter → ObjectPrinter
-
Override and call super to add values to the
ObjectPrinter
.no setter -
type
→ DataType<
T> -
The type of this tensor.
final
-
values
→ Iterable<
T> -
An iterator over the values of the tensor.
no setter
Methods
-
getValue(
List< int> key) → T - Returns the value at the given key (index-list).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setValue(
List< int> key, T value) → void - Sets the value at the given key (index-list).
-
toString(
) → String -
Standard
toString
implementation. Do not override, instead implement toStringPrinter to customize.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → Tensor< T> -
Returns a view with the first axis resolved to
index
.