diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ReadbackHeap.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ReadbackHeap.cpp index a02f0e49c7..d3765acc34 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ReadbackHeap.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ReadbackHeap.cpp @@ -104,7 +104,13 @@ namespace Dml gsl::span src, D3D12_RESOURCE_STATES srcState) { - assert(!dst.empty()); + assert(dst.size() == src.size()); + assert(dstSizes.size() == src.size()); + + if (dst.empty()) + { + return; + } uint32_t totalSize = 0; for (auto size : dstSizes)