Skip to content

Latest commit

 

History

History
111 lines (84 loc) · 4.41 KB

ns-directml-dml_resample_operator_desc.md

File metadata and controls

111 lines (84 loc) · 4.41 KB
UID title description tech.root ms.date req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist dev_langs topic_type api_type api_location api_name f1_keywords
NS:directml.DML_RESAMPLE_OPERATOR_DESC
DML_RESAMPLE_OPERATOR_DESC
Resamples elements from the source to the destination tensor, using the scale factors to compute the destination tensor size. You can use a linear or nearest-neighbor interpolation mode. (DML_RESAMPLE_OPERATOR_DESC)
directml
01/08/2024
directml.h
Windows
Windows 10, version 2004 (10.0; Build 19041)
Windows Server, version 2004 (10.0; Build 19041)
Windows
c++
APIRef
kbSyntax
HeaderDef
DirectML.h
DML_RESAMPLE_OPERATOR_DESC
DML_RESAMPLE_OPERATOR_DESC
directml/DML_RESAMPLE_OPERATOR_DESC

-description

Resamples elements from the source to the destination tensor, using the scale factors to compute the destination tensor size. You can use a linear or nearest-neighbor interpolation mode. The operator supports interpolation across multiple dimensions, not just 2D. So you can keep the same spatial size, but interpolate across channels or across batches.

-struct-fields

-field InputTensor

Type: const DML_TENSOR_DESC*

The tensor containing the input data.

-field OutputTensor

Type: const DML_TENSOR_DESC*

The tensor to write the output data to.

-field InterpolationMode

Type: DML_INTERPOLATION_MODE

This field determines the kind of interpolation used to choose output pixels.

  • DML_INTERPOLATION_MODE_NEAREST_NEIGHBOR. Uses the Nearest Neighbor algorithm, which chooses the input element nearest to the corresponding pixel center for each output element.

  • DML_INTERPOLATION_MODE_LINEAR. Uses the Linear Interpolation algorithm, which computes the output element by computing the weighted average of the 2 nearest neighboring input elements per dimension. Resampling is supported up to 4 dimensions (quadrilinear), where the weighted average is computed on a total of 16 input elements for each output element.

-field ScaleCount

Type: UINT

The number of values in the array Scales points to. This value must match the dimension count of InputTensor and OutputTensor.

-field Scales

Type: _Field_size_(ScaleCount) const FLOAT*

The scales to apply when resampling the input, where scales > 1 scale up the image and scales < 1 scale down the image for that dimension. Note that the scales don't need to be exactly OutputSize / InputSize. If the input after scaling is larger than the output bound, then we crop it to the output size. On the other hand, if the input after scaling is smaller than the output bound, the output edges are clamped.

-remarks

A newer version of this operator, DML_RESAMPLE1_OPERATOR_DESC, was introduced in DML_FEATURE_LEVEL_2_1.

Availability

This operator was introduced in DML_FEATURE_LEVEL_2_0.

Tensor constraints

InputTensor and OutputTensor must have the same DataType and DimensionCount.

Tensor support

DML_FEATURE_LEVEL_6_2 and above

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

DML_FEATURE_LEVEL_5_1 and above

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

DML_FEATURE_LEVEL_2_0 and above

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

-see-also