[CPU] fix crash in resnet binary model (#9761)
This commit is contained in:
parent
6dc8b8b047
commit
51ef938385
@ -254,7 +254,17 @@ void MKLDNNInputNode::cloneBlobIfRequired() {
|
||||
|
||||
auto cloneBlob = [&, this] () {
|
||||
MKLDNNMemory memory{ getEngine() };
|
||||
memory.Create(memDesc, constOp->get_data_ptr());
|
||||
|
||||
// CVS-74980
|
||||
// MKLDNN/oneDNN always allocate 1byte for element type with bitWidth < 8 (u4,u1...)
|
||||
// but ngraph Constant uses actual bitWidth for data storage allocation
|
||||
// in that case we make a copy to avoid overflow
|
||||
if (constOp->get_byte_size() >= memDesc.getCurrentMemSize()) {
|
||||
memory.Create(memDesc, constOp->get_data_ptr());
|
||||
} else {
|
||||
memory.Create(memDesc);
|
||||
memcpy(memory.GetPtr(), constOp->get_data_ptr(), constOp->get_byte_size());
|
||||
}
|
||||
|
||||
MKLDNNMemoryPtr ptr = MKLDNNMemoryPtr(new MKLDNNMemory(getEngine()));
|
||||
ptr->Create(memDesc);
|
||||
|
Loading…
Reference in New Issue
Block a user