From e36cc6e27f15fd6f2b61f6c3a07ae8bb059b44e8 Mon Sep 17 00:00:00 2001 From: Christian Larson Date: Fri, 17 Nov 2023 15:33:27 -0800 Subject: [PATCH] =?UTF-8?q?Update=20TryConvertTensorToBroadcastScalar=20to?= =?UTF-8?q?=20exit=20early=20if=20constExpTen=E2=80=A6=20(#18495)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update TryConvertTensorToBroadcastScalar to fail gracefully if not CPU tensor ### Description Added early exit for in TryConvertTensorToBroadcastScalar if there is no CpuData to prevent failure caused by constExpTensor->GetByteData() throwing. ### Motivation and Context DmlPrototype branch was failing in QLinearConv when there was no CpuData --------- Co-authored-by: Christian Larson <28911437+chrilaMSFT@users.noreply.github.com> --- .../dml/DmlExecutionProvider/src/Operators/DmlOperator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperator.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperator.cpp index 8343cd1b2a..05dcd49dc8 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperator.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperator.cpp @@ -862,7 +862,11 @@ namespace Dml { return; } - + else if (!IsCpuData()) + { + return; + } + uint32_t totalKernelInputElementCount = constExpTensor->GetTotalElementCount(); if (totalKernelInputElementCount <= 1) {