Tensor.Create Method

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.1
Creates a tensor with a specified shape and order.

Overload List

Create<T>(Int32[]) Constructs a new 3D tensor with the specified dimensions.
Create<T>(TensorShape, TensorElementOrder) Constructs a new tensor with the specified shape.

Create<T>(Int32[])

Constructs a new 3D tensor with the specified dimensions.
C#
public static Tensor<T> Create<T>(
	params int[] dimensions
)

Parameters

dimensions  Int32[]
An array containing the dimensions of the tensor.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
A new dense tensor with elements stored in C-style order.

Exceptions

ArgumentNullException

dimensions is null.

ArgumentOutOfRangeException

One of the elements of dimensions is less than zero.

Create<T>(TensorShape, TensorElementOrder)

Constructs a new tensor with the specified shape.
C#
public static Tensor<T> Create<T>(
	TensorShape shape,
	TensorElementOrder order = TensorElementOrder.CStyle
)

Parameters

shape  TensorShape
The TensorShape of the new tensor.
order  TensorElementOrder  (Optional)
Optional. The order in which elements are stored. The default is C-style.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
A new dense tensor.

See Also