Skip to content

Commit

Permalink
model validation bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chenhu-wang committed Feb 3, 2021
1 parent 6a7a844 commit a0312a3
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions inference-engine/src/mkldnn_plugin/nodes/mkldnn_mvn_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,6 @@ struct jit_uni_mvn_kernel_f32 : public jit_uni_mvn_kernel, public jit_generator
MKLDNNMVNNode::MKLDNNMVNNode(const InferenceEngine::CNNLayerPtr& layer, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache)
: MKLDNNNode(layer, eng, cache) {}

void (MKLDNNMVNNode::*mvn_executor)(const uint8_t *, uint8_t *, const InferenceEngine::SizeVector &) = nullptr;

void MKLDNNMVNNode::getSupportedDescriptors() {
if (!descs.empty())
return;
Expand Down Expand Up @@ -798,15 +796,6 @@ void MKLDNNMVNNode::createPrimitive() {

if (mvn_variance_kernel)
mvn_variance_kernel->create_ker();

if (mayiuse(cpu::x64::sse41)) {
if (jcp.planar_layout)
mvn_executor = &MKLDNNMVNNode::mvn_pln;
else
mvn_executor = &MKLDNNMVNNode::mvn_blk;
} else {
mvn_executor = &MKLDNNMVNNode::mvn_ref;
}
}

void MKLDNNMVNNode::setPostOps(mkldnn::primitive_attr &attr, bool initWeights) {
Expand Down Expand Up @@ -835,7 +824,13 @@ void MKLDNNMVNNode::execute(mkldnn::stream strm) {
uint8_t *dst_data = reinterpret_cast<uint8_t*>(dstMemPtr->GetPtr());
uint8_t *src_data = reinterpret_cast<uint8_t*>(srcMemPtr->GetPtr());

(this->*mvn_executor)(src_data, dst_data, getParentEdgeAt(0)->getDesc().getDims());
auto dim = getParentEdgeAt(0)->getDesc().getDims();
Layout layout = getParentEdgeAt(0)->getDesc().getLayout();
if (layout == C || layout == NC || layout == CHW || layout == NCHW || layout == NCDHW) {
mvn_pln(src_data, dst_data, dim);
} else {
mvn_blk(src_data, dst_data, dim);
}
}

void MKLDNNMVNNode::mvn_pln(const uint8_t* src_data, uint8_t* dst_data, const SizeVector& dims) {
Expand Down

0 comments on commit a0312a3

Please sign in to comment.