Tensor<T> class Null safety

Superclass for tensors where elements may be integers, real numbers, or complex numbers.


32-bit floating points





elements List<T>
Returns elements as a list.
hashCode int
The hash code for this object. [...]
read-only, override
isScalar bool
Tells whether the tensor is a scalar.
isZero bool
Tells whether all elements are zero.
length int
Returns number of elements in the tensor.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
tensorShape TensorShape
Returns shape of the tensor.


ceil() Tensor<T>
Calculates x.ceil() for each element.
clamp(T lowerLimit, T upperLimit) Tensor<T>
Calculates x.clamp(lowerLimit, upperLimit) for each element.
cos() Tensor<T>
Calculates cos(x) for each element.
div(Tensor<T> right, {bool noNan = false}) Tensor<T>
Calculates element-wise fraction. [...]
divScalar(num right, {bool noNan = false, bool swapArguments = false}) Tensor<T>
Calculates element-wise fraction. [...]
exp() Tensor<T>
Calculates exp(x) for each element. [...]
floor() Tensor<T>
Calculates x.floor() for each element.
getFlat(int index) → T
@Deprecated('Use `elements`')
log() Tensor<T>
Calculates log(x) for each element. [...]
max(Tensor<T> right) Tensor<T>
Calculates element-wise maximum. [...]
min(Tensor<T> right) Tensor<T>
Calculates element-wise minimum. [...]
mulScalar(num s) Tensor
Multiplies tensor elements with a scalar. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
pow(Tensor<T> right) Tensor<T>
Calculates element-wise power. [...]
scale(num s) Tensor
@Deprecated('Use `mulScalar`')
scaleInverse(num s) Tensor
@Deprecated('Use `divScalar`')
sin() Tensor<T>
Calculates sin(x) for each element.
sq() Tensor<T>
Calculates x * x (square) for each element. [...]
sqrt() Tensor<T>
Calculates sqrt(x) (square root) for each element. [...]
tan() Tensor<T>
Calculates tan(x) for each element.
toBuilder({bool copy = true}) TensorBuilder<T>
Constructs a TensorBuilder that has this tensor. [...]
toScalar() → T
Returns a scalar when the tensor has only a single element; [...]
toString() String
A string representation of this object. [...]


operator *(Tensor<T> right) Tensor<T>
Calculates element-wise product. [...]
operator +(Tensor<T> right) Tensor<T>
Calculates element-wise sum. [...]
operator -(Tensor<T> right) Tensor<T>
Calculates element-wise difference. [...]
operator /(Tensor<T> right) Tensor<T>
A shorthand for div.
operator ==(Object other) bool
The equality operator. [...]
operator unary-() Tensor<T>
Calculates scale(-1.0). [...]

Static Methods

filled(TensorShape shape, [double value = 0.0]) Tensor<double>
generate(TensorShape shape, double generator(TensorShape shape, int i)) Tensor<double>
scalar(double value) Vector<double>