fp32 outputs fixup to properly handle negative values (#2529)

This commit is contained in:
Maxim Shevtsov 2020-10-05 13:51:41 +03:00 committed by GitHub
parent c8b783f644
commit 834755680d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -781,8 +781,13 @@ void MKLDNNGraph::PullOutputData(BlobMap &out) {
size_t size_to_copy = intr_blob.GetSize() * MB_to_process / MB;
ie_memcpy(ext_blob_ptr, ext_blob->byteSize(), intr_blob_ptr, size_to_copy);
if (config.dynamicSequence && ext_blob->byteSize() > size_to_copy)
memset((unsigned char*)ext_blob_ptr + size_to_copy, 0, ext_blob->byteSize() - size_to_copy);
if (config.dynamicSequence && ext_blob->size() > intr_blob.GetElementsCount()) {
if (ext_blob->getTensorDesc().getPrecision() != InferenceEngine::Precision::FP32)
THROW_IE_EXCEPTION << "Dynamic sequence is supported only for the fp32 outputs only!";
auto elements = intr_blob.GetElementsCount();
std::fill(static_cast<float*>(ext_blob_ptr) + elements,
static_cast<float*>(ext_blob_ptr) + ext_blob->size(), -std::numeric_limits<float>::max());
}
}
}