Condividi tramite


Metodo ITensorNative.GetBuffer

Ottiene il buffer del tensore come matrice di byte.

HRESULT GetBuffer(
    [out, size_is(, *capacity)] BYTE **value,
    [out] UINT32 *capacity);

Parametri

Nome Digita Descrizione
value BYTE** Buffer del tensore.
capacità UINT32* Capacità del buffer.

Resi

HRESULT Il risultato dell'operazione.

Esempi

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));

    // ...
}

Vedi anche

Requisiti

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

Nota

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

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