TensorFloat 類別

定義

32 位浮點數 tensor 物件。

public ref class TensorFloat sealed : ITensor
public ref class TensorFloat sealed : ITensor, IClosable, IMemoryBuffer
/// [Windows.Foundation.Metadata.ContractVersion(Windows.AI.MachineLearning.MachineLearningContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class TensorFloat final : ITensor
/// [Windows.Foundation.Metadata.ContractVersion(Windows.AI.MachineLearning.MachineLearningContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class TensorFloat final : ITensor, IClosable, IMemoryBuffer
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.AI.MachineLearning.MachineLearningContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class TensorFloat : ITensor
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.AI.MachineLearning.MachineLearningContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class TensorFloat : System.IDisposable, ITensor, IMemoryBuffer
Public NotInheritable Class TensorFloat
Implements ITensor
Public NotInheritable Class TensorFloat
Implements IDisposable, IMemoryBuffer, ITensor
繼承
Object Platform::Object IInspectable TensorFloat
屬性
實作

Windows 需求

裝置系列
Windows 10, version 1809 (已於 10.0.17763.0 引進)
API contract
Windows.AI.MachineLearning.MachineLearningContract (已於 v1.0 引進)

範例

如需程式碼範例,請參閱 ImageFeatureValue。 該主題中的程式碼範例會建立會話和系結、系結輸入映射,然後將輸出系結至建立的 TensorFloat

備註

tensor 是值的多維度陣列。 浮點數是 32 位浮點值的張量。

張量的配置是資料列主要,且緊密封裝的連續資料代表每個維度。 張量的大小總計是每個維度大小的乘積。

Windows Server

若要在 Windows Server 上使用此 API,您必須搭配桌面體驗使用 Windows Server 2019。

執行緒安全

此 API 是安全線程。

版本歷程記錄

Windows 版本 SDK 版本 已新增值
1903 18362 CreateFromBuffer
1903 18362 CreateFromShapeArrayAndDataArray

屬性

Kind

傳回與功能相關聯的 Kind。

Shape

傳回每個維度的計數和大小。

TensorKind

傳回 tensor 的資料類型。

方法

Close()

如果沒有從這個物件建立的未處理 IMemoryBufferReference 物件, Close 將會處置物件並終結其相關聯的資源。 否則, Close 會將其本身與其相關聯的資源中斷連結,而且會在最後一個 IMemoryBufferReference 關閉時終結它們。

Create()

建立 32 位浮點數 tensor 物件,而不配置緩衝區。

Create(IIterable<Int64>)

建立 32 位浮點數張量物件,並配置大小 圖形的緩衝區。

CreateFromArray(IIterable<Int64>, Single[])

建立 32 位浮點數量物件、配置大小圖形的緩衝區,並將所有資料複製到其中。

CreateFromBuffer(Int64[], IBuffer)

建立具有指定 圖形 的浮點數 tensor 物件,並使用 資料 中的基礎緩衝區進行後續評估。

CreateFromIterable(IIterable<Int64>, IIterable<Single>)

建立 32 位浮點數量物件、配置大小圖形的緩衝區,並將所有資料複製到其中。

CreateFromShapeArrayAndDataArray(Int64[], Single[])

建立 32 位浮點數量物件、配置大小圖形的緩衝區,並將所有資料複製到其中。

CreateReference()

傳回 32 位浮點數物件之緩衝區的 IMemoryBufferReference 表示。

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

GetAsVectorView()

傳回資料的唯讀檢視。

適用於

另請參閱