From 55fb790d88654f533dd670cc6475f557b7874d9e Mon Sep 17 00:00:00 2001 From: Dwayne Robinson Date: Tue, 15 Nov 2022 11:03:21 -0800 Subject: [PATCH] DML EP allow squeeze-13 axes to be empty (#13635) ### Description **Description**: [ONNX Squeeze-13](https://github.com/onnx/onnx/blob/main/docs/Operators.md#Squeeze) treats empty `axes` as if all axes had been given. This works for [earlier Squeeze versions](https://github.com/microsoft/onnxruntime/pull/12649), but Squeeze-13 checks for axes as a dynamic input tensor, which means it needs to checked for existence before accessing. ### Motivation and Context - *Why is this change required? What problem does it solve?* Fixes a customer model. Makes ORT DML EP consistent with spec. --- .../providers/dml/OperatorAuthorHelper/OperatorHelper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp b/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp index e7af262760..babd32a560 100644 --- a/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp +++ b/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp @@ -2052,7 +2052,10 @@ namespace OperatorHelper { if (opsetVersion >= 13) // Axes are a dynamic input parameter. { - ReadCpuLocalTensorIntoInt32(kernelInformation.GetConstantInputTensor(1), /*out*/ m_axes); + if (kernelInformation.IsInputValid(1)) + { + ReadCpuLocalTensorIntoInt32(kernelInformation.GetConstantInputTensor(1), /*out*/ m_axes); + } } else // Axes were a constant attribute parameter. {