Remove ngraph function (#22436)
This commit is contained in:
parent
aefe19ca89
commit
aed3568d07
|
|
@ -18,7 +18,7 @@ namespace device {
|
|||
|
||||
class ConvertOpSet1ToDeviceSpecific: public ov::pass::ModelPass {
|
||||
public:
|
||||
bool run_on_model(const std::shared_ptr<ngraph::Function>& f) override {
|
||||
bool run_on_model(const std::shared_ptr<ov::Model>& f) override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED)
|
||||
# define NGRAPH_LEGACY_HEADER_INCLUDED
|
||||
# ifdef _MSC_VER
|
||||
# pragma message( \
|
||||
"The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# else
|
||||
# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "ngraph/ngraph_visibility.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/op/parameter.hpp"
|
||||
#include "openvino/core/model.hpp"
|
||||
#include "openvino/op/util/variable.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
using Function = ov::Model;
|
||||
} // namespace ngraph
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include "ngraph/check.hpp"
|
||||
#include "ngraph/function.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "openvino/core/graph_util.hpp"
|
||||
|
||||
|
|
@ -207,7 +206,7 @@ bool is_valid_rank(const std::shared_ptr<Node>& node, std::vector<size_t> valid_
|
|||
|
||||
NGRAPH_API_DEPRECATED
|
||||
NGRAPH_API
|
||||
void plot_graph(std::shared_ptr<Function> f,
|
||||
void plot_graph(std::shared_ptr<ov::Model> f,
|
||||
const std::string& filename,
|
||||
std::function<void(const Node& node, std::vector<std::string>& attributes)> = nullptr);
|
||||
|
||||
|
|
@ -227,7 +226,7 @@ std::vector<ov::Output<Node>> get_outputs_to(Node& src, Node& dst);
|
|||
/// It returns true if a cycle is found and the first cycle encountered.
|
||||
NGRAPH_API_DEPRECATED
|
||||
NGRAPH_API
|
||||
bool check_for_cycles(const ngraph::Function* func, ngraph::NodeVector& cycle_nodes, bool& is_bkwd_cycle);
|
||||
bool check_for_cycles(const ov::Model* func, ngraph::NodeVector& cycle_nodes, bool& is_bkwd_cycle);
|
||||
} // namespace ngraph
|
||||
|
||||
using ngraph::replace_node;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@
|
|||
#include "ngraph/evaluator.hpp"
|
||||
#include "ngraph/except.hpp"
|
||||
#include "ngraph/factory.hpp"
|
||||
#include "ngraph/function.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/partial_shape.hpp"
|
||||
#include "ngraph/rt_info.hpp"
|
||||
|
|
|
|||
|
|
@ -14,11 +14,17 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#include "ngraph/function.hpp"
|
||||
#include <memory>
|
||||
|
||||
#include "ngraph/deprecated.hpp"
|
||||
#include "ngraph/ngraph_visibility.hpp"
|
||||
#include "openvino/core/model.hpp"
|
||||
#include "openvino/core/shape.hpp"
|
||||
#include "openvino/core/type.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
/// \brief Creates a "specialized" clone of a function. The partial shapes and element types of
|
||||
/// the function's parameters may be narrowed to more specific shapes and element types,
|
||||
/// the function's parameters may be narrowed to more specific shapes and element type
|
||||
/// and constant values may optionally be substituted for any or all of the parameters.
|
||||
/// \param f The function to be cloned.
|
||||
/// \param parameter_element_types The new parameter element types to substitute. Length must
|
||||
|
|
@ -101,8 +107,8 @@ namespace ngraph {
|
|||
///
|
||||
NGRAPH_API_DEPRECATED
|
||||
NGRAPH_API
|
||||
std::shared_ptr<Function> specialize_function(std::shared_ptr<Function> f,
|
||||
const std::vector<ov::element::Type>& parameter_element_types,
|
||||
const std::vector<ov::PartialShape>& parameter_shapes,
|
||||
const std::vector<void*>& parameter_values);
|
||||
std::shared_ptr<ov::Model> specialize_function(std::shared_ptr<ov::Model> f,
|
||||
const std::vector<ov::element::Type>& parameter_element_types,
|
||||
const std::vector<ov::PartialShape>& parameter_shapes,
|
||||
const std::vector<void*>& parameter_values);
|
||||
} // namespace ngraph
|
||||
|
|
|
|||
|
|
@ -520,8 +520,8 @@ std::pair<std::shared_ptr<ov::op::v0::Result>, std::shared_ptr<ov::op::v0::Param
|
|||
}
|
||||
|
||||
// Make parameter node
|
||||
std::shared_ptr<op::Parameter> par_node =
|
||||
std::make_shared<op::Parameter>(src_node->get_output_element_type(0), src_node->get_output_shape(0));
|
||||
std::shared_ptr<ov::op::v0::Parameter> par_node =
|
||||
std::make_shared<ov::op::v0::Parameter>(src_node->get_output_element_type(0), src_node->get_output_shape(0));
|
||||
|
||||
// Fix input / output among src, dst and par
|
||||
std::vector<ov::Input<Node>> dst_inputs = get_inputs_from(*src_node, *dst_node);
|
||||
|
|
@ -720,7 +720,7 @@ bool is_valid_rank(const std::shared_ptr<Node>& node, std::vector<size_t> valid_
|
|||
return false;
|
||||
}
|
||||
|
||||
void plot_graph(std::shared_ptr<Function> f,
|
||||
void plot_graph(std::shared_ptr<ov::Model> f,
|
||||
const std::string& filename,
|
||||
std::function<void(const Node& node, std::vector<std::string>& attributes)> attributes) {
|
||||
ov::pass::Manager pass_manager;
|
||||
|
|
|
|||
|
|
@ -7,16 +7,17 @@
|
|||
#include "itt.hpp"
|
||||
#include "ngraph/op/util/op_types.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START;
|
||||
|
||||
using ov::op::v0::Constant;
|
||||
|
||||
std::shared_ptr<Function> ngraph::specialize_function(std::shared_ptr<Function> f,
|
||||
const std::vector<ov::element::Type>& parameter_element_types,
|
||||
const std::vector<ov::PartialShape>& parameter_shapes,
|
||||
const std::vector<void*>& parameter_values)
|
||||
std::shared_ptr<ov::Model> ngraph::specialize_function(std::shared_ptr<ov::Model> f,
|
||||
const std::vector<ov::element::Type>& parameter_element_types,
|
||||
const std::vector<ov::PartialShape>& parameter_shapes,
|
||||
const std::vector<void*>& parameter_values)
|
||||
|
||||
{
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::core, "specialize_function");
|
||||
|
|
@ -38,7 +39,7 @@ std::shared_ptr<Function> ngraph::specialize_function(std::shared_ptr<Function>
|
|||
parameter_values[i]);
|
||||
} else {
|
||||
m[f->get_parameters()[i].get()] =
|
||||
std::make_shared<op::Parameter>(parameter_element_types[i], parameter_shapes[i]);
|
||||
std::make_shared<ov::op::v0::Parameter>(parameter_element_types[i], parameter_shapes[i]);
|
||||
}
|
||||
auto rt_info = f->get_parameters()[i]->get_rt_info();
|
||||
m[f->get_parameters()[i].get()]->get_rt_info() = rt_info;
|
||||
|
|
@ -70,16 +71,17 @@ std::shared_ptr<Function> ngraph::specialize_function(std::shared_ptr<Function>
|
|||
m[old_node.get()]->set_friendly_name(old_node->get_friendly_name());
|
||||
}
|
||||
|
||||
ParameterVector new_parameters = f->get_parameters();
|
||||
ov::ParameterVector new_parameters = f->get_parameters();
|
||||
for (size_t i = 0; i < new_parameters.size(); i++) {
|
||||
auto name = new_parameters[i]->get_friendly_name();
|
||||
new_parameters[i] = ov::as_type_ptr<op::Parameter>(m[new_parameters[i].get()]);
|
||||
new_parameters[i] = ov::as_type_ptr<ov::op::v0::Parameter>(m[new_parameters[i].get()]);
|
||||
|
||||
// If the replacement for a Parameter is not itself a Parameter, we must have replaced it
|
||||
// with a constant. We will insert a dead Parameter into the clone's parameters, in order
|
||||
// to maintain the arity of the original function.
|
||||
if (new_parameters[i] == nullptr) {
|
||||
new_parameters[i] = std::make_shared<op::Parameter>(parameter_element_types[i], parameter_shapes[i]);
|
||||
new_parameters[i] =
|
||||
std::make_shared<ov::op::v0::Parameter>(parameter_element_types[i], parameter_shapes[i]);
|
||||
}
|
||||
new_parameters[i]->set_friendly_name(name);
|
||||
}
|
||||
|
|
@ -95,5 +97,5 @@ std::shared_ptr<Function> ngraph::specialize_function(std::shared_ptr<Function>
|
|||
new_sinks[i] = std::static_pointer_cast<ov::op::Sink>(m[new_sinks[i].get()]);
|
||||
}
|
||||
|
||||
return std::make_shared<Function>(new_results, new_sinks, new_parameters);
|
||||
return std::make_shared<ov::Model>(new_results, new_sinks, new_parameters);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ TEST(specialize_function, et_shape_static) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ TEST(specialize_function, et_dynamic_shape_static) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ TEST(specialize_function, et_static_shape_rank_dynamic) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ TEST(specialize_function, et_static_shape_rank_static_dynamic) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ TEST(specialize_function, et_static_shape_rank_static_dynamic_subst_val) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<int32_t> p1_subst_vals{5, 0, 3, 8, 5, 8};
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ TEST(specialize_function, et_static_shape_rank_dynamic_validation_fails) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ TEST(specialize_function, et_dynamic_shape_static_validation_fails) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ TEST(specialize_function, et_static_shape_rank_static_dynamic_rank_mismatch) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ TEST(specialize_function, et_static_shape_rank_static_dynamic_dim_mismatch) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ TEST(specialize_function, et_count_wrong) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ TEST(specialize_function, shape_count_wrong) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr};
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ TEST(specialize_function, value_count_wrong) {
|
|||
auto k = std::make_shared<Convert>(p1, element::f32);
|
||||
auto a = std::make_shared<Add>(p0, k);
|
||||
|
||||
auto f = std::make_shared<Function>(a, ParameterVector{p0, p1});
|
||||
auto f = std::make_shared<ov::Model>(a, ov::ParameterVector{p0, p1});
|
||||
|
||||
std::vector<void*> param_vals{nullptr, nullptr, nullptr};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
#include <string>
|
||||
|
||||
#include "ngraph/deprecated.hpp"
|
||||
#include "ngraph/function.hpp"
|
||||
#include "onnx_importer_visibility.hpp"
|
||||
#include "openvino/core/model.hpp"
|
||||
|
||||
/// \brief Top level nGraph namespace.
|
||||
namespace ngraph {
|
||||
|
|
@ -64,9 +64,9 @@ NGRAPH_API_DEPRECATED ONNX_IMPORTER_API bool is_operator_supported(const std::st
|
|||
/// \param[in] enable_mmap Enable mapping files with external weights instead of reading.
|
||||
///
|
||||
/// \return An nGraph function that represents a single output from the created graph.
|
||||
NGRAPH_API_DEPRECATED ONNX_IMPORTER_API std::shared_ptr<Function> import_onnx_model(std::istream& stream,
|
||||
const std::string& model_path = "",
|
||||
bool enable_mmap = false);
|
||||
NGRAPH_API_DEPRECATED ONNX_IMPORTER_API std::shared_ptr<ov::Model> import_onnx_model(std::istream& stream,
|
||||
const std::string& model_path = "",
|
||||
bool enable_mmap = false);
|
||||
|
||||
/// \brief Imports and converts an ONNX model from the input file
|
||||
/// to an nGraph Function representation.
|
||||
|
|
@ -79,8 +79,8 @@ NGRAPH_API_DEPRECATED ONNX_IMPORTER_API std::shared_ptr<Function> import_onnx_mo
|
|||
/// \param[in] enable_mmap Enable mapping files with external weights instead of reading.
|
||||
///
|
||||
/// \return An nGraph function that represents a single output from the created graph.
|
||||
NGRAPH_API_DEPRECATED ONNX_IMPORTER_API std::shared_ptr<Function> import_onnx_model(const std::string& file_path,
|
||||
bool enable_mmap = false);
|
||||
NGRAPH_API_DEPRECATED ONNX_IMPORTER_API std::shared_ptr<ov::Model> import_onnx_model(const std::string& file_path,
|
||||
bool enable_mmap = false);
|
||||
} // namespace onnx_import
|
||||
|
||||
} // namespace ngraph
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
detail::MappedMemoryHandles get_mmap_cache() const {
|
||||
return m_mmap_cache;
|
||||
}
|
||||
const ParameterVector& get_ng_parameters() const {
|
||||
const ov::ParameterVector& get_ng_parameters() const {
|
||||
return m_parameters;
|
||||
}
|
||||
virtual bool is_ov_node_in_cache(const std::string& name) const;
|
||||
|
|
@ -82,7 +82,7 @@ protected:
|
|||
void set_metadata(std::shared_ptr<ov::Model>& model) const;
|
||||
std::shared_ptr<ov::Model> create_model();
|
||||
|
||||
ParameterVector m_parameters;
|
||||
ov::ParameterVector m_parameters;
|
||||
std::unique_ptr<Model> m_model;
|
||||
std::unique_ptr<GraphCache> m_cache;
|
||||
ov::frontend::ExtensionHolder m_extensions = {};
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public:
|
|||
return ov::element::dynamic;
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> get_ov_node(ParameterVector& parameters,
|
||||
std::shared_ptr<ov::Node> get_ov_node(ov::ParameterVector& parameters,
|
||||
const std::map<std::string, Tensor>& initializers) const {
|
||||
const auto it = initializers.find(get_name());
|
||||
if (it != std::end(initializers)) {
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ const auto legacy_conversion_extension = std::make_shared<ngraph::onnx_import::L
|
|||
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
std::shared_ptr<Function> import_onnx_model(std::istream& stream,
|
||||
const std::string& model_path,
|
||||
const bool enable_mmap) {
|
||||
std::shared_ptr<ov::Model> import_onnx_model(std::istream& stream,
|
||||
const std::string& model_path,
|
||||
const bool enable_mmap) {
|
||||
const auto model_proto = std::make_shared<ONNX_NAMESPACE::ModelProto>(parse_from_istream(stream));
|
||||
ov::frontend::ExtensionHolder extensions;
|
||||
extensions.conversions.push_back(legacy_conversion_extension);
|
||||
|
|
@ -43,7 +43,7 @@ std::shared_ptr<Function> import_onnx_model(std::istream& stream,
|
|||
return model;
|
||||
}
|
||||
|
||||
std::shared_ptr<Function> import_onnx_model(const std::string& file_path, const bool enable_mmap) {
|
||||
std::shared_ptr<ov::Model> import_onnx_model(const std::string& file_path, const bool enable_mmap) {
|
||||
std::ifstream model_stream{file_path, std::ios::in | std::ios::binary};
|
||||
|
||||
if (!model_stream.is_open()) {
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ OutputVector if_op(const Node& node) {
|
|||
auto then_subgraph = subgraphs.at("then_branch");
|
||||
const auto& then_params = then_subgraph->get_ng_parameters();
|
||||
auto then_branch =
|
||||
std::make_shared<Function>(then_subgraph->get_ov_outputs(), then_params, then_subgraph->get_name());
|
||||
std::make_shared<ov::Model>(then_subgraph->get_ov_outputs(), then_params, then_subgraph->get_name());
|
||||
FRONT_END_GENERAL_CHECK(subgraphs.count("else_branch") == 1, "Missing 'else_branch' attribute");
|
||||
auto else_subgraph = subgraphs.at("else_branch");
|
||||
const auto& else_params = else_subgraph->get_ng_parameters();
|
||||
auto else_branch =
|
||||
std::make_shared<Function>(else_subgraph->get_ov_outputs(), else_params, else_subgraph->get_name());
|
||||
std::make_shared<ov::Model>(else_subgraph->get_ov_outputs(), else_params, else_subgraph->get_name());
|
||||
|
||||
auto if_node = std::make_shared<v8::If>(ng_inputs.at(0));
|
||||
if_node->set_then_body(then_branch);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ OutputVector loop(const Node& node) {
|
|||
") is not greater than number of outputs. Required at least: ",
|
||||
loop_carried_dependencies.size() + 1);
|
||||
|
||||
ParameterVector body_params(body_inputs.begin() + 2, body_inputs.end());
|
||||
ov::ParameterVector body_params(body_inputs.begin() + 2, body_inputs.end());
|
||||
body_params.emplace(body_params.begin(),
|
||||
body_inputs[0]); // current iteration body input
|
||||
const auto body = std::make_shared<ov::Model>(body_outputs, body_params);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include "core/graph.hpp"
|
||||
#include "default_opset.hpp"
|
||||
#include "exceptions.hpp"
|
||||
#include "ngraph/function.hpp"
|
||||
#include "ngraph/op/util/op_types.hpp"
|
||||
#include "onnx_import/core/null_node.hpp"
|
||||
#include "openvino/core/validation_util.hpp"
|
||||
|
|
@ -23,7 +22,7 @@ namespace op {
|
|||
namespace {
|
||||
|
||||
OutputVector scan_to_tensor_iterator(const OutputVector& node_inputs,
|
||||
ParameterVector& body_inputs,
|
||||
ov::ParameterVector& body_inputs,
|
||||
OutputVector& body_outputs,
|
||||
int64_t num_scan_inputs,
|
||||
const std::vector<int64_t>& scan_input_axes,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ using namespace std;
|
|||
using namespace InferenceEngine;
|
||||
using details::CNNNetworkNGraphImpl;
|
||||
using InferenceEngine::details::CNNNetworkNGraphImpl;
|
||||
using ngraph::Function;
|
||||
|
||||
void CNNNetworkNGraphImpl::createDataForResult(const ::ov::Output<::ngraph::Node>& output,
|
||||
const std::string& outName,
|
||||
|
|
@ -124,7 +123,7 @@ ov::element::Type details::toLegacyType(const ov::element::Type& ngraph_type, bo
|
|||
return ngraph_type;
|
||||
}
|
||||
|
||||
CNNNetworkNGraphImpl::CNNNetworkNGraphImpl(const std::shared_ptr<Function>& nGraph, bool newAPI)
|
||||
CNNNetworkNGraphImpl::CNNNetworkNGraphImpl(const std::shared_ptr<ov::Model>& nGraph, bool newAPI)
|
||||
: _ngraph_function(nGraph),
|
||||
_new_api(newAPI) {
|
||||
{
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ InferenceEngine::CNNNetwork ov::legacy_convert::convert_model(const std::shared_
|
|||
std::shared_ptr<const ov::Model> ov::legacy_convert::convert_model(const InferenceEngine::CNNNetwork& network,
|
||||
bool is_new_api) {
|
||||
OPENVINO_ASSERT(network.getFunction(),
|
||||
"CNNNetwork can be converted to OpenVINO Model only in case if it contains ngraph::Function");
|
||||
"CNNNetwork can be converted to OpenVINO Model only in case if it contains ov::Model");
|
||||
if (is_new_api)
|
||||
return network.getFunction();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ auto configs = []() {
|
|||
return std::vector<ov::AnyMap>{{}};
|
||||
};
|
||||
|
||||
std::shared_ptr<ngraph::Function> getFunction1() {
|
||||
std::shared_ptr<ov::Model> getFunction1() {
|
||||
const std::vector<size_t> inputShape = {1, 4, 20, 20};
|
||||
const ov::element::Type_t ngPrc = ov::element::Type_t::f32;
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ std::shared_ptr<ngraph::Function> getFunction1() {
|
|||
auto relu = std::make_shared<ov::op::v0::Relu>(params[0]);
|
||||
relu->get_output_tensor(0).set_names({"relu"});
|
||||
|
||||
return std::make_shared<ngraph::Function>(relu, params, "SimpleActivation");
|
||||
return std::make_shared<ov::Model>(relu, params, "SimpleActivation");
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests_1, OVInferRequestDynamicTests,
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ void TopKLayerTestGPU::SetUp() {
|
|||
for (size_t i = 0; i < topk->get_output_size(); i++) {
|
||||
results.push_back(std::make_shared<ov::op::v0::Result>(topk->output(i)));
|
||||
}
|
||||
function = std::make_shared<ngraph::Function>(results, params, "TopK");
|
||||
function = std::make_shared<ov::Model>(results, params, "TopK");
|
||||
}
|
||||
|
||||
InferenceEngine::Blob::Ptr TopKLayerTestGPU::GenerateInput(const InferenceEngine::InputInfo& info) const {
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ void LayerTestsCommon::SetRefMode(RefMode mode) {
|
|||
refMode = mode;
|
||||
}
|
||||
|
||||
std::shared_ptr<ngraph::Function> LayerTestsCommon::GetFunction() {
|
||||
std::shared_ptr<ov::Model> LayerTestsCommon::GetFunction() {
|
||||
return function;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ void MatrixNmsLayerTest::SetUp() {
|
|||
}
|
||||
auto nms = std::make_shared<ov::op::v8::MatrixNms>(params[0], params[1], m_attrs);
|
||||
|
||||
function = std::make_shared<Function>(nms, params, "MatrixNMS");
|
||||
function = std::make_shared<ov::Model>(nms, params, "MatrixNMS");
|
||||
}
|
||||
|
||||
} // namespace subgraph
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ void MemoryTest::CreateTIFunc() {
|
|||
auto add = std::make_shared<Add>(X, Y);
|
||||
auto res = std::make_shared<Result>(add);
|
||||
auto Iter_res = std::make_shared<Result>(Iter);
|
||||
auto body = std::make_shared<Function>(OutputVector{res, Iter_res}, ParameterVector{X, Y, Iter});
|
||||
auto body = std::make_shared<ov::Model>(OutputVector{res, Iter_res}, ov::ParameterVector{X, Y, Iter});
|
||||
|
||||
// TI construction
|
||||
auto tensor_iterator = std::make_shared<TensorIterator>();
|
||||
|
|
@ -175,7 +175,7 @@ void MemoryTest::CreateTIFunc() {
|
|||
auto output = tensor_iterator->get_iter_value(res, -1);
|
||||
auto output_iter = tensor_iterator->get_concatenated_slices(Iter_res, 0, 1, 1, -1, 0);
|
||||
function =
|
||||
std::make_shared<Function>(OutputVector{output, output_iter}, ParameterVector{param, iter_count}, "PureTI");
|
||||
std::make_shared<ov::Model>(OutputVector{output, output_iter}, ov::ParameterVector{param, iter_count}, "PureTI");
|
||||
}
|
||||
|
||||
void MemoryTest::CreateCommonFunc() {
|
||||
|
|
@ -188,7 +188,7 @@ void MemoryTest::CreateCommonFunc() {
|
|||
auto add = std::make_shared<ov::op::v1::Add>(read_value, param.at(0));
|
||||
auto assign = CreateAssignOp(add, variable);
|
||||
auto res = std::make_shared<ov::op::v0::Result>(add);
|
||||
function = std::make_shared<Function>(ResultVector{res}, ov::SinkVector{assign}, param, "TestMemory");
|
||||
function = std::make_shared<ov::Model>(ResultVector{res}, ov::SinkVector{assign}, param, "TestMemory");
|
||||
}
|
||||
|
||||
void MemoryTest::ApplyLowLatency() {
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ void MulticlassNmsLayerTest::SetUp() {
|
|||
nms = std::make_shared<ov::op::v9::MulticlassNms>(params[0], params[1], m_attrs);
|
||||
}
|
||||
|
||||
function = std::make_shared<Function>(nms, params, "MulticlassNMS");
|
||||
function = std::make_shared<ov::Model>(nms, params, "MulticlassNMS");
|
||||
}
|
||||
|
||||
} // namespace subgraph
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ void NmsLayerTest::SetUp() {
|
|||
auto ngPrc = convertIE2nGraphPrc(paramsPrec);
|
||||
ov::ParameterVector params {std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(boxesShape)),
|
||||
std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(scoresShape))};
|
||||
auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes<op::Parameter>(params));
|
||||
auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes<ov::op::v0::Parameter>(params));
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
auto nms = builder::makeNms(paramOuts[0],
|
||||
|
|
@ -330,7 +330,7 @@ void NmsLayerTest::SetUp() {
|
|||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
if (targetDevice == ov::test::utils::DEVICE_CPU) {
|
||||
function = std::make_shared<Function>(nms, params, "NMS");
|
||||
function = std::make_shared<ov::Model>(nms, params, "NMS");
|
||||
} else {
|
||||
auto nms_0_identity =
|
||||
std::make_shared<ov::op::v1::Multiply>(nms->output(0), ov::op::v0::Constant::create(outType, Shape{1}, {1}));
|
||||
|
|
@ -342,7 +342,7 @@ void NmsLayerTest::SetUp() {
|
|||
nms_1_identity->set_friendly_name("Multiply_1");
|
||||
nms_2_identity->set_friendly_name("Multiply_2");
|
||||
function =
|
||||
std::make_shared<Function>(OutputVector{nms_0_identity, nms_1_identity, nms_2_identity}, params, "NMS");
|
||||
std::make_shared<ov::Model>(OutputVector{nms_0_identity, nms_1_identity, nms_2_identity}, params, "NMS");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -374,7 +374,7 @@ void Nms9LayerTest::SetUp() {
|
|||
auto ngPrc = convertIE2nGraphPrc(paramsPrec);
|
||||
ov::ParameterVector params {std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(boxesShape)),
|
||||
std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(scoresShape))};
|
||||
auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes<op::Parameter>(params));
|
||||
auto paramOuts = helpers::convert2OutputVector(helpers::castOps2Nodes<ov::op::v0::Parameter>(params));
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
auto nms = builder::makeNms(paramOuts[0],
|
||||
|
|
@ -391,7 +391,7 @@ void Nms9LayerTest::SetUp() {
|
|||
ngraph::builder::NmsVersion::NmsVersion9);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
function = std::make_shared<Function>(nms, params, "NMS");
|
||||
function = std::make_shared<ov::Model>(nms, params, "NMS");
|
||||
}
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void RandomUniformLayerTest::SetUp() {
|
|||
op_seed);
|
||||
ngraph::ResultVector results{std::make_shared<ov::op::v0::Result>(random_uniform)};
|
||||
|
||||
function = std::make_shared<ngraph::Function>(results, ngraph::ParameterVector{input}, "random_uniform");
|
||||
function = std::make_shared<ov::Model>(results, ngraph::ParameterVector{input}, "random_uniform");
|
||||
}
|
||||
|
||||
void RandomUniformLayerTest::ConvertRefsParams() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue