ITensorNative.GetBuffer 方法
获取张量缓冲区以作为字节数组。
HRESULT GetBuffer(
[out, size_is(, *capacity)] BYTE **value,
[out] UINT32 *capacity);
参数
客户 | Type | 说明 |
---|---|---|
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 上提交问题。