Condividi tramite


struttura DML_RESAMPLE_GRAD1_OPERATOR_DESC (directml.h)

Calcola le sfumature backpropagation per DML_RESAMPLE2_OPERATOR_DESC.

DML_RESAMPLE2_OPERATOR_DESC ridimensiona le dimensioni arbitrarie del tensore di input usando il campionamento più vicino o l'interpolazione bilineare. Dato un inputGradientTensor con le stesse dimensioni dell'output di un DML_RESAMPLE2_OPERATOR_DESC equivalente, questo operatore produce un OutputGradientTensor con le stesse dimensioni dell'input del DML_RESAMPLE2_OPERATOR_DESC.

Si consideri ad esempio un DML_RESAMPLE2_OPERATOR_DESC che esegue un ridimensionamento più vicino di 1,5x nella larghezza e 0,5x nell'altezza:

InputTensor           OutputTensor
[[1, 2],   Resample    [1, 1, 2]
 [3, 4]]      -->      

Si noti che l'elemento 0 del tensore di input (con valore 1) contribuisce a due elementi nell'output; l'elemento 1 (con valore 2) contribuisce a un elemento nell'output; e i 2 e i 3 ° elemento (con valori 3 e 4) non contribuiscono ad alcun elemento dell'output.

Il DML_RESAMPLE_GRAD1_OPERATOR_DESC corrispondente eseguirà le operazioni seguenti:

InputGradientTensor           OutputGradientTensor
    [4, 5, 6]      ResampleGrad    [[9, 6],
                       -->          [0, 0]]

Si noti che i valori in OutputGradientTensor rappresentano i contributi ponderati di tale elemento all'OutputTensor durante l'operatore DML_RESAMPLE2_OPERATOR_DESC originale.

Importante

Questa API è disponibile come parte del pacchetto ridistribuibile autonomo DirectML (vedere Microsoft.AI.DirectML versione 1.9 e successive. Vedere anche cronologia delle versioni di DirectML.

Sintassi

struct DML_RESAMPLE_GRAD1_OPERATOR_DESC
{
    const DML_TENSOR_DESC* InputGradientTensor;
    const DML_TENSOR_DESC* OutputGradientTensor;
    DML_INTERPOLATION_MODE InterpolationMode;
    DML_AXIS_DIRECTION RoundingDirection;
    UINT DimensionCount;
    _Field_size_(DimensionCount) const FLOAT* Scales;
    _Field_size_(DimensionCount) const FLOAT* InputPixelOffsets;
    _Field_size_(DimensionCount) const FLOAT* OutputPixelOffsets;
};

Membri

InputGradientTensor

Tipo: const DML_TENSOR_DESC*

Tensore sfumato in ingresso. Questo risultato viene in genere ottenuto dall'output di backpropagation di un livello precedente. In genere questo tensore avrà le stesse dimensioni dell'output del DML_RESAMPLE2_OPERATOR_DESC corrispondente nel passaggio in avanti.

OutputGradientTensor

Tipo: const DML_TENSOR_DESC*

Tensore di output contenente le sfumature backpropagate. In genere questo tensore avrà le stesse dimensioni dell'input del DML_RESAMPLE2_OPERATOR_DESC corrispondente nel passaggio in avanti.

InterpolationMode

Tipo: DML_INTERPOLATION_MODE

Vedere DML_RESAMPLE2_OPERATOR_DESC::InterpolationMode.

RoundingDirection

Tipo: DML_AXIS_DIRECTION

Vedere DML_RESAMPLE2_OPERATOR_DESC::RoundingDirection.

DimensionCount

Tipo: UINT

Numero di elementi nelle matrici Scales, InputPixelOffsets e OutputPixelOffsets . Questo valore deve essere uguale a DimensionCount specificato in InputGradientTensor e OutputGradientTensor.

Scales

Tipo: _Field_size_(DimensionCount) const FLOAT*

Vedere DML_RESAMPLE2_OPERATOR_DESC::Scales.

InputPixelOffsets

Tipo: _Field_size_(DimensionCount) const FLOAT*

Vedere DML_RESAMPLE2_OPERATOR_DESC::InputPixelOffsets.

OutputPixelOffsets

Tipo: _Field_size_(DimensionCount) const FLOAT*

Vedere DML_RESAMPLE2_OPERATOR_DESC::OutputPixelOffsets.

Osservazioni:

Questo operatore equivale a DML_RESAMPLE_GRAD_OPERATOR_DESC quando InterpolationMode è impostato su DML_INTERPOLATION_MODE_LINEAR; o quando InterpolationMode è impostato su DML_INTERPOLATION_MODE_NEAREST_NEIGHBOR e RoundingDirection su DML_AXIS_DIRECTION_DECREASING e OutputPixelOffsets vengono regolati un ulteriore -0,5.

Disponibilità

Questo operatore è stato introdotto in DML_FEATURE_LEVEL_5_1.

Vincoli tensor

InputGradientTensor e OutputGradientTensor devono avere lo stesso Tipo di dati e DimensionCount.

Supporto tensor

Tensore Tipo Conteggi delle dimensioni supportati Tipi di dati supportati
InputGradientTensor Inserimento Da 1 a 4 FLOAT32, FLOAT16
OutputGradientTensor Risultato Da 1 a 4 FLOAT32, FLOAT16

Requisiti

   
Intestazione directml.h