Tensor<T>.As Method

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.0

Overload List

As<U>() Casts the tensor as a tensor of the specified type.
As<U, TTransform>() Casts the tensor as a tensor of the specified type.

As<U>

Casts the tensor as a tensor of the specified type.
C#
public Tensor<U> As<U>()

Type Parameters

U
The type to cast the elements to.

Return Value

Tensor<U>
A tensor with the elements converted from the element type T to the type U.

Exceptions

InvalidCastException

Conversion from elements of type T to type U is not supported.

As<U, TTransform>

Casts the tensor as a tensor of the specified type.
C#
public Tensor<U> As<U, TTransform>()
where TTransform : struct, new(), IFastFunc<T, U>

Type Parameters

U
The element type to convert to.
TTransform
The type of the converter from T to U.

Return Value

Tensor<U>
A tensor with the elements converted from the element type T to the type U using a converter of type TTransform.

See Also