From: Parichay Kapoor Date: Wed, 21 Jul 2021 03:18:46 +0000 (+0900) Subject: [coverity] Fixes realtd to coverity X-Git-Tag: accepted/tizen/unified/20210829.234903~116 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4882e03fcbc11a63d6baa92476e2ff9b11763b8;p=platform%2Fcore%2Fml%2Fnntrainer.git [coverity] Fixes realtd to coverity Add fixes related to coverity. Signed-off-by: Parichay Kapoor --- diff --git a/nntrainer/layers/layer_node.cpp b/nntrainer/layers/layer_node.cpp index 88af9bc..b29cebe 100644 --- a/nntrainer/layers/layer_node.cpp +++ b/nntrainer/layers/layer_node.cpp @@ -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(*layer_node_props); } -bool LayerNode::getFlatten() const noexcept { +bool LayerNode::getFlatten() const { auto &flatten = std::get(*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(*layer_node_props); if (distribute.empty()) { return false; diff --git a/nntrainer/layers/layer_node.h b/nntrainer/layers/layer_node.h index 2c4d4bd..6da6263 100644 --- a/nntrainer/layers/layer_node.h +++ b/nntrainer/layers/layer_node.h @@ -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 diff --git a/nntrainer/layers/nnstreamer_layer.cpp b/nntrainer/layers/nnstreamer_layer.cpp index 8836b2f..709115f 100644 --- a/nntrainer/layers/nnstreamer_layer.cpp +++ b/nntrainer/layers/nnstreamer_layer.cpp @@ -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) { diff --git a/nntrainer/utils/node_exporter.cpp b/nntrainer/utils/node_exporter.cpp index 9479bac..64c534a 100644 --- a/nntrainer/utils/node_exporter.cpp +++ b/nntrainer/utils/node_exporter.cpp @@ -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