Tensor.CreateFromMemory Method

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3
Creates a tensor from a given memory segment, array, or span with a specified shape and layout.

Overload List

CreateFromMemory<T>(Memory<T>, TensorShape, TensorElementOrder, Boolean) Constructs a new dense tensor of the specifed dimensions, wrapping existing backing memory for the contents.
CreateFromMemory<T>(Memory<T>, TensorShape, TensorLayout, Boolean) Constructs a new dense tensor of the specifed dimensions, wrapping existing backing memory for the contents.

CreateFromMemory<T>(Memory<T>, TensorShape, TensorElementOrder, Boolean)

Constructs a new dense tensor of the specifed dimensions, wrapping existing backing memory for the contents.
C#
public static Tensor<T> CreateFromMemory<T>(
	Memory<T> values,
	TensorShape shape,
	TensorElementOrder order = TensorElementOrder.CStyle,
	bool createView = false
)

Parameters

values  Memory<T>
A 1D array containing the elements of the tensor.
shape  TensorShape
The dimensions of the new tensor.
order  TensorElementOrder  (Optional)
Optional. Specifies the order in which elements are stored. The default is CStyle.
createView  Boolean  (Optional)
Optional. Specifies whether values should be used to store the tensor's elements. The default is false.

Type Parameters

T

Return Value

Tensor<T>

CreateFromMemory<T>(Memory<T>, TensorShape, TensorLayout, Boolean)

Constructs a new dense tensor of the specifed dimensions, wrapping existing backing memory for the contents.
C#
public static Tensor<T> CreateFromMemory<T>(
	Memory<T> values,
	TensorShape shape,
	TensorLayout layout,
	bool createView = false
)

Parameters

values  Memory<T>
A 1D array containing the elements of the tensor.
shape  TensorShape
The dimensions of the new tensor.
layout  TensorLayout
The layout of the tensor elements.
createView  Boolean  (Optional)
Optional. Specifies whether values should be used to store the tensor's elements. The default is false.

Type Parameters

T

Return Value

Tensor<T>

See Also