[CPU] Fixed PostOpsIntBlobMemory filling (#1133)
This commit is contained in:
parent
7cda3bb275
commit
9b32414747
@ -197,6 +197,7 @@ void MKLDNNBinaryConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
|
||||
PostOpsIntBlobMemory[blob_idx]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_weights->buffer(),
|
||||
@ -214,6 +215,7 @@ void MKLDNNBinaryConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(depthwiseDims, memory::data_type::f32,
|
||||
memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_biases->buffer(),
|
||||
depthwiseLayer->_biases->size() *
|
||||
@ -256,6 +258,7 @@ void MKLDNNBinaryConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(binarizationDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
|
||||
PostOpsIntBlobMemory[blob_idx]->SetData(memory::data_type::f32, memory::x,
|
||||
quantizeNode->getBinarizationTresholdsPtr(),
|
||||
@ -264,6 +267,7 @@ void MKLDNNBinaryConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx+1]->Create(binarizationDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx+1]->FillZero();
|
||||
|
||||
PostOpsIntBlobMemory[blob_idx+1]->SetData(memory::data_type::f32, memory::x,
|
||||
quantizeNode->getBinarizationOutputMaskPtr(),
|
||||
@ -295,6 +299,7 @@ void MKLDNNBinaryConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool
|
||||
MKLDNNDims dwWeightsDims(
|
||||
{dw_conv_oc, (ptrdiff_t) 1, (ptrdiff_t) 1, dw_conv_kernel[Y_AXIS], dw_conv_kernel[X_AXIS]});
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(dwWeightsDims, memory::data_type::f32, w_fmt);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
|
||||
PostOpsIntBlobMemory[blob_idx]->SetData(memory::data_type::f32, memory::goihw,
|
||||
convLayer->_weights->buffer(),
|
||||
@ -306,6 +311,7 @@ void MKLDNNBinaryConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool
|
||||
MKLDNNDims dwBiasesDims({dw_conv_oc});
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(dwBiasesDims, memory::data_type::f32,
|
||||
memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->SetData(memory::data_type::f32, memory::x,
|
||||
convLayer->_biases->buffer(),
|
||||
dwBiasesDims.size() *
|
||||
|
@ -400,7 +400,7 @@ void MKLDNNConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool initWe
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_weights->buffer(),
|
||||
depthwiseLayer->_weights->size() *
|
||||
@ -417,6 +417,7 @@ void MKLDNNConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool initWe
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(depthwiseDims, memory::data_type::f32,
|
||||
memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_biases->buffer(),
|
||||
depthwiseLayer->_biases->size() *
|
||||
@ -469,6 +470,7 @@ void MKLDNNConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool initWe
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
MKLDNNDims dwWeightsDims({dw_conv_oc, (ptrdiff_t)1, (ptrdiff_t)1, dw_conv_kernel[Y_AXIS], dw_conv_kernel[X_AXIS]});
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(dwWeightsDims, weightsPrc, memory::format::Goihw8g);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
|
||||
Blob::Ptr weights = convLayer->blobs.find("weights")->second;
|
||||
Blob::Ptr biases = convLayer->blobs.find("biases")->second;
|
||||
@ -479,6 +481,7 @@ void MKLDNNConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool initWe
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
MKLDNNDims dwBiasesDims({dw_conv_oc});
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(dwBiasesDims, biasPrc, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->SetData(biasPrc, memory::x, biases->buffer(),
|
||||
dwBiasesDims.size() * MKLDNNExtensionUtils::sizeOfDataType(biasPrc));
|
||||
ops.append_dw_conv(dw_conv_ih, dw_conv_iw, dw_conv_kernel[Y_AXIS], dw_conv_kernel[X_AXIS],
|
||||
@ -529,11 +532,13 @@ void MKLDNNConvolutionNode::setPostOps(mkldnn::primitive_attr &attr, bool initWe
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(oScaleDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx]->SetData(memory::data_type::f32, memory::x, &oScaleDataVector[0],
|
||||
oScaleDataVector.size() * MKLDNNExtensionUtils::sizeOfDataType(memory::data_type::f32));
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(oScaleDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->SetData(memory::data_type::f32, memory::x, &oShiftDataVector[0],
|
||||
oShiftDataVector.size() * MKLDNNExtensionUtils::sizeOfDataType(memory::data_type::f32));
|
||||
|
||||
|
@ -131,6 +131,7 @@ void MKLDNNDeconvolutionNode::setBiasAsPostOp(const InferenceEngine::Blob::Ptr&
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[0]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[0]->FillZero();
|
||||
std::vector<float> weights(biases->size());
|
||||
for (int i = 0; i < biases->size(); i++) {
|
||||
weights[i] = 1;
|
||||
@ -140,6 +141,7 @@ void MKLDNNDeconvolutionNode::setBiasAsPostOp(const InferenceEngine::Blob::Ptr&
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[1]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[1]->FillZero();
|
||||
PostOpsIntBlobMemory[1]->SetData(memory::data_type::f32, memory::x, biases->buffer(),
|
||||
biases->size() * MKLDNNExtensionUtils::sizeOfDataType(memory::data_type::f32));
|
||||
|
||||
|
@ -208,6 +208,7 @@ void MKLDNNFullyConnectedNode::setPostOps(mkldnn::primitive_attr &attr, bool ini
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
|
||||
// In case ndims == 3 graph optimizer allows fusing only if all weights values are the same
|
||||
if (depthwiseNode->isBroadcast() || ndims == 3) {
|
||||
@ -225,6 +226,7 @@ void MKLDNNFullyConnectedNode::setPostOps(mkldnn::primitive_attr &attr, bool ini
|
||||
if (depthwiseNode->getAlgorithm() == depthwise_scale_shift) {
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
|
||||
// In case ndims == 3 graph optimizer allows fusing only if all biases values are the same
|
||||
if (depthwiseNode->isBroadcast() || ndims == 3) {
|
||||
|
@ -605,6 +605,7 @@ void MKLDNNMVNNode::setPostOps(mkldnn::primitive_attr &attr, bool initWeights) {
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
|
||||
PostOpsIntBlobMemory[blob_idx]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_weights->buffer(),
|
||||
@ -622,6 +623,7 @@ void MKLDNNMVNNode::setPostOps(mkldnn::primitive_attr &attr, bool initWeights) {
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(depthwiseDims, memory::data_type::f32,
|
||||
memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_biases->buffer(),
|
||||
depthwiseLayer->_biases->size() *
|
||||
|
@ -807,6 +807,7 @@ void MKLDNNNormalizeNode::setPostOps(mkldnn::primitive_attr &attr, bool initWeig
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
|
||||
PostOpsIntBlobMemory[blob_idx]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_weights->buffer(),
|
||||
@ -824,6 +825,7 @@ void MKLDNNNormalizeNode::setPostOps(mkldnn::primitive_attr &attr, bool initWeig
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(depthwiseDims, memory::data_type::f32,
|
||||
memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_biases->buffer(),
|
||||
depthwiseLayer->_biases->size() *
|
||||
|
@ -446,6 +446,7 @@ void MKLDNNResampleNode::setPostOps(mkldnn::primitive_attr &attr, bool initWeigh
|
||||
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx]->Create(depthwiseDims, memory::data_type::f32, memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx]->FillZero();
|
||||
|
||||
PostOpsIntBlobMemory[blob_idx]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_weights->buffer(),
|
||||
@ -463,6 +464,7 @@ void MKLDNNResampleNode::setPostOps(mkldnn::primitive_attr &attr, bool initWeigh
|
||||
PostOpsIntBlobMemory.push_back(MKLDNNMemoryPtr(new MKLDNNMemory(getEngine())));
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->Create(depthwiseDims, memory::data_type::f32,
|
||||
memory::format::x);
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->FillZero();
|
||||
PostOpsIntBlobMemory[blob_idx + 1]->SetData(memory::data_type::f32, memory::x,
|
||||
depthwiseLayer->_biases->buffer(),
|
||||
depthwiseLayer->_biases->size() *
|
||||
|
Loading…
Reference in New Issue
Block a user