Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/include/openvino/core/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class OPENVINO_API Model : public std::enable_shared_from_this<Model> {
*/
template <class T, class... Args>
void set_rt_info(const T& argument, Args... args) {
ov::Any& arg = get_rt_arg<Args...>(m_rt_info, args...);
ov::Any& arg = get_rt_arg<Args...>(m_rt_info, std::move(args)...);
arg = argument;
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/include/openvino/pass/pattern/op/label.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ class OPENVINO_API Label : public Pattern {
OutputVector()) {}

Label(const element::Type& type, const PartialShape& s, ValuePredicate pred)
: Label(type, s, pred, OutputVector{}) {}
: Label(type, s, std::move(pred), OutputVector{}) {}

Label(const element::Type& type, const PartialShape& s, NodePredicate pred)
: Label(type, s, as_value_predicate(pred), OutputVector{}) {}
: Label(type, s, as_value_predicate(std::move(pred)), OutputVector{}) {}

Label(const element::Type& type, const PartialShape& s, const NodePredicate pred, const NodeVector& wrapped_values)
: Label(type, s, as_value_predicate(pred), as_output_vector(wrapped_values)) {}
Label(const element::Type& type, const PartialShape& s, NodePredicate pred, const NodeVector& wrapped_values)
: Label(type, s, as_value_predicate(std::move(pred)), as_output_vector(wrapped_values)) {}

/// \brief creates a Label node containing a sub-pattern described by the type and
/// shape of \sa node.
Expand Down
8 changes: 1 addition & 7 deletions src/core/include/openvino/pass/pattern/op/pattern.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,7 @@ class OPENVINO_API Pattern : public Node {
public:
/// \brief \p a base class for \sa Skip and \sa Label
///
Pattern(const OutputVector& patterns, ValuePredicate pred) : Node(patterns), m_predicate(pred) {
if (!m_predicate) {
m_predicate = [](const Output<Node>&) {
return true;
};
}
}
Pattern(const OutputVector& patterns, ValuePredicate pred);

Pattern(const OutputVector& patterns) : Pattern(patterns, nullptr) {}

Expand Down
16 changes: 8 additions & 8 deletions src/core/reference/include/openvino/reference/ctc_loss.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ void CTCLoss(const T* logits,
for (size_t pos = start; pos < end; pos++) {
newLogProb = prevLogProb;
for (size_t bl = start; bl < pos; bl++) {
newLogProb += logProbabilities[bl].find(blankIndex)->second;
newLogProb += logProbabilities[bl][blankIndex];
}
newLogProb += logProbabilities[pos].find(targetD[targetIdx])->second;
newLogProb += logProbabilities[pos][targetD[targetIdx]];
if (end == static_cast<size_t>(actualLogitLen)) {
for (size_t ble = pos + 1; ble < static_cast<size_t>(actualLogitLen); ble++) {
newLogProb += logProbabilities[ble].find(blankIndex)->second;
newLogProb += logProbabilities[ble][blankIndex];
}
}
findPaths(nextIdx, pos + 1, end + 1, newLogProb);
Expand All @@ -136,21 +136,21 @@ void CTCLoss(const T* logits,
newLogProb = prevLogProb;
size_t next_start = pos + 1;
for (size_t bl = start; bl < pos; bl++) {
newLogProb += logProbabilities[bl].find(blankIndex)->second;
newLogProb += logProbabilities[bl][blankIndex];
}
if (end == static_cast<size_t>(actualLogitLen)) {
for (int64_t ble = pos + 1; ble < actualLogitLen; ble++) {
newLogProb += logProbabilities[ble].find(blankIndex)->second;
newLogProb += logProbabilities[ble][blankIndex];
}
}
if (targetIdx < decodedTargetLen - 1 && targetD[targetIdx] == targetD[targetIdx + 1]) {
newLogProb += logProbabilities[next_start++].find(blankIndex)->second;
newLogProb += logProbabilities[next_start++][blankIndex];
}
for (int64_t bl = pos; bl >= st64; bl--) {
newLogProb += logProbabilities[bl].find(targetD[targetIdx])->second;
newLogProb += logProbabilities[bl][targetD[targetIdx]];
findPaths(nextIdx, next_start, end + 1, newLogProb);
if (bl > 0)
newLogProb -= logProbabilities[bl - 1].find(blankIndex)->second;
newLogProb -= logProbabilities[bl - 1][blankIndex];
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class referenceDetectionOutput {
if (attrs.background_label_id > -1 && label == attrs.background_label_id) {
continue;
}
const std::vector<NormalizedBBox>& labelLocPreds = locPreds[i].find(label)->second;
const auto& labelLocPreds = locPreds[i].at(label);
DecodeBBoxes(currPrBbox, currPrVar, labelLocPreds, decodeBboxesImage[label]);
}
}
Expand All @@ -277,10 +277,10 @@ class referenceDetectionOutput {
if (attrs.background_label_id > -1 && label == attrs.background_label_id) {
continue;
}
const std::vector<NormalizedBBox>& labelArmLocPreds = armLocPreds[i].find(label)->second;
const auto& labelArmLocPreds = armLocPreds[i].at(label);
std::vector<NormalizedBBox> decodePriorBboxes;
DecodeBBoxes(currPrBbox, currPrVar, labelArmLocPreds, decodePriorBboxes);
const std::vector<NormalizedBBox>& labelLocPreds = locPreds[i].find(label)->second;
const auto& labelLocPreds = locPreds[i].at(label);
DecodeBBoxes(decodePriorBboxes, currPrVar, labelLocPreds, decodeBboxesImage[label]);
}
}
Expand Down Expand Up @@ -491,14 +491,16 @@ class referenceDetectionOutput {
if (c == attrs.background_label_id) {
continue;
}
if (confScores.find(c) == confScores.end())
const auto conf_score = confScores.find(c);
if (conf_score == confScores.end())
continue;
const std::vector<dataType>& scores = confScores.find(c)->second;
const std::vector<dataType>& scores = conf_score->second;

int label = attrs.share_location ? -1 : c;
if (decodeBboxesImage.find(label) == decodeBboxesImage.end())
const auto decode_bboxes = decodeBboxesImage.find(label);
if (decode_bboxes == decodeBboxesImage.end())
continue;
const std::vector<NormalizedBBox>& bboxes = decodeBboxesImage.find(label)->second;
const std::vector<NormalizedBBox>& bboxes = decode_bboxes->second;
caffeNMS(bboxes, scores, indices[c]);
numDet += static_cast<int>(indices[c].size());
}
Expand All @@ -513,9 +515,10 @@ class referenceDetectionOutput {
for (auto it = indices.begin(); it != indices.end(); ++it) {
int label = it->first;
const std::vector<int>& labelIndices = it->second;
if (confScores.find(label) == confScores.end())
const auto conf_score = confScores.find(label);
if (conf_score == confScores.end())
continue;
const std::vector<dataType>& scores = confScores.find(label)->second;
const std::vector<dataType>& scores = conf_score->second;
for (size_t j = 0; j < labelIndices.size(); ++j) {
int idx = labelIndices[j];
scoreIndexPairs.push_back(std::make_pair(scores[idx], std::make_pair(label, idx)));
Expand Down Expand Up @@ -547,11 +550,12 @@ class referenceDetectionOutput {
const LabelBBox& decodeBboxesImage = decodeBboxes[i];
for (auto it = allIndices[i].begin(); it != allIndices[i].end(); ++it) {
int label = it->first;
const std::vector<dataType>& scores = confScores.find(label)->second;
const std::vector<dataType>& scores = confScores.at(label);
int loc_label = attrs.share_location ? -1 : label;
if (decodeBboxesImage.find(loc_label) == decodeBboxesImage.end())
const auto decode_bboxes = decodeBboxesImage.find(loc_label);
if (decode_bboxes == decodeBboxesImage.end())
continue;
const std::vector<NormalizedBBox>& bboxes = decodeBboxesImage.find(loc_label)->second;
const std::vector<NormalizedBBox>& bboxes = decode_bboxes->second;
std::vector<int>& indices = it->second;
for (size_t j = 0; j < indices.size(); ++j) {
int idx = indices[j];
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/axis_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ ov::AxisVector& ov::AxisVector::operator=(const AxisVector& v) {
}

ov::AxisVector& ov::AxisVector::operator=(AxisVector&& v) noexcept {
static_cast<std::vector<size_t>*>(this)->operator=(v);
static_cast<std::vector<size_t>*>(this)->operator=(std::move(v));
return *this;
}
19 changes: 10 additions & 9 deletions src/core/src/constant_fold_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,17 @@ std::shared_ptr<ov::Node> ov::util::convert_to_supported_precision(Node* const n
type_relaxed->set_origin_input_type(origin_input_types[i], i);
}

auto cloned_type_relaxed = std::dynamic_pointer_cast<op::TypeRelaxedBase>(cloned_node);
// Override TypeRelaxed types
for (size_t i = 0; i < num_inputs; i++) {
if (ov::util::is_type_unsupported(cloned_type_relaxed->get_origin_input_type(i))) {
cloned_type_relaxed->set_origin_input_type(cloned_node->get_input_element_type(i), i);
if (auto cloned_type_relaxed = std::dynamic_pointer_cast<op::TypeRelaxedBase>(cloned_node)) {
// Override TypeRelaxed types
for (size_t i = 0; i < num_inputs; i++) {
if (ov::util::is_type_unsupported(cloned_type_relaxed->get_origin_input_type(i))) {
cloned_type_relaxed->set_origin_input_type(cloned_node->get_input_element_type(i), i);
}
}
}
for (size_t i = 0; i < cloned_node->get_output_size(); i++) {
if (ov::util::is_type_unsupported(cloned_node->get_output_element_type(i))) {
cloned_type_relaxed->set_overridden_output_type(element::f32, i);
for (size_t i = 0; i < cloned_node->get_output_size(); i++) {
if (ov::util::is_type_unsupported(cloned_node->get_output_element_type(i))) {
cloned_type_relaxed->set_overridden_output_type(element::f32, i);
}
}
}
cloned_node->validate_and_infer_types();
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/graph_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void save_model(const std::shared_ptr<const ov::Model>& m, const std::string& ou
ov::pass::Manager manager;
manager.register_pass<ov::pass::FusedNamesCleanup>();
manager.register_pass<ov::pass::Serialize>(output_model, "");
manager.run_passes(cloned);
manager.run_passes(std::move(cloned));
}

bool is_used(Node* node);
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/opsets/opset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ov::Node* ov::OpSet::create(const std::string& name) const {
return nullptr;
}
REGISTER_OP(m_name, name);
return m_factory_registry.find(type_info_it->second)->second();
return m_factory_registry.at(type_info_it->second)();
}

ov::Node* ov::OpSet::create_insensitive(const std::string& name) const {
Expand All @@ -51,7 +51,7 @@ ov::Node* ov::OpSet::create_insensitive(const std::string& name) const {
return nullptr;
}
REGISTER_OP(m_name, name);
return m_factory_registry.find(type_info_it->second)->second();
return m_factory_registry.at(type_info_it->second)();
}

bool ov::OpSet::contains_type(const ov::NodeTypeInfo& type_info) const {
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/pass/graph_rewrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ bool ov::pass::GraphRewrite::apply_matcher_passes(std::shared_ptr<Model> f,

// Apply MatcherPass. In case if it returns true no other MatcherPasses will apply
// to this node
bool status = m_pass->apply(node);
bool status = m_pass->apply(std::move(node));

// In case if MatcherPass registered nodes they will be added to the beginning of execution
// queue
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/pass/low_latency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void unroll_single_iteration(const std::shared_ptr<ov::op::util::SubGraphOp>& su
}
outer_f->add_sinks(sub_graph_op->get_function()->get_sinks());
ov::copy_runtime_info(sub_graph_op, sub_graph_op->get_function()->get_ops());
ov::copy_runtime_info(sub_graph_op, new_ops);
ov::copy_runtime_info(sub_graph_op, std::move(new_ops));
}

ov::Output<ov::Node> create_init_subgraph(const ov::Output<ov::Node>& in_node, ov::pass::NodeRegistry& to) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/pass/make_stateful.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool ov::pass::MakeStateful::run_on_model(const std::shared_ptr<ov::Model>& f) {
const auto& res = m_param_res_pairs[i].second;

// Create Variable
std::string var_name = variable_names[i];
const auto& var_name = variable_names[i];
auto variable = std::make_shared<ov::op::util::Variable>(
ov::op::util::VariableInfo{param->get_partial_shape(), param->get_element_type(), var_name});
variables.push_back(variable);
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/pass/sdpa_to_paged_attention.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ bool ov::pass::SDPAToPagedAttention::run_on_model(const std::shared_ptr<ov::Mode

model->add_parameters(kv_parameters);
model->add_parameters(model_remaining_params);
model->add_parameters({max_context_len});
model->add_parameters({std::move(max_context_len)});
model->validate_nodes_and_infer_types();
return true;
}
2 changes: 1 addition & 1 deletion src/core/src/pass/serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ void ngfunction_2_ir(pugi::xml_node& netXml,
for (const auto& res : model.get_results()) {
result.emplace_back(res);
}
sorted_ops = result;
sorted_ops = std::move(result);
}

for (const auto& n : sorted_ops) {
Expand Down
29 changes: 22 additions & 7 deletions src/core/src/pattern/op/pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,34 @@ namespace ov {
namespace pass {
namespace pattern {
namespace op {
namespace {
constexpr bool node_value_true_predicate(const Output<Node>&) {
return true;
}
} // namespace

struct NodeValuePredicate {
bool operator()(const Output<Node>& value) const {
return pred(value.get_node_shared_ptr());
}

NodePredicate pred;
};

Pattern::Pattern(const OutputVector& patterns, ValuePredicate pred)
: Node(patterns),
m_predicate(pred ? std::move(pred) : node_value_true_predicate) {}

// The symbols are required to be in cpp file to workaround RTTI issue on Android LLVM
ValuePredicate Pattern::get_predicate() const {
return m_predicate;
}

ValuePredicate as_value_predicate(NodePredicate pred) {
if (pred == nullptr) {
return [](const Output<Node>&) {
return true;
};
if (pred) {
return NodeValuePredicate{std::move(pred)};
} else {
return [pred](const Output<Node>& value) {
return pred(value.get_node_shared_ptr());
};
return node_value_true_predicate;
}
}
} // namespace op
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/preprocess/preprocess_impls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ InputInfo::InputInfoImpl::InputInfoData InputInfo::InputInfoImpl::create_new_par
[&](int64_t v) -> const Dimension& {
return new_param_shape[v];
});
new_param_shape = PartialShape(dims);
new_param_shape = PartialShape(std::move(dims));
}
} else {
Layout new_layout;
std::tie(new_param_shape, new_layout) =
get_preprocess()->calculate_param_shape(new_param_shape, res.m_model_layout);
if (res.m_tensor_layout.empty()) {
// Reusing param's layout according to converted calculated layout
res.m_tensor_layout = new_layout;
res.m_tensor_layout = std::move(new_layout);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/src/preprocess/preprocess_steps_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void PreStepsList::add_convert_layout_impl(const Layout& layout) {
auto perm_constant =
op::v0::Constant::create<int64_t>(element::i64, Shape{permutation.size()}, permutation);
auto transpose = std::make_shared<op::v1::Transpose>(node, perm_constant);
context.layout() = dst_layout; // Update context's current layout
context.layout() = std::move(dst_layout); // Update context's current layout
// return false to avoid excess function revalidations as layout conversion
// doesn't require shape or type propagation.
return std::make_tuple(std::vector<Output<Node>>{transpose}, false);
Expand Down Expand Up @@ -552,7 +552,7 @@ void PreStepsList::add_convert_color_impl(const ColorFormat& dst_format) {
ov::Strides(weights_shape.size() - 2, 1));

if (is_converted) {
// Round values according to OpenCV rule before converting to integral values
// Roundp values according to OpenCV rule before converting to integral values
auto round_val =
std::make_shared<ov::op::v5::Round>(node, ov::op::v5::Round::RoundMode::HALF_TO_EVEN);
node = std::make_shared<op::v0::Convert>(round_val, elem_type);
Expand All @@ -565,7 +565,7 @@ void PreStepsList::add_convert_color_impl(const ColorFormat& dst_format) {
node = std::make_shared<op::v1::Transpose>(node, perm_constant);
}
context.color_format() = dst_format;
return std::make_tuple(std::vector<Output<Node>>{node}, true);
return std::make_tuple(std::vector<Output<Node>>{std::move(node)}, true);
}
if (context.color_format() == ColorFormat::RGBX) {
if (dst_format == ColorFormat::RGB) {
Expand Down Expand Up @@ -722,7 +722,7 @@ void PostStepsList::add_convert_layout_impl(const Layout& layout) {
auto perm_constant =
op::v0::Constant::create<int64_t>(element::i64, Shape{permutation.size()}, permutation);
auto transpose = std::make_shared<op::v1::Transpose>(node, perm_constant);
context.layout() = dst_layout; // Update context's current layout
context.layout() = std::move(dst_layout); // Update context's current layout
return std::make_tuple(Output<Node>(transpose), true);
},
"convert layout " + layout.to_string());
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/runtime/itensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ void ITensor::copy_to(const std::shared_ptr<ov::ITensor>& dst) const {
max_pos[inverted_idx] = shape[inverted_idx];
cur_pos[inverted_idx] = 0;
}
src_strides = src_str;
dst_strides = dst_str;
src_strides = std::move(src_str);
dst_strides = std::move(dst_str);
}

const auto update_index = [](const ov::Shape& pos, const ov::Shape& shape, const ov::Strides& strides) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/strides.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ ov::Strides& ov::Strides::operator=(const Strides& v) {
}

ov::Strides& ov::Strides::operator=(Strides&& v) noexcept {
static_cast<std::vector<size_t>*>(this)->operator=(v);
static_cast<std::vector<size_t>*>(this)->operator=(std::move(v));
return *this;
}
2 changes: 1 addition & 1 deletion src/core/src/symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ void ov::symbol::set_equal(const std::shared_ptr<Symbol>& lhs, const std::shared
auto lhs_root = ov::symbol::ancestor_of(lhs), rhs_root = ov::symbol::ancestor_of(rhs);
if (lhs_root.get() == rhs_root.get())
return; // already are equal
lhs_root->m_parent = rhs_root;
lhs_root->m_parent = std::move(rhs_root);
}
Loading