[coverity] Fixes realtd to coverity
authorParichay Kapoor <pk.kapoor@samsung.com>
Wed, 21 Jul 2021 03:18:46 +0000 (12:18 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Thu, 22 Jul 2021 11:47:24 +0000 (20:47 +0900)
Add fixes related to coverity.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
nntrainer/layers/layer_node.cpp
nntrainer/layers/layer_node.h
nntrainer/layers/nnstreamer_layer.cpp
nntrainer/utils/node_exporter.cpp

index 88af9bc..b29cebe 100644 (file)
@@ -246,11 +246,11 @@ void LayerNode::setActivation(ActivationType activation) {
 
 const std::string LayerNode::getType() const { return getLayer()->getType(); }
 
-bool LayerNode::getTrainable() const noexcept {
+bool LayerNode::getTrainable() const {
   return std::get<props::Trainable>(*layer_node_props);
 }
 
-bool LayerNode::getFlatten() const noexcept {
+bool LayerNode::getFlatten() const {
   auto &flatten = std::get<props::Flatten>(*layer_node_props);
   if (flatten.empty()) {
     return false;
@@ -258,7 +258,7 @@ bool LayerNode::getFlatten() const noexcept {
   return flatten.get();
 }
 
-bool LayerNode::getDistribute() const noexcept {
+bool LayerNode::getDistribute() const {
   auto &distribute = std::get<props::Distribute>(*layer_node_props);
   if (distribute.empty()) {
     return false;
index 2c4d4bd..6da6263 100644 (file)
@@ -242,19 +242,19 @@ public:
    *
    * @return boolean true if trainable, else false
    */
-  bool getTrainable() const noexcept;
+  bool getTrainable() const;
 
   /**
    * @brief     get if the output of this layer must be flatten
    * @retval    flatten value
    */
-  bool getFlatten() const noexcept;
+  bool getFlatten() const;
 
   /**
    * @brief     get distribute for this layer
    * @retval dist to enable/disable distribute
    */
-  bool getDistribute() const noexcept;
+  bool getDistribute() const;
 
   /**
    * @brief     get activation for this layer
index 8836b2f..709115f 100644 (file)
@@ -93,7 +93,9 @@ void NNStreamerLayer::finalizeError(int status) {
     single = nullptr;
   }
 
-  throw std::invalid_argument("[NNStreamerLayer] Finalizing the layer failed.");
+  if (status != ML_ERROR_NONE)
+    throw std::invalid_argument(
+      "[NNStreamerLayer] Finalizing the layer failed.");
 }
 
 void NNStreamerLayer::finalize(InitLayerContext &context) {
index 9479bac..64c534a 100644 (file)
@@ -24,7 +24,7 @@ namespace nntrainer {
  * @brief Construct a new Exporter object
  *
  */
-Exporter::Exporter() : stored_result(nullptr), is_exported(false){};
+Exporter::Exporter() : stored_result(nullptr), is_exported(false) {}
 
 /**
  * @brief Destroy the Exporter object