ITensorNative.GetBuffer 方法
取得張量緩衝區做為位元組陣列。
HRESULT GetBuffer(
[out, size_is(, *capacity)] BYTE **value,
[out] UINT32 *capacity);
參數
姓名 | 類型 | 描述 |
---|---|---|
value | BYTE** | 張量緩衝區。 |
處理能力 | UINT32* | 緩衝區的容量。 |
傳回
HRESULT 作業的結果。
範例
TensorFloat SoftwareBitmapToSoftwareTensor(SoftwareBitmap softwareBitmap)
{
// 1. Get access to the buffer of softwareBitmap
BYTE* pData = nullptr;
UINT32 size = 0;
BitmapBuffer spBitmapBuffer(softwareBitmap.LockBuffer(BitmapBufferAccessMode::Read));
winrt::Windows::Foundation::IMemoryBufferReference reference = spBitmapBuffer.CreateReference();
auto spByteAccess = reference.as<::Windows::Foundation::IMemoryBufferByteAccess>();
CHECK_HRESULT(spByteAccess->GetBuffer(&pData, &size));
// ...
}
另請參閱
需求
需求 | |
---|---|
最低支援的用戶端 | Windows 10 組建 17763 |
最低支援的伺服器 | 具有桌面體驗的 Windows Server 2019 |
頁首 | windows.ai.machinelearning.native.h |
注意
使用下列資源取得 Windows ML 的說明:
- 如需詢問或回答有關 Windows ML 的技術問題,請使用 Stack Overflow 上的 windows-machine-learning 標籤。
- 如需回報錯誤 (bug),請在 GitHub 上提出問題。