Skip to content
Open
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
17 changes: 6 additions & 11 deletions src/plugins/template/backend/int_executable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ class TemporaryOverrideOutputs {
}
};

ov::runtime::interpreter::INTExecutable::INTExecutable(const std::shared_ptr<ov::Model>& model) : m_is_compiled{true} {
m_model = model->clone();
for (auto node : m_model->get_ordered_ops()) {
m_nodes.push_back(node);
}
ov::runtime::interpreter::INTExecutable::INTExecutable(const std::shared_ptr<ov::Model>& model)
: m_is_compiled{true},
m_model{model->clone()},
m_nodes{m_model->get_ordered_ops()} {
set_parameters_and_results(*m_model);
}

Expand Down Expand Up @@ -195,9 +194,7 @@ std::vector<ov::Tensor> ov::runtime::interpreter::INTExecutable::create_input_te
std::vector<ov::Tensor> tensors;
std::shared_ptr<op::v0::Parameter> parameter = get_parameter(input_index);
for (size_t i = 0; i < pipeline_depth; i++) {
ov::Tensor tensor;
auto t = ov::Tensor(parameter->get_element_type(), parameter->get_shape());
tensors.push_back(t);
tensors.emplace_back(parameter->get_element_type(), parameter->get_shape());
}
return tensors;
}
Expand All @@ -207,9 +204,7 @@ std::vector<ov::Tensor> ov::runtime::interpreter::INTExecutable::create_output_t
std::vector<ov::Tensor> tensors;
std::shared_ptr<op::v0::Result> result = get_result(output_index);
for (size_t i = 0; i < pipeline_depth; i++) {
ov::Tensor tensor;
auto t = ov::Tensor(result->get_element_type(), result->get_shape());
tensors.push_back(t);
tensors.emplace_back(result->get_element_type(), result->get_shape());
}
return tensors;
}
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/template/backend/int_executable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class INTExecutable : public Executable {
bool evaluate_node(const std::shared_ptr<Node>& node,
ov::TensorVector& outputs,
const ov::TensorVector& inputs) const;
bool m_is_compiled = false;
std::shared_ptr<ov::Model> m_model;
bool m_is_compiled{};
std::shared_ptr<ov::Model> m_model{};
std::vector<std::shared_ptr<Node>> m_nodes;
std::atomic_bool m_cancel_execution{false};
std::mutex m_mutex;
std::atomic_bool m_cancel_execution{};
std::mutex m_mutex{};

struct InfoForNMS5 {
int64_t max_output_boxes_per_class;
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/template/backend/ops/convolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ template <>
bool evaluate_node<ov::op::v1::Convolution>(std::shared_ptr<ov::Node> node,
ov::TensorVector& outputs,
const ov::TensorVector& inputs) {
auto element_type = node->get_output_element_type(0);
if (ov::is_type<ov::op::v1::Select>(node) || ov::is_type<ov::op::util::BinaryElementwiseComparison>(node))
element_type = node->get_input_element_type(1);
const auto& element_type =
(ov::is_type<ov::op::v1::Select>(node) || ov::is_type<ov::op::util::BinaryElementwiseComparison>(node))
? node->get_input_element_type(1)
: node->get_output_element_type(0);

switch (element_type) {
case ov::element::boolean:
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/template/backend/ops/einsum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ template <>
bool evaluate_node<ov::op::v7::Einsum>(std::shared_ptr<ov::Node> node,
ov::TensorVector& outputs,
const ov::TensorVector& inputs) {
auto element_type = node->get_output_element_type(0);
if (ov::is_type<ov::op::v1::Select>(node) || ov::is_type<ov::op::util::BinaryElementwiseComparison>(node))
element_type = node->get_input_element_type(1);
const auto& element_type =
(ov::is_type<ov::op::v1::Select>(node) || ov::is_type<ov::op::util::BinaryElementwiseComparison>(node))
? node->get_input_element_type(1)
: node->get_output_element_type(0);

switch (element_type) {
case ov::element::boolean:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ bool evaluate(const std::shared_ptr<ov::op::v6::ExperimentalDetectronGeneratePro

const auto output_type = op->get_input_element_type(0);

const auto im_info_shape = inputs[0].get_shape();
const auto anchors_shape = inputs[1].get_shape();
const auto deltas_shape = inputs[2].get_shape();
const auto scores_shape = inputs[3].get_shape();
const auto& im_info_shape = inputs[0].get_shape();
const auto& anchors_shape = inputs[1].get_shape();
const auto& deltas_shape = inputs[2].get_shape();
const auto& scores_shape = inputs[3].get_shape();

const auto im_info_data = get_floats(inputs[0], im_info_shape);
const auto anchors_data = get_floats(inputs[1], anchors_shape);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ InfoForEDROIFeature get_info_for_ed_roi_feature(

out_shape[1] = input_shapes[1][1];

result.output_rois_features_shape = out_shape;
result.output_rois_shape = out_rois_shape;
result.output_rois_features_shape = std::move(out_shape);
result.output_rois_shape = std::move(out_rois_shape);

return result;
}
Expand All @@ -45,7 +45,7 @@ bool evaluate(const std::shared_ptr<ov::op::v6::ExperimentalDetectronROIFeatureE
std::vector<std::vector<float>> input_data;
std::vector<ov::Shape> input_shapes;
for (const auto& input : inputs) {
const auto current_shape = input.get_shape();
const auto& current_shape = input.get_shape();
input_data.push_back(get_floats(input, current_shape));
input_shapes.push_back(current_shape);
}
Expand Down
12 changes: 5 additions & 7 deletions src/plugins/template/backend/ops/if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,15 @@ bool call(ov::TensorVector& func_outputs,
std::vector<ov::Tensor> op_outputs;
for (size_t i = 0; i < op->get_output_size(); ++i) {
ov::descriptor::Tensor* tensor = &op->output(i).get_tensor();
ov::Tensor host_tensor;
auto it = tensor_map.find(tensor);
if (ov::op::util::is_output(op)) {
host_tensor = func_outputs[results_map[op]];
op_outputs.push_back(func_outputs[results_map[op]]);
} else if (it == tensor_map.end()) {
host_tensor = ov::Tensor(op->output(i));
tensor_map.insert({tensor, host_tensor});
const auto& h_tensor = op_outputs.emplace_back(op->output(i));
tensor_map.insert({tensor, h_tensor});
} else {
host_tensor = it->second;
op_outputs.push_back(it->second);
}
op_outputs.push_back(host_tensor);
}
op->validate_and_infer_types();
if (!op->evaluate(op_outputs, op_inputs)) {
Expand Down Expand Up @@ -137,7 +135,7 @@ void if_reference(const std::vector<std::shared_ptr<ov::Model>>& bodies,
OPENVINO_ASSERT(output_size > out_descr->m_output_index,
"Incorrect associating! If has not output with id ",
out_descr->m_output_index);
auto res = outs_from_body[out_descr->m_body_value_index];
const auto& res = outs_from_body[out_descr->m_body_value_index];

res.copy_to(out[out_descr->m_output_index]);
}
Expand Down
10 changes: 6 additions & 4 deletions src/plugins/template/backend/ops/interpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ bool evaluate_interpolate(const std::shared_ptr<ov::op::v4::Interpolate>& op,
});

// Use v4 shape inference
const auto output_shape =
ov::op::v4::shape_infer(op.get(), input_shapes, m_attrs.pads_begin, m_attrs.pads_end, ta).front();
const auto output_shapes =
ov::op::v4::shape_infer(op.get(), input_shapes, m_attrs.pads_begin, m_attrs.pads_end, ta);
const auto& output_shape = output_shapes.front();

Shape padded_input_shape;
for (size_t i = 0; i < input_shape.size(); ++i) {
Expand Down Expand Up @@ -306,8 +307,9 @@ bool evaluate_interpolate(const std::shared_ptr<ov::op::v11::Interpolate>& op,
std::transform(inputs.cbegin(), inputs.cend(), std::back_inserter(input_shapes), [](const ov::Tensor& ht) {
return ht.get_shape();
});
const auto output_shape =
ov::op::v11::shape_infer(op.get(), input_shapes, m_attrs.pads_begin, m_attrs.pads_end, ta).front();
const auto output_shapes =
ov::op::v11::shape_infer(op.get(), input_shapes, m_attrs.pads_begin, m_attrs.pads_end, ta);
const auto& output_shape = output_shapes.front();

Shape padded_input_shape;
for (size_t i = 0; i < input_shape.size(); ++i) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/template/backend/ops/irdft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ InfoForIRFFT9 get_info_for_irfft9_eval(const ov::TensorVector& inputs) {

result.fft_output_shape = fft_output_shape;
result.output_shape = output_shape;
result.axes_data = canonicalized_axes;
result.axes_data = std::move(canonicalized_axes);

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/template/backend/ops/rdft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ InfoForRFFT9 get_info_for_rfft9_eval(const ov::TensorVector& inputs) {
result.fft_output_shape = fft_output_shape;
result.output_shape = output_shape;

result.axes_data = canonicalized_axes;
result.axes_data = std::move(canonicalized_axes);

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ class AttachCacheManagerToPagedAttention : public ov::pass::MatcherPass {

auto pa_pattern = pattern::wrap_type<ov::op::PagedAttentionExtension>();

auto shared_handle = std::make_shared<CacheManagerHandle>();
auto shared_dtype = std::make_shared<ov::element::Type>();

ov::matcher_pass_callback callback = [shared_handle, shared_dtype](pattern::Matcher& m) -> bool {
ov::matcher_pass_callback callback = [shared_handle = std::make_shared<CacheManagerHandle>(),
shared_dtype =
std::make_shared<ov::element::Type>()](pattern::Matcher& m) -> bool {
auto pa = std::dynamic_pointer_cast<ov::op::PagedAttentionExtension>(m.get_match_root());
if (!pa || get_cache_manager(pa.get()) != nullptr)
return false;
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/template/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ std::shared_ptr<ov::Model> get_ov_model_from_blob(const ov::template_plugin::Plu
size_t offset,
const ov::AnyMap& properties) {
if (auto blob_it = properties.find(ov::hint::compiled_blob.name()); blob_it != properties.end()) {
if (auto blob = blob_it->second.as<ov::Tensor>(); blob) {
if (const auto& blob = blob_it->second.as<ov::Tensor>(); blob) {
ov::SharedStreamBuffer shared_buffer(blob.data(), blob.get_byte_size());
std::istream blob_stream(&shared_buffer);
blob_stream.seekg(offset, std::ios::beg);
Expand Down Expand Up @@ -260,7 +260,6 @@ std::shared_ptr<ov::ICompiledModel> ov::template_plugin::Plugin::import_model(
if (auto m = model_hint->second.as<std::shared_ptr<ov::Model>>()) {
if (m->has_rt_info("__weights_path")) {
AnyMap rt_info;
auto p = m->get_rt_info<std::string>("__weights_path");
rt_info[ov::weights_path.name()] = m->get_rt_info<ov::Any>("__weights_path");
weights = get_model_weights(rt_info);
}
Expand Down
Loading