From 7c0b05eca0a4364bce7bca41c2accdfe5cabf750 Mon Sep 17 00:00:00 2001 From: Jeff Bloomfield Date: Wed, 22 Apr 2020 23:59:09 +0000 Subject: [PATCH] Merged PR 4593169: Handle empty tensors in DML EP batched tensor copy This fixes the test_slice_start_out_of_bounds ONNX test Related work items: #24837735 --- .../dml/DmlExecutionProvider/src/ExecutionProvider.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ExecutionProvider.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ExecutionProvider.cpp index 1034b04987..7f1617855b 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ExecutionProvider.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ExecutionProvider.cpp @@ -571,6 +571,14 @@ namespace Dml provider, true); + const size_t dataSizeInBytes = ComputeByteSizeFromTensor(dstWrapper); + THROW_HR_IF(E_INVALIDARG, dataSizeInBytes != ComputeByteSizeFromTensor(srcWrapper)); // Tensors must be the same size + + if (dataSizeInBytes == 0) + { + return onnxruntime::common::Status::OK(); + } + dataSizesInBytes.push_back(static_cast(ComputeByteSizeFromTensor(dstWrapper))); THROW_HR_IF(E_INVALIDARG, dataSizesInBytes[i] != ComputeByteSizeFromTensor(srcWrapper)); // Tensors must be the same size