Share via


TensorFloat.CreateFromBuffer(Int64[], IBuffer) Method

Definition

Important

For the latest documentation about Windows Machine Learning, see What is Windows ML. That documentation describes APIs that are in the Microsoft.Windows.AI.MachineLearning namespace, which ships in the Windows App SDK. Those APIs supersede the ones documented here, which are in the Windows.AI.MachineLearning namespace, and were shipped in 2018.

Creates a float tensor object with the given shape and uses the underlying buffer in data for subsequent evaluation.

public:
 static TensorFloat ^ CreateFromBuffer(Platform::Array <long long> ^ shape, IBuffer ^ buffer);
 static TensorFloat CreateFromBuffer(winrt::array_view <long> const& shape, IBuffer const& buffer);
public static TensorFloat CreateFromBuffer(long[] shape, IBuffer buffer);
function createFromBuffer(shape, buffer)
Public Shared Function CreateFromBuffer (shape As Long(), buffer As IBuffer) As TensorFloat

Parameters

shape

Int64[]

long long[]

long[]

The size of the buffer.

buffer
IBuffer

The buffer to use during evaluation.

Returns

A float tensor object backed by a buffer reference to the provided IBuffer data.

Windows requirements

Device family
Windows 10, version 1903 (introduced in 10.0.18362.0)
API contract
Windows.AI.MachineLearning.MachineLearningContract (introduced in v2.0)

Remarks

No copies are performed during the creation of this object and the underlying buffer in data is used directly by the engine.

Copies to video memory are made when running on non-CPU devices.

Applies to