DML_ELEMENT_WISE_ROUND_OPERATOR_DESC structure (directml.h)

Rounds each element of InputTensor to an integer value, placing the result into the corresponding element of OutputTensor.

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

Syntax

struct DML_ELEMENT_WISE_ROUND_OPERATOR_DESC {
  const DML_TENSOR_DESC *InputTensor;
  const DML_TENSOR_DESC *OutputTensor;
  DML_ROUNDING_MODE     RoundingMode;
};

Members

InputTensor

Type: const DML_TENSOR_DESC*

The input tensor to read from.

OutputTensor

Type: const DML_TENSOR_DESC*

The output tensor to write the results to.

RoundingMode

Type: DML_ROUNDING_MODE

A DML_ROUNDING_MODE determining the direction to round towards.

  • If DML_ROUNDING_MODE_HALVES_TO_NEAREST_EVEN: values are rounded to the nearest integer, with halfway values (for example, 0.5) being rounded toward the nearest even integer.
  • If DML_ROUNDING_MODE_TOWARD_ZERO: values are rounded toward zero. This effectively truncates the fractional part.
  • If DML_ROUNDING_MODE_TOWARD_INFINITY: values are rounded to the nearest integer, with halfway values (for example, 0.5) being rounded away from zero (toward positive or negative infinity, depending on the sign of the value).

Availability

This operator was introduced in DML_FEATURE_LEVEL_2_1.

Tensor constraints

InputTensor and OutputTensor must have the same DataType, DimensionCount, and Sizes.

Tensor support

DML_FEATURE_LEVEL_3_0 and above

Tensor Kind Supported dimension counts Supported data types
InputTensor Input 1 to 8 FLOAT32, FLOAT16
OutputTensor Output 1 to 8 FLOAT32, FLOAT16

DML_FEATURE_LEVEL_2_1 and above

Tensor Kind Supported dimension counts Supported data types
InputTensor Input 4 FLOAT32, FLOAT16
OutputTensor Output 4 FLOAT32, FLOAT16

Requirements

   
Header directml.h