Condividi tramite


Metodo ITensorStaticsNative.CreateFromD3D12Resource

Crea un oggetto tensor (TensorFloat, TensorInt32Bit) da un ID3D12Resource specificato dall'utente.

HRESULT CreateFromD3D12Resource(
    ID3D12Resource *value,
    [size_is(shapeCount)] __int64 *shape,
    int shapeCount,
    [out] IUnknown ** result);

Parametri

Nome TIPO Descrizione
valore ID3D12Risorsa* ID3D12Resource da cui creare il tensore.
forma __int64* Forma del tensore.
shapeCount Int Numero di dimensioni del tensore.
risultato IUnknown** Tensore risultante.

Restituzioni

HRESULT Risultato dell'operazione.

Esempi

TensorFloat SoftwareBitmapToDX12Tensor(SoftwareBitmap softwareBitmap)
{
    // ...

    // GPU tensorize
    com_ptr<ITensorStaticsNative> tensorfactory = get_activation_factory<TensorFloat, ITensorStaticsNative>();
    com_ptr<::IUnknown> spUnkTensor;
    TensorFloat input1imagetensor(nullptr);
    int64_t shapes[4] = { 1,3, softwareBitmap.PixelWidth(), softwareBitmap.PixelHeight() };
    CHECK_HRESULT(tensorfactory->CreateFromD3D12Resource(pGPUResource.get(), shapes, 4, spUnkTensor.put()));
    spUnkTensor.try_as(input1imagetensor);

    // ...
}

Vedere anche

Requisiti

Requisito
Client minimo supportato Windows 10, build 17763
Server minimo supportato Windows Server 2019 con Desktop Experience
Intestazione windows.ai.machinelearning.native.h

Annotazioni

Per informazioni su Windows Machine Learning, usa le risorse seguenti:

  • Per porre o rispondere a domande tecniche su Windows ML, usare il tag windows-machine-learning in Stack Overflow.
  • Per segnalare un bug, segnalare un problema in GitHub.