Fixed coverity issues (#8448)
This commit is contained in:
@@ -50,8 +50,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_transpose_a;
|
||||
bool m_transpose_b;
|
||||
bool m_transpose_a{false};
|
||||
bool m_transpose_b{false};
|
||||
};
|
||||
} // namespace v0
|
||||
} // namespace op
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
private:
|
||||
bool evaluate_shuffle_channels(const HostTensorVector& outputs, const HostTensorVector& inputs) const;
|
||||
|
||||
int64_t m_axis;
|
||||
int64_t m_group;
|
||||
int64_t m_axis{1};
|
||||
int64_t m_group{1};
|
||||
};
|
||||
} // namespace v0
|
||||
} // namespace op
|
||||
|
||||
@@ -150,7 +150,7 @@ InputEdge onnx_editor::EdgeMapper::find_input_edge(const EditorNode& node, const
|
||||
}
|
||||
|
||||
OutputEdge onnx_editor::EdgeMapper::find_output_edge(const EditorNode& node, const EditorOutput& out) const {
|
||||
int node_index = node_index = node.m_node_index;
|
||||
int node_index = node.m_node_index;
|
||||
if (node_index == -1) { // the node index is not provided
|
||||
// identification can be both based on node name and output name (if the node index is not provided)
|
||||
const auto& node_indexes = find_node_indexes(node.m_node_name, node.m_output_name);
|
||||
|
||||
@@ -183,8 +183,11 @@ public:
|
||||
m_infer_shapes_was_run = true;
|
||||
}
|
||||
~InferShapesAutoRelease() {
|
||||
if (m_infer_shapes_was_run) {
|
||||
m_model_proto->mutable_graph()->clear_value_info();
|
||||
try {
|
||||
if (m_infer_shapes_was_run) {
|
||||
m_model_proto->mutable_graph()->clear_value_info();
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "random_normal.hpp"
|
||||
|
||||
#include <random>
|
||||
|
||||
#include "default_opset.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
|
||||
@@ -16,6 +18,10 @@ OutputVector make_random_normal(const Output<ngraph::Node>& shape,
|
||||
float mean,
|
||||
float scale,
|
||||
float seed) {
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::uniform_int_distribution<uint64_t> distrib(0, 9999);
|
||||
|
||||
// We start by generating two random series from a uniform distribution
|
||||
const uint64_t global_seed = 0;
|
||||
|
||||
@@ -23,8 +29,8 @@ OutputVector make_random_normal(const Output<ngraph::Node>& shape,
|
||||
const auto op_seed = static_cast<uint64_t>(seed * 1000);
|
||||
|
||||
// We need to use two op_seeds to make sure we get different results for two RandomUniform series
|
||||
const uint64_t seed_1 = (op_seed == 0 ? rand() % 10000 : op_seed);
|
||||
const uint64_t seed_2 = (op_seed == 0 ? rand() % 10000 : op_seed + 10000);
|
||||
const uint64_t seed_1 = (op_seed == 0 ? distrib(gen) : op_seed);
|
||||
const uint64_t seed_2 = (op_seed == 0 ? distrib(gen) : op_seed + 10000);
|
||||
|
||||
const auto min_val = default_opset::Constant::create(target_type, Shape{1}, {0});
|
||||
const auto max_val = default_opset::Constant::create(target_type, Shape{1}, {1});
|
||||
|
||||
@@ -18,7 +18,11 @@ NamedOutputs fill_any_like(const NodeContext& node) {
|
||||
// when type does not define, use the input type
|
||||
dtype = x.get_element_type();
|
||||
}
|
||||
const auto supported_type = {element::i32, element::i64, element::f16, element::f32, element::f64};
|
||||
const std::vector<element::Type> supported_type = {element::i32,
|
||||
element::i64,
|
||||
element::f16,
|
||||
element::f32,
|
||||
element::f64};
|
||||
const bool valid_type =
|
||||
std::any_of(supported_type.begin(), supported_type.end(), [dtype](const element::Type& type) {
|
||||
return dtype == type;
|
||||
|
||||
Reference in New Issue
Block a user