Merged PR 4596882: Fix assert in ReadbackFromGpu

`ExecutionProviderImpl::CopyTensors` calls `ReadbackFromGpu`, and depending on the mix of source/destination tensors (CPU/CPU, CPU/GPU, GPU/CPU, GPU/GPU), there can be anywhere from 0 to multiple tensors to copy. Copying 0 tensors is not an assertable failure and should just be a nop (tests work fine in release build). This assert reproes locally when running Pad tests (and some other operator tests too).
This commit is contained in:
Dwayne Robinson 2020-04-24 01:12:50 +00:00
parent 7c0b05eca0
commit dd86e3be10

View file

@ -104,7 +104,13 @@ namespace Dml
gsl::span<ID3D12Resource*> 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)