[Common] Static analyzed issues. (#804)
authorNikolay Shchegolev <nikolay.shchegolev@intel.com>
Tue, 9 Jun 2020 10:49:50 +0000 (13:49 +0300)
committerGitHub <noreply@github.com>
Tue, 9 Jun 2020 10:49:50 +0000 (13:49 +0300)
inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp
inference-engine/src/legacy_api/src/cnn_network_int8_normalizer.cpp
inference-engine/src/mkldnn_plugin/mkldnn_node.cpp
inference-engine/src/mkldnn_plugin/nodes/embedding_bag_offset_sum.cpp
inference-engine/src/mkldnn_plugin/nodes/extract_image_patches.cpp
inference-engine/src/mkldnn_plugin/nodes/mkldnn_conv_node.cpp
inference-engine/src/readers/ir_reader/ie_ir_reader.cpp
inference-engine/src/readers/onnx_reader/ie_onnx_reader.cpp
inference-engine/src/transformations/src/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.cpp
inference-engine/src/transformations/src/transformations/convert_opset1_to_legacy/convert_tile_to_ie_tile.cpp

index 6e2dfcb..1619098 100644 (file)
@@ -82,8 +82,6 @@ CNNNetwork::CNNNetwork(const std::shared_ptr<const ngraph::Function>& graph) {
     }
 
     // Copy nGraph function
-    if (graph == nullptr)
-        THROW_IE_EXCEPTION << "Cannot create CNNNetwork from empty nGraph function!";
     network = std::make_shared<CNNNetworkNGraphImpl>(copyFunction(graph, false, {}));
     actual = network.get();
     if (actual == nullptr) {
index b057db8..5ef2672 100644 (file)
@@ -1003,12 +1003,14 @@ void CNNNetworkInt8Normalizer::QuantizeConvolutionOrFullyConnected(CNNLayer::Ptr
                 symQuant = *(intervals.begin());
             }
             std::set<double> divs;
-            prev = 0.f;
-            for (auto it = individualsG.begin(); it != individualsG.end(); it++) {
-                if (prev) {
-                    divs.insert((*it - prev) / symQuant);
+            if (symQuant != 0.) {
+                prev = 0.f;
+                for (auto it = individualsG.begin(); it != individualsG.end(); it++) {
+                    if (prev) {
+                        divs.insert((*it - prev) / symQuant);
+                    }
+                    prev = *it;
                 }
-                prev = *it;
             }
 
             bwquantized = true;
index d0ceeb6..c1c69c3 100644 (file)
@@ -573,7 +573,7 @@ void MKLDNNNode::filterSupportedPrimitiveDescriptors() {
                     isSuitableDesc = false;
             }
             if (!isSuitableDesc) {
-                supportedPrimitiveDescriptors.erase(itpd);
+                itpd = supportedPrimitiveDescriptors.erase(itpd);
             } else {
                 itpd++;
             }
index 0c01837..fa11061 100644 (file)
@@ -117,7 +117,6 @@ protected:
             weightsData = inputs[PER_SAMPLE_WEIGHTS_IDX]->cbuffer().as<const T*>();
 
         const auto& inDataDims = inputs[0]->getTensorDesc().getDims();
-        const size_t IN_BAGS_DEPTH = inDataDims.size() - 1;
 
         const size_t OUTPUT_BAGS_NUM = outputs[0]->getTensorDesc().getDims()[0];
 
index ecde2df..fed075a 100644 (file)
@@ -131,7 +131,6 @@ public:
 
         const size_t BATCH = 0, CHANNEL = 1, HIGHT = 0, WIDTH = 1;
 
-        const int64_t IB = inDims[BATCH];
         const int64_t IC = inDims[CHANNEL];
         const int64_t IH = inDims[inDimsSize - 2];
         const int64_t IW = inDims[inDimsSize - 1];
@@ -151,9 +150,6 @@ public:
         const int64_t RH = _rates[HIGHT];
         const int64_t RW = _rates[WIDTH];
 
-        int64_t ihStart = 0;
-        int64_t iwStart = 0;
-
         int64_t iwStep = KW + (RW - 1) * (KW - 1);
         int64_t ihStep = KH + (RH - 1) * (KH - 1);
 
@@ -190,7 +186,6 @@ public:
         const int64_t OC_OH_OW = OC * OH_OW;
         const int64_t IH_IW = IH * IW;
         const int64_t IC_IH_IW = IC * IH_IW;
-        const int64_t KH_KW = KH * KW;
 
         const int64_t work_amount = OB;
 
index 7cc7294..148c381 100644 (file)
@@ -898,7 +898,7 @@ void MKLDNNConvolutionNode::filterSupportedDescriptors() {
                     isSuitableDesc = false;
             }
             if (!isSuitableDesc) {
-                descs.erase(itd);
+                itd = descs.erase(itd);
             } else {
                 itd++;
             }
index 0abb43d..9982425 100644 (file)
@@ -55,7 +55,7 @@ INFERENCE_PLUGIN_API(StatusCode) InferenceEngine::CreateReader(IReader*& reader,
         reader = new IRReader();
         return OK;
     }
-    catch (std::exception &ex) {
+    catch (std::exception &) {
         return GENERAL_ERROR;
     }
 }
index fee5cca..c72de89 100644 (file)
@@ -30,7 +30,7 @@ INFERENCE_PLUGIN_API(StatusCode) InferenceEngine::CreateReader(IReader*& reader,
         reader = new ONNXReader();
         return OK;
     }
-    catch (std::exception &ex) {
+    catch (std::exception &) {
         return GENERAL_ERROR;
     }
 }
index c68a3e2..767c434 100644 (file)
@@ -22,6 +22,8 @@ void ngraph::pass::ConvertInterpolateToInterpOrResample::convert_interpolate_to_
 
     ngraph::graph_rewrite_callback callback = [](pattern::Matcher& m) {
         auto interpolate = std::dynamic_pointer_cast<ngraph::opset1::Interpolate> (m.get_match_root());
+        if (!interpolate)
+            return false;
 
         auto data_node = interpolate->input_value(0);
         auto out_shape_node = std::dynamic_pointer_cast<ngraph::opset1::Constant>(interpolate->input_value(1).get_node_shared_ptr());
index 965bb67..4819944 100644 (file)
@@ -47,6 +47,8 @@ void ngraph::pass::ConvertTileToIETile::convert_tile() {
         //
         // if (!already_set) return false;
         auto last_node = std::dynamic_pointer_cast<ngraph::Node>(data_node);
+        if (!last_node)
+            return false;
         auto friendly_name = tile->get_friendly_name();
 
         int num_of_tile_dims = 0;