From 6e9bbb3be63462818e661686bf1c6259a1ce6ac6 Mon Sep 17 00:00:00 2001 From: Linnea May Date: Thu, 4 Jan 2024 14:08:18 -0800 Subject: [PATCH] feature version gate --- .../src/Operators/DmlOperatorResize.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorResize.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorResize.cpp index 2294a98a23485..261cbd3e5862b 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorResize.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorResize.cpp @@ -250,7 +250,9 @@ class DmlOperatorResize : public DmlOperator, public ResizeHelper std::string mode = kernelCreationContext.GetOptionalAttribute(AttrName::Mode, "NEAREST"); DML_INTERPOLATION_MODE interpolationMode = Dml::MapStringToInteropolationMode(mode); +#if DML_TARGET_VERSION >= 0x6300 const int antialiased = kernelCreationContext.GetOptionalAttribute(AttrName::Antialiased, 0); +#endif // Map ONNX to DML's mode using offsets and rounding direction. // These offsets are in addition to the coordinate transform offsets. @@ -291,7 +293,12 @@ class DmlOperatorResize : public DmlOperator, public ResizeHelper std::vector inputDescs = GetDmlInputDescs(); std::vector outputDescs = GetDmlOutputDescs(); +#if DML_TARGET_VERSION >= 0x6300 DML_RESAMPLE3_OPERATOR_DESC operatorDesc = {}; + operatorDesc.Antialiased = static_cast(antialiased); +#else + DML_RESAMPLE2_OPERATOR_DESC operatorDesc = {}; +#endif operatorDesc.InputTensor = inputDescs.data(); operatorDesc.OutputTensor = outputDescs.data(); operatorDesc.InterpolationMode = interpolationMode; @@ -300,9 +307,11 @@ class DmlOperatorResize : public DmlOperator, public ResizeHelper operatorDesc.DimensionCount = gsl::narrow_cast(paddedScales.size()); operatorDesc.InputPixelOffsets = inputPixelOffsets.data(); operatorDesc.OutputPixelOffsets = outputPixelOffsets.data(); - operatorDesc.Antialiased = static_cast(antialiased); - +#if DML_TARGET_VERSION >= 0x6300 DML_OPERATOR_DESC opDesc = { DML_OPERATOR_RESAMPLE3, &operatorDesc }; +#else + DML_OPERATOR_DESC opDesc = { DML_OPERATOR_RESAMPLE2, &operatorDesc }; +#endif SetDmlOperatorDesc(opDesc, kernelCreationContext); } };