ILearningModelDeviceFactoryNative.CreateFromD3D12CommandQueue 方法
创建一个将在用户指定的 ID3D12CommandQueue 上运行推理的 LearningModelDevice。
HRESULT CreateFromD3D12CommandQueue(
ID3D12CommandQueue * value,
[out] IUnknown ** result);
参数
客户 | Type | 说明 |
---|---|---|
value | ID3D12CommandQueue* | 将对其运行 LearningModelDevice 的 ID3D12CommandQueue。 |
result | IUnknown** | 要创建的 LearningModelDevice。 |
返回
HRESULT 操作的结果。
示例
// 1. create the d3d device.
com_ptr<ID3D12Device> pD3D12Device = nullptr;
CHECK_HRESULT(D3D12CreateDevice(
nullptr,
D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_0,
__uuidof(ID3D12Device),
reinterpret_cast<void**>(&pD3D12Device)));
// 2. create the command queue.
com_ptr<ID3D12CommandQueue> dxQueue = nullptr;
D3D12_COMMAND_QUEUE_DESC commandQueueDesc = {};
commandQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
CHECK_HRESULT(pD3D12Device->CreateCommandQueue(
&commandQueueDesc,
__uuidof(ID3D12CommandQueue),
reinterpret_cast<void**>(&dxQueue)));
com_ptr<ILearningModelDeviceFactoryNative> devicefactory =
get_activation_factory<LearningModelDevice, ILearningModelDeviceFactoryNative>();
com_ptr<::IUnknown> spUnk;
CHECK_HRESULT(devicefactory->CreateFromD3D12CommandQueue(dxQueue.get(), spUnk.put()));
另请参阅
要求
要求 | |
---|---|
最低受支持的客户端 | Windows 10,内部版本 17763 |
支持的最低服务器版本 | 具有桌面体验的 Windows Server 2019 |
页眉 | windows.ai.machinelearning.native.h |
注意
使用以下资源可获取有关 Windows ML 的帮助:
- 若要提出或回答有关 Windows ML 的技术问题,请在 Stack Overflow 上使用 windows-machine-learning 标记。
- 若要报告 bug,请在 GitHub 上提交问题。