Tensor<T> class
abstract
Superclass for tensors where elements may be integers, real numbers, or complex numbers.
Implementations
32-bit floating points
- Implementers
Constructors
- Tensor()
Properties
-
elements
→ List<
T> -
Returns elements as a list.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isScalar → bool
-
Tells whether the tensor is a scalar.
no setter
- isZero → bool
-
Tells whether all elements are zero.
no setter
- length → int
-
Returns number of elements in the tensor.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tensorShape → TensorShape
-
Returns shape of the tensor.
no setter
Methods
-
clamp(
T lowerLimit, T upperLimit) → Tensor< T> - Calculates square of each element.
-
getFlat(
int index) → T -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scale(
num s) → Tensor -
Multiplies every element by scalar
s
. -
scaleInverse(
num s) → Tensor -
Divides every element is divided by scalar
s
. This may be numerically more accurate than multiplying by1/s
. -
sq(
) → Tensor< T> - Calculates square of each element.
-
sqrt(
) → Tensor< T> - Calculates square root of 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.
inherited
Operators
-
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> - Calculates element-wise fraction.
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator unary-(
) → Tensor< T> -
Calculates
scale(-1.0)
.