Compartilhar via


Método ITensorNative.GetBuffer

Obtém o buffer do tensor como uma matriz de bytes.

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

Parâmetros

Nome Tipo Descrição
valor BYTE** O buffer do tensor.
capacidade UINT32* A capacidade do buffer.

Devoluções

HRESULT O resultado da operação.

Exemplos

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

    // ...
}

Consulte também

Requisitos

Requisito
Cliente com suporte mínimo Windows 10, compilação 17763
servidor com suporte mínimo Windows Server 2019 com Desktop Experience
cabeçalho windows.ai.machinelearning.native.h

Observação

Use os seguintes recursos para obter ajuda com o Windows ML:

  • Para fazer perguntas ou responder a perguntas técnicas sobre o Windows ML, use a marca windows-machine-learning no Stack Overflow.
  • Para relatar um bug, registre um problema em nosso GitHub.