DML_ELEMENT_WISE_CLIP_GRAD1_OPERATOR_DESC structure (directml.h)

Computes backpropagation gradients for DML_OPERATOR_ELEMENT_WISE_CLIP1.

f(x, gradient) = if x <= Min then 0
                 if x >= Max then 0
                 else        then gradient

This operator supports in-place execution, meaning that OutputTensor is permitted to alias InputTensor during binding.

Syntax

struct DML_ELEMENT_WISE_CLIP_GRAD1_OPERATOR_DESC {
  const DML_TENSOR_DESC *InputTensor;
  const DML_TENSOR_DESC *InputGradientTensor;
  const DML_TENSOR_DESC *OutputGradientTensor;
  DML_TENSOR_DATA_TYPE  MinMaxDataType;
  DML_SCALAR_UNION      Min;
  DML_SCALAR_UNION      Max;
};

Members

InputTensor

Type: const DML_TENSOR_DESC*

The input feature tensor. This is typically the same tensor that was provided as the InputTensor to DML_OPERATOR_ELEMENT_WISE_CLIP1 in the forward pass.

InputGradientTensor

Type: const DML_TENSOR_DESC*

The incoming gradient tensor. This is typically obtained from the output of backpropagation of a preceding layer. Typically this tensor would have the same sizes as the output of the corresponding DML_OPERATOR_ELEMENT_WISE_CLIP1 in the forward pass.

OutputGradientTensor

Type: const DML_TENSOR_DESC*

An output tensor containing the backpropagated gradients. Typically this tensor would have the same sizes as the input of the corresponding DML_OPERATOR_ELEMENT_WISE_CLIP1 in the forward pass.

MinMaxDataType

Type: DML_TENSOR_DATA_TYPE

The data type of the Min and Max members, which must match OutputTensor.DataType.

Min

Type: DML_SCALAR_UNION

The minimum value. If x is at or below this value, then the gradient result is 0. MinMaxDataType determines how to interpret the field.

Max

Type: DML_SCALAR_UNION

The maximum value. If x is at or above this value, then the gradient result is 0. MinMaxDataType determines how to interpret the field.

Remarks

Availability

This operator was introduced in DML_FEATURE_LEVEL_5_0.

Tensor constraints

InputGradientTensor, InputTensor, and OutputGradientTensor must have the same DataType, DimensionCount, and Sizes.

Tensor support

Tensor Kind Supported dimension counts Supported data types
InputTensor Input 1 to 8 FLOAT32, FLOAT16, INT64, INT32, INT16, INT8, UINT64, UINT32, UINT16, UINT8
InputGradientTensor Input 1 to 8 FLOAT32, FLOAT16, INT64, INT32, INT16, INT8, UINT64, UINT32, UINT16, UINT8
OutputGradientTensor Output 1 to 8 FLOAT32, FLOAT16, INT64, INT32, INT16, INT8, UINT64, UINT32, UINT16, UINT8

Requirements

Requirement Value
Header directml.h