[IE][VPU]: Fix KW issues on Linux (#1916)
authorMaksim Doronin <maksim.doronin@intel.com>
Tue, 25 Aug 2020 08:42:23 +0000 (11:42 +0300)
committerGitHub <noreply@github.com>
Tue, 25 Aug 2020 08:42:23 +0000 (11:42 +0300)
* nullptr dereference fixed in Concat and Reduce stages in Graph Transformer
* missed parameters in asserts in StridedSlice stage was added

inference-engine/src/vpu/graph_transformer/src/stages/concat.cpp
inference-engine/src/vpu/graph_transformer/src/stages/reduce.cpp
inference-engine/src/vpu/graph_transformer/src/stages/strided_slice.cpp

index 7d3f41c..3ecc59a 100644 (file)
@@ -275,8 +275,10 @@ void FrontEnd::parseConcat(
 
     auto output = outputs[0];
 
-    auto concat = std::dynamic_pointer_cast<ie::ConcatLayer>(layer);
     VPU_THROW_UNLESS(layer != nullptr,
+                     "parseConcat expects valid CNNLayerPtr, got nullptr");
+    auto concat = std::dynamic_pointer_cast<ie::ConcatLayer>(layer);
+    VPU_THROW_UNLESS(concat != nullptr,
                      "{} layer with name {} must be able to convert to ie::ConcatLayer",
                      layer->type, layer->name);
 
index b898b4e..37d89d4 100644 (file)
@@ -127,10 +127,12 @@ private:
 }  // namespace
 
 void FrontEnd::parseReduce(const Model& model, const ie::CNNLayerPtr& _layer, const DataVector& inputs, const DataVector& outputs) const {
-    auto layer = std::dynamic_pointer_cast<ie::ReduceLayer>(_layer);
+    VPU_THROW_UNLESS(_layer != nullptr,
+                     "parseReduce expects valid CNNLayerPtr, got nullptr");
+    const auto layer = std::dynamic_pointer_cast<ie::ReduceLayer>(_layer);
     VPU_THROW_UNLESS(layer != nullptr,
-                     "Layer {} of type {} is nullptr",
-                     layer->name, layer->type);
+                     "Layer {} of type {} cannot be casted to ie::ReduceLayer",
+                     _layer->name, _layer->type);
     VPU_THROW_UNLESS(inputs.size() == 2,
                      "Layer {} of type {} expects {} inputs, but provided {}",
                      layer->name, layer->type, 2, inputs.size());
index 1d6e971..6a00e75 100644 (file)
@@ -122,10 +122,12 @@ void FrontEnd::parseStridedSlice(const Model& model, const ie::CNNLayerPtr& laye
         const auto& strides = inputs[3];
         const auto stridesPtr = strides->content()->get<int32_t>();
         VPU_THROW_UNLESS(stridesPtr != nullptr,
-                         "Checking {} with type {} failed: pointer for strides is null");
+                         "Checking {} with type {} failed: pointer for strides is null",
+                         layer->name, layer->type);
         for (int i = 0; i < strides->desc().totalDimSize(); i++) {
             VPU_THROW_UNLESS(stridesPtr[i] > 0,
-                             "Checking {} with type {} failed: negative stride is not supported");
+                             "Checking {} with type {} failed: negative stride is not supported",
+                             layer->name, layer->type);
         }
     }