Removed legacy names and environment variables from the code (#10195)

* Removed legacy names and environment variables from the code

* Support documented legacy variables

* Fixed core unit tests

* Fixed some test
This commit is contained in:
Ilya Churaev authored and GitHub committed 2022-02-09 11:04:25 +03:00
1 parent 532a1da548
commit 9d40c5184f
24 files changed
+108 -154

No files matched your search

+8 -4
View File
@@ -392,8 +392,12 @@ Usage example:
`ngraph::pass::VisualizeTree` can be parametrized via environment variables:
```
NGRAPH_VISUALIZE_TREE_OUTPUT_SHAPES=1 - visualize shapes
NGRAPH_VISUALIZE_TREE_OUTPUT_TYPES=1 - visualize types
OV_VISUALIZE_TREE_OUTPUT_SHAPES=1 - visualize shapes
OV_VISUALIZE_TREE_OUTPUT_TYPES=1 - visualize types
OV_VISUALIZE_TREE_MIN_MAX_DENORMAL=1 - pretty denormal values
OV_VISUALIZE_TREE_RUNTIME_INFO=1 - print runtime information
OV_VISUALIZE_TREE_IO=1 - print I/O ports
OV_VISUALIZE_TREE_MEMBERS_NAME=1 - print member names
```
> **Note**: current VisualTree does not have user-friendly interface and it will be changed in the nearest future. The intention is to move visualization abilities inside transformations.
@@ -401,8 +405,8 @@ NGRAPH_VISUALIZE_TREE_OUTPUT_TYPES=1 - visualize types
If you are using `ngraph::pass::Manager` to run sequence of transformations, you can get additional debug capabilities by using the following environment variables:
```
NGRAPH_PROFILE_PASS_ENABLE=1 - enables performance measurement for each transformation and prints execution status
NGRAPH_ENABLE_VISUALIZE_TRACING=1 - enables visualization after each transformation. By default, it saves dot and svg files.
OV_PROFILE_PASS_ENABLE=1 - enables performance measurement for each transformation and prints execution status
OV_ENABLE_VISUALIZE_TRACING=1 - enables visualization after each transformation. By default, it saves dot and svg files.
```
> **Note**: Make sure that you have dot installed on your machine; otherwise, it will silently save only dot file without svg file.
+1 -6
View File
@@ -11,12 +11,7 @@ using namespace std;
// Constructor
runtime::LRUCache::LRUCache() {
int32_t cache_size = getenv_int("NGRAPH_CACHE_SIZE");
if (cache_size <= 0) {
m_cache_size = 1024; // TODO(nbpatel): Figure out a default size for the cache
} else {
m_cache_size = cache_size;
}
m_cache_size = 1024;
m_map = {};
m_list = {};
+45 -45
View File
@@ -34,7 +34,7 @@ class FrontEnd;
}
class ModelAccessor;
/// A user-defined function.
/// A user-defined model.
class OPENVINO_API Model : public std::enable_shared_from_this<Model> {
friend class frontend::FrontEnd;
friend OPENVINO_API std::shared_ptr<Model> clone_model(const Model& func,
@@ -43,7 +43,7 @@ class OPENVINO_API Model : public std::enable_shared_from_this<Model> {
public:
static const ::ov::DiscreteTypeInfo& get_type_info_static() {
static const ::ov::DiscreteTypeInfo type_info{"Function", 0};
static const ::ov::DiscreteTypeInfo type_info{"Model", 0};
return type_info;
}
const ::ov::DiscreteTypeInfo& get_type_info() const {
@@ -92,22 +92,22 @@ public:
const ov::op::util::VariableVector& variables,
const std::string& name = "");
/// Constructs a Function. Lists of parameters and variables will be generated automatically
/// Constructs a Model. Lists of parameters and variables will be generated automatically
/// based on traversing the graph from the results.
explicit Model(const ov::OutputVector& results, const std::string& name = "");
/// Constructs a Function. Lists of parameters and variables will be generated automatically
/// Constructs a Model. Lists of parameters and variables will be generated automatically
/// based on traversing the graph from the results and the sinks.
Model(const ov::OutputVector& results, const ov::SinkVector& sinks, const std::string& name = "");
virtual ~Model() = default;
/// Return the number of outputs for this function.
/// Return the number of outputs for this Model.
size_t get_output_size() const;
/// Return the op that generates output i
std::shared_ptr<ov::Node> get_output_op(size_t i) const;
/// Output functions
/// Model outputs
std::vector<ov::Output<ov::Node>> outputs();
ov::Output<ov::Node> output();
ov::Output<ov::Node> output(size_t i);
@@ -116,7 +116,7 @@ public:
ov::Output<const ov::Node> output() const;
ov::Output<const ov::Node> output(size_t i) const;
ov::Output<const ov::Node> output(const std::string& tensor_name) const;
/// Input functions
/// Model inputs
std::vector<ov::Output<ov::Node>> inputs();
ov::Output<ov::Node> input();
ov::Output<ov::Node> input(size_t i);
@@ -147,19 +147,19 @@ public:
/// Check that there is a single result and return it.
std::shared_ptr<ov::Node> get_result() const;
/// \brief Get the unique name of the function.
/// \returns A const reference to the function's unique name.
/// \brief Get the unique name of the model.
/// \returns A const reference to the model's unique name.
const std::string& get_name() const;
/// \brief Sets a friendly name for a function. This does not overwrite the unique name
/// of the function and is retrieved via get_friendly_name(). Used mainly for
/// \brief Sets a friendly name for a model. This does not overwrite the unique name
/// of the model and is retrieved via get_friendly_name(). Used mainly for
/// debugging.
/// \param name is the friendly name to set
void set_friendly_name(const std::string& name);
/// \brief Gets the friendly name for a function. If no friendly name has been set via
/// set_friendly_name then the function's unique name is returned.
/// \returns A const reference to the function's friendly name.
/// \brief Gets the friendly name for a model. If no friendly name has been set via
/// set_friendly_name then the model's unique name is returned.
/// \returns A const reference to the model's friendly name.
const std::string& get_friendly_name() const;
std::vector<std::shared_ptr<ov::Node>> get_ops() const;
@@ -176,13 +176,13 @@ public:
/// graphs and should not be considered the actual memory consumption of a graph.
size_t get_graph_size() const;
/// \brief Returns true if any of the op's defined in the function contains partial shape
/// \brief Returns true if any of the op's defined in the model contains partial shape
bool is_dynamic() const;
/// \brief Replace the `parameter_index`th parameter of the function with `parameter`.
/// \brief Replace the `parameter_index`th parameter of the model with `parameter`.
///
/// All users of the `parameter_index`th parameter are redirected to `parameter`, and the
/// `parameter_index`th entry in the function parameter list is replaced with `parameter`.
/// `parameter_index`th entry in the model parameter list is replaced with `parameter`.
///
/// \param parameter_index The index of the parameter to replace.
/// \param parameter The parameter to substitute for the `parameter_index`th parameter.
@@ -194,49 +194,49 @@ public:
virtual bool visit_attributes(ov::AttributeVisitor& visitor);
/// Return the function parameters
/// Return the model parameters
const ov::ParameterVector& get_parameters() const {
return m_parameters;
};
/// Return a list of function's outputs
/// Return a list of model's outputs
const ov::ResultVector& get_results() const {
return m_results;
};
/// Index for parameter, or -1
int64_t get_parameter_index(const std::shared_ptr<ov::op::v0::Parameter>& parameter) const;
/// \brief Return the index of this function's Result represented by the "value" Output object.
/// This method returns -1 if an the passed output is not related to the Results of a function.
/// \brief Return the index of this model's Result represented by the "value" Output object.
/// This method returns -1 if an the passed output is not related to the Results of a model.
/// \param value Output containing Node
int64_t get_result_index(const ov::Output<ov::Node>& value) const;
/// \brief Return the index of this function's Result represented by the "value" Output object.
/// This method returns -1 if an the passed output is not related to the Results of a function.
/// \brief Return the index of this model's Result represented by the "value" Output object.
/// This method returns -1 if an the passed output is not related to the Results of a model.
/// \param value Output containing Node
int64_t get_result_index(const ov::Output<const ov::Node>& value) const;
/// \deprecated Use evaluate with ov::Tensor instead
/// \brief Evaluate the function on inputs, putting results in outputs.
/// \brief Evaluate the model on inputs, putting results in outputs.
/// \param output_tensors Tensors for the outputs to compute. One for each result
/// \param input_tensors Tensors for the inputs. One for each inputs.
/// \param evaluation_context Storage of additional settings and attributes that can be used
/// when evaluating the function. This additional information can be shared across nodes.
/// when evaluating the model. This additional information can be shared across nodes.
OPENVINO_DEPRECATED(
"This method is deprecated and will be removed soon. Please use evaluate with ov::Tensor instead.")
bool evaluate(const ov::HostTensorVector& output_tensors,
const ov::HostTensorVector& input_tensors,
ov::EvaluationContext evaluation_context = ov::EvaluationContext()) const;
/// \brief Evaluate the function on inputs, putting results in outputs.
/// \brief Evaluate the model on inputs, putting results in outputs.
/// \param output_tensors Tensors for the outputs to compute. One for each result
/// \param input_tensors Tensors for the inputs. One for each inputs.
/// \param evaluation_context Storage of additional settings and attributes that can be used
/// when evaluating the function. This additional information can be shared across nodes.
/// when evaluating the model. This additional information can be shared across nodes.
bool evaluate(ov::TensorVector& output_tensors,
const ov::TensorVector& input_tensors,
ov::EvaluationContext evaluation_context = ov::EvaluationContext()) const;
/// \brief Return a list of function's sinks.
/// \brief Return a list of model's sinks.
const ov::SinkVector& get_sinks() const {
return m_sinks;
}
@@ -296,7 +296,7 @@ public:
/// \param variable Variable to delete
void remove_variable(const ov::op::util::Variable::Ptr& variable);
/// \brief Return a list of function's variables.
/// \brief Return a list of model's variables.
const ov::op::util::VariableVector& get_variables() const {
return m_variables;
}
@@ -319,12 +319,12 @@ private:
friend class ov::ModelAccessor;
/// \brief Depending on the options selected,
/// checks all the Parameter/Variables are registered in the list of Function
/// parameters/variables or finds all Parameters/Variables in a function and registers them.
/// \param detect_variables If this flag is true, then it finds all Variables in a function
/// checks all the Parameter/Variables are registered in the list of Model
/// parameters/variables or finds all Parameters/Variables in a model and registers them.
/// \param detect_variables If this flag is true, then it finds all Variables in a model
/// and registers them, otherwise checks all the Variables are registered.
/// \param detect_parameters If this flag is true, then it finds all Parameters in a
/// function and registers them, otherwise checks all the Parameters are registered.
/// model and registers them, otherwise checks all the Parameters are registered.
void prerequirements(bool detect_variables, bool detect_parameters);
static std::atomic<size_t> m_next_instance_id;
@@ -362,43 +362,43 @@ class OPENVINO_API AttributeAdapter<std::shared_ptr<ov::Model>>
public:
AttributeAdapter(std::shared_ptr<ov::Model>& value) : DirectValueAccessor<std::shared_ptr<ov::Model>>(value) {}
OPENVINO_RTTI("AttributeAdapter<std::shared_ptr<Function>");
OPENVINO_RTTI("AttributeAdapter<std::shared_ptr<Model>");
BWDCMP_RTTI_DECLARATION;
};
/// \brief Helper method to get associated batch size for a Function
/// \details Checks layout of each parameter in a Function and extracts value for N (B) dimension. All values are then
/// \brief Helper method to get associated batch size for a Model
/// \details Checks layout of each parameter in a Model and extracts value for N (B) dimension. All values are then
/// merged and returned
///
/// \throws ::ov::AssertFailure with details in case of error. Possible errors are:
/// * There is no parameter with layout set. Function shall have at least one parameter with layout with 'N' dimension.
/// * There is no parameter with layout set. Model shall have at least one parameter with layout with 'N' dimension.
/// Recommended fix is to use `Parameter::set_layout` API, e.g.
/// `function->get_parameters()[some_index]->set_layout("NCHW");`
/// `model->get_parameters()[some_index]->set_layout("NCHW");`
/// * Several parameters have conflicting N dimension, e.g. param1 NCHW{1,3,224,224} and param2 NCHW{2,3,224,224}. This
/// is ambiguous, most probably first dimension is incorrectly marked as 'batch' (N) in some layout. User shall
///// fix it before using of 'get_batch' (in example above correct layout for param2 from 'NCHW' to 'CHWN')
///
/// \param f function where to look for a batch_size value
/// \param f Model where to look for a batch_size value
/// \return Dimension representing current batch size. Can represent a number or be a dynamic
OPENVINO_API ov::Dimension get_batch(const std::shared_ptr<const ov::Model>& f);
/// \brief Helper method to set batch size to a Function
/// \brief Helper method to set batch size to a Model
///
/// \details Checks layout of each parameter in a Function and sets value for N (B) dimension. Then performs validation
/// \details Checks layout of each parameter in a Model and sets value for N (B) dimension. Then performs validation
/// and type propagation
///
/// \throws ::ov::AssertFailure with details in case of error. Possible errors are:
/// * There is no parameter with N dimension in layout. Function shall have at least one parameter with layout with 'N'
/// * There is no parameter with N dimension in layout. Model shall have at least one parameter with layout with 'N'
/// dimension. Recommended fix is to use `Parameter::set_layout` API, e.g.
/// `function->get_parameters()[some_index]->set_layout("NCHW");`
/// `model->get_parameters()[some_index]->set_layout("NCHW");`
/// * Several parameters have conflicting N dimension, e.g. param1 NCHW{1,3,224,224} and param2 NCHW{3,224,224,1}. This
/// is ambiguous (1 != 3), most probably some dimension is incorrectly marked as 'batch' (N) in some layout. User shall
/// fix it before using of 'set_batch' (in example above correct layout for param2 from 'NCHW' to 'CHWN')
/// * Validation fails after setting batch_size. Function becomes in inconsistent state after new batch size value is
/// * Validation fails after setting batch_size. Model becomes in inconsistent state after new batch size value is
/// applied. Possible reason could be that layout was not set for some parameters, or batch size can't be applied to
/// model at all
///
/// \param f function where to set batch_size value
/// \param f model where to set batch_size value
/// \param batch_size Batch size value. For dynamic batch size, Dimension::dynamic() can be passed.
OPENVINO_API void set_batch(const std::shared_ptr<ov::Model>& f, ov::Dimension batch_size);
-7
View File
@@ -39,13 +39,6 @@ void ov::descriptor::Input::replace_output(Output& new_output) {
m_output = &new_output;
m_src_node = std::shared_ptr<ngraph::Node>(new_output.get_node());
if (ngraph::getenv_bool("NGRAPH_ENABLE_REPLACE_CHECK")) {
// the result of clone_with_new_inputs will be thrown away or
// an exception will be thrown by `m_node`'s class c-tor
// if a new input violates one of the type checks in the c-tor.
m_node->clone_with_new_inputs(m_node->input_values());
}
// Output replacement may change the topological order of nodes,
// so we have to reset cache by setting a flag into shared node info.
for_each(m_node->m_shared_rt_info.cbegin(),
+1 -1
View File
@@ -352,7 +352,7 @@ void op::v0::Range::validate_and_infer_types() {
NODE_VALIDATION_CHECK(this,
result_et != element::Type_t::u1 && result_et != element::Type_t::i4 &&
result_et != element::Type_t::u4 && result_et != element::Type_t::undefined,
"Internal nGraph error: unsupported element type: ",
"Internal OpenVINO error: unsupported element type: ",
result_et);
if (result_et == element::Type_t::dynamic) {
+1 -18
View File
@@ -136,7 +136,7 @@ bool ov::pass::GraphRewrite::apply_matcher_passes(std::shared_ptr<Model> f,
// will be deprecated and removed.
if (m_pass->get_property(PassProperty::REQUIRE_STATIC_SHAPE) && f->is_dynamic()) {
NGRAPH_DEBUG << "matcher callback requires static shape but the "
"function is dynamic, skipping this "
"model is dynamic, skipping this "
"optimization till the shapes are fully "
"materialized";
return false;
@@ -316,27 +316,10 @@ bool ov::pass::RecurrentGraphRewrite::run_on_model(const std::shared_ptr<Model>&
bool changed = false;
size_t i = 0;
// This check is very expensive and is only needed for experimental features, so we will hide
// it behind an environment variable for now. TODO: Find a less expensive way to handle this.
static bool s_rerun_dynamic_check = ngraph::getenv_bool("NGRAPH_GRAPH_REWRITE_RERUN_DYNAMIC_CHECK");
auto run_matchers = [&]() -> bool {
bool is_dyn_func = s_rerun_dynamic_check && f->is_dynamic();
for (const auto& node : f->get_ops()) {
for (auto& m_pass : m_matchers) {
if (is_dyn_func && m_pass->get_property(PassProperty::REQUIRE_STATIC_SHAPE)) {
NGRAPH_DEBUG << "matcher callback requires static shape but the "
"function is dynamic, skipping this "
"optimization till the shapes are fully "
"materialized";
continue;
}
if (m_pass->apply(node)) {
// If call back may change function's is_dynamic state, we need to
// update the cached value.
if (m_pass->get_property(PassProperty::CHANGE_DYNAMIC_STATE)) {
is_dyn_func = s_rerun_dynamic_check && f->is_dynamic();
}
return true;
}
}
+8 -7
View File
@@ -38,7 +38,8 @@ PerfCounters& perf_counters() {
ov::pass::Manager::Manager()
: m_pass_config(std::make_shared<PassConfig>()),
m_visualize(ov::util::getenv_bool("NGRAPH_ENABLE_VISUALIZE_TRACING")) {}
m_visualize(ov::util::getenv_bool("NGRAPH_ENABLE_VISUALIZE_TRACING") ||
ov::util::getenv_bool("OV_ENABLE_VISUALIZE_TRACING")) {}
ov::pass::Manager::~Manager() = default;
@@ -52,7 +53,8 @@ void ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
NGRAPH_SUPPRESS_DEPRECATED_START
OV_ITT_SCOPED_TASK(ov::itt::domains::nGraph, "pass::Manager::run_passes");
static bool profile_enabled = ov::util::getenv_bool("NGRAPH_PROFILE_PASS_ENABLE");
static bool profile_enabled =
ov::util::getenv_bool("NGRAPH_PROFILE_PASS_ENABLE") || ov::util::getenv_bool("OV_PROFILE_PASS_ENABLE");
size_t index = 0;
ngraph::stopwatch pass_timer;
@@ -74,7 +76,7 @@ void ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
// static shape but the function state is dynamic.
if (matcher_pass->get_property(PassProperty::REQUIRE_STATIC_SHAPE) && func->is_dynamic()) {
NGRAPH_DEBUG << "Pass " << pass->get_name() << " requires static shape but the "
<< "function is dynamic. Skipping this transformation";
<< "model is dynamic. Skipping this transformation";
continue;
}
// GraphRewrite is a temporary container for MatcherPass to make execution
@@ -85,7 +87,7 @@ void ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
// static shape but the function state is dynamic.
if (function_pass->get_property(PassProperty::REQUIRE_STATIC_SHAPE) && func->is_dynamic()) {
NGRAPH_DEBUG << "Pass " << pass->get_name() << " requires static shape but the "
<< "function is dynamic. Skipping this transformation";
<< "model is dynamic. Skipping this transformation";
continue;
}
@@ -100,7 +102,7 @@ void ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
} else if (auto node_pass = dynamic_pointer_cast<ngraph::pass::NodePass>(pass)) {
if (node_pass->get_property(PassProperty::REQUIRE_STATIC_SHAPE) && func->is_dynamic()) {
NGRAPH_DEBUG << "Pass " << pass->get_name() << " requires static shape but the "
<< "function is dynamic. Skipping this transformation";
<< "model is dynamic. Skipping this transformation";
continue;
}
for (const shared_ptr<Node>& n : func->get_ops()) {
@@ -116,8 +118,7 @@ void ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
auto base_filename = func->get_name() + std::string("_") + index_str + std::string("_") + pass->get_name();
if (m_visualize) {
static const string format = ov::util::getenv_string("NGRAPH_VISUALIZE_TRACING_FORMAT");
auto file_ext = format.empty() ? "svg" : format;
auto file_ext = "svg";
pass::VisualizeTree vt(base_filename + std::string(".") + file_ext);
vt.run_on_model(func);
}
+6 -6
View File
@@ -218,7 +218,7 @@ public:
}
void on_adapter(const std::string& name, ngraph::ValueAccessor<std::shared_ptr<Function>>& adapter) override {
throw ngraph_error("Function type is unsupported for rt info serialization");
throw ngraph_error("Model type is unsupported for rt info serialization");
}
void check_attribute_name(const std::string& name) const {
@@ -304,7 +304,7 @@ class XmlSerializer : public ngraph::AttributeVisitor {
const std::vector<std::string>& result_mapping,
pugi::xml_node& port_map,
const std::string& portmap_name) {
NGRAPH_CHECK(!result_mapping.empty(), "No results found in body Function.");
NGRAPH_CHECK(!result_mapping.empty(), "No results found in body Model.");
if (!port_map) {
port_map = m_xml_node.parent().insert_child_before(portmap_name.c_str(), m_xml_node.parent().first_child());
@@ -394,7 +394,7 @@ public:
pugi::xml_node port_map = m_xml_node.parent().child(portmap_name.c_str());
// Bodies can be without parameters(dependig on constants), but can not be without results
NGRAPH_CHECK(!result_mapping.empty(), "No results found in body Function.");
NGRAPH_CHECK(!result_mapping.empty(), "No results found in body Model.");
// TI, Loop do not have attributtes as regular ops, it is necessary to append "port_map" and
// "back_edges" to layer above (m_xml_node.parent()) as in ngfunction_2_ir() layer (here "m_xml_node")
// with empty attributes is removed.
@@ -522,7 +522,7 @@ public:
m_version,
m_deterministic);
} else {
NGRAPH_CHECK(false, "Unsupported Function name.");
NGRAPH_CHECK(false, "Unsupported Model name.");
}
}
};
@@ -988,7 +988,7 @@ void serializeFunc(std::ostream& xml_file,
}
if (version != static_cast<int64_t>(ver) && ver != ov::pass::Serialize::Version::UNSPECIFIED)
throw ngraph_error("Cannot serialize function to incompatible IR version");
throw ngraph_error("Cannot serialize Model to incompatible IR version");
if (version == static_cast<int64_t>(ov::pass::Serialize::Version::UNSPECIFIED))
version = static_cast<int64_t>(ov::pass::Serialize::Version::IR_V11);
@@ -1113,7 +1113,7 @@ bool pass::StreamSerialize::run_on_model(const std::shared_ptr<ngraph::Function>
}
if (version != static_cast<int64_t>(m_version) && m_version != Serialize::Version::UNSPECIFIED)
throw ngraph_error("Cannot serialize function to incompatible IR version");
throw ngraph_error("Cannot serialize model to incompatible IR version");
if (version == static_cast<int64_t>(Serialize::Version::UNSPECIFIED)) {
version = static_cast<int64_t>(Serialize::Version::IR_V11);
+12 -12
View File
@@ -138,14 +138,12 @@ static std::string label_edge(const std::shared_ptr<Node>& /* src */,
size_t arg_index,
int64_t jump_distance) {
std::stringstream ss;
if (getenv_bool("NGRAPH_VISUALIZE_EDGE_LABELS")) {
if (getenv_bool("OV_VISUALIZE_TREE_EDGE_LABELS")) {
size_t output = 0;
stringstream label_edge;
label_edge << "[label=\" " << output << " -> " << arg_index << " \"]";
ss << label_edge.str();
}
else if (getenv_bool("NGRAPH_VISUALIZE_EDGE_JUMP_DISTANCE")) {
} else if (getenv_bool("OV_VISUALIZE_TREE_EDGE_JUMP_DISTANCE")) {
if (jump_distance > 1) {
stringstream label_edge;
label_edge << "[label=\"jump=" << jump_distance << "\"]";
@@ -225,7 +223,7 @@ pass::VisualizeTree::VisualizeTree(const string& file_name, node_modifiers_t nm,
void pass::VisualizeTree::add_node_arguments(shared_ptr<Node> node,
unordered_map<Node*, HeightMap>& height_maps,
size_t& fake_node_ctr) {
static const int const_max_elements = getenv_int("NGRAPH_VISUALIZE_TREE_CONST_MAX_ELEMENTS", 7);
static const int const_max_elements = getenv_int("OV_VISUALIZE_TREE_CONST_MAX_ELEMENTS", 7);
size_t arg_index = 0;
for (auto input_value : node->input_values()) {
@@ -371,7 +369,7 @@ static std::string pretty_value(const vector<T>& values, size_t max_elements) {
}
const std::string additional_ss =
getenv_bool("NGRAPH_VISUALIZE_TREE_MIN_MAX_DENORMAL") ? pretty_min_max_denormal_value(values) : "";
getenv_bool("OV_VISUALIZE_TREE_MIN_MAX_DENORMAL") ? pretty_min_max_denormal_value(values) : "";
if (!additional_ss.empty()) {
ss << std::endl << "(" << additional_ss << ")";
}
@@ -443,10 +441,12 @@ string pass::VisualizeTree::get_attributes(shared_ptr<Node> node) {
stringstream label;
label << "label=\"" << get_node_name(node);
static const bool nvtos = getenv_bool("NGRAPH_VISUALIZE_TREE_OUTPUT_SHAPES");
static const bool nvtot = getenv_bool("NGRAPH_VISUALIZE_TREE_OUTPUT_TYPES");
static const bool nvtio = getenv_bool("NGRAPH_VISUALIZE_TREE_IO");
static const bool nvtrti = getenv_bool("NGRAPH_VISUALIZE_TREE_RUNTIME_INFO");
static const bool nvtos =
getenv_bool("NGRAPH_VISUALIZE_TREE_OUTPUT_SHAPES") || getenv_bool("OV_VISUALIZE_TREE_OUTPUT_SHAPES");
static const bool nvtot =
getenv_bool("NGRAPH_VISUALIZE_TREE_OUTPUT_TYPES") || getenv_bool("OV_VISUALIZE_TREE_OUTPUT_TYPES");
static const bool nvtio = getenv_bool("OV_VISUALIZE_TREE_IO");
static const bool nvtrti = getenv_bool("OV_VISUALIZE_TREE_RUNTIME_INFO");
if (nvtos || nvtot || nvtio) {
if (nvtio) {
@@ -497,14 +497,14 @@ string pass::VisualizeTree::get_attributes(shared_ptr<Node> node) {
}
string pass::VisualizeTree::get_node_name(shared_ptr<Node> node) {
static const bool nvtmn = getenv_bool("NGRAPH_VISUALIZE_TREE_MEMBERS_NAME");
static const bool nvtmn = getenv_bool("OV_VISUALIZE_TREE_MEMBERS_NAME");
string rc = (nvtmn ? string("friendly_name: ") : "") + node->get_friendly_name();
if (node->get_friendly_name() != node->get_name()) {
rc += "\\n" + (nvtmn ? string("name: ") : "") + node->get_name();
}
rc += "\\n" + (nvtmn ? string("type_name: ") : "") + std::string(node->get_type_name());
static const bool nvtrti = getenv_bool("NGRAPH_VISUALIZE_TREE_RUNTIME_INFO");
static const bool nvtrti = getenv_bool("OV_VISUALIZE_TREE_RUNTIME_INFO");
if (nvtrti) {
const auto rt = node->get_rt_info();
if (!rt.empty()) {
-12
View File
@@ -106,18 +106,6 @@ bool Matcher::match_value(const ngraph::Output<Node>& pattern_value, const ngrap
std::shared_ptr<Node> pattern_node = pattern_value.get_node_shared_ptr();
std::shared_ptr<Node> graph_node = graph_value.get_node_shared_ptr();
// This env var allows one to specify node name patterns to abort pattern matching
// at particular nodes. The upshot is that one can quickly zero in on an offending
// fusion by disabling individual fusions or optimizations that use Matcher.
static const std::string node_skip_cregex = ov::util::getenv_string("NGRAPH_FAIL_MATCH_AT");
if (!node_skip_cregex.empty()) {
static const std::regex node_skip_regex(node_skip_cregex);
if (std::regex_match(graph_node->get_name(), node_skip_regex)) {
NGRAPH_DEBUG << "[MATCHER] Aborting at " << *graph_node << " due to NGRAPH_MATCHER_SKIP set to "
<< node_skip_cregex;
return false;
}
}
return pattern_node->match_value(this, pattern_value, graph_value);
}
+1 -1
View File
@@ -59,7 +59,7 @@ public:
m_function->add_results(m_results);
} catch (std::exception& ex) {
// Stress condition, can't recover function to original state
std::cerr << "Unrecoverable error occurred during preprocessing. Function is corrupted, exiting\n";
std::cerr << "Unrecoverable error occurred during preprocessing. Model is corrupted, exiting\n";
exit(EXIT_FAILURE);
}
}
+7 -7
View File
@@ -55,7 +55,7 @@ struct PrePostProcessor::PrePostProcessorImpl {
public:
PrePostProcessorImpl() = default;
explicit PrePostProcessorImpl(const std::shared_ptr<ov::Model>& f) : m_function(f) {
OPENVINO_ASSERT(f, "Function can't be nullptr for PrePostProcessor");
OPENVINO_ASSERT(f, "Model can't be nullptr for PrePostProcessor");
for (size_t i = 0; i < m_function->inputs().size(); ++i) {
auto info = InputInfo();
info.m_impl->m_resolved_param = m_function->get_parameters()[i];
@@ -75,7 +75,7 @@ public:
return m_inputs[index];
}
}
OPENVINO_ASSERT(false, "Function doesn't have input with name ", tensor_name);
OPENVINO_ASSERT(false, "Model doesn't have input with name ", tensor_name);
}
OutputInfo& find_output(const std::string& tensor_name) {
@@ -85,7 +85,7 @@ public:
return m_outputs[index];
}
}
OPENVINO_ASSERT(false, "Function doesn't have output with name ", tensor_name);
OPENVINO_ASSERT(false, "Model doesn't have output with name ", tensor_name);
}
std::vector<InputInfo> m_inputs;
@@ -101,14 +101,14 @@ PrePostProcessor::~PrePostProcessor() = default;
InputInfo& PrePostProcessor::input() {
OPENVINO_ASSERT(m_impl->m_inputs.size() == 1,
"PrePostProcessor::input() - function must have exactly one input, got ",
"PrePostProcessor::input() - Model must have exactly one input, got ",
m_impl->m_inputs.size());
return m_impl->m_inputs.front();
}
InputInfo& PrePostProcessor::input(size_t input_index) {
OPENVINO_ASSERT(m_impl->m_inputs.size() > input_index,
"PrePostProcessor::input(size_t) - function doesn't have input with index ",
"PrePostProcessor::input(size_t) - Model doesn't have input with index ",
input_index,
". Total number of inputs is ",
m_impl->m_inputs.size());
@@ -121,14 +121,14 @@ InputInfo& PrePostProcessor::input(const std::string& tensor_name) {
OutputInfo& PrePostProcessor::output() {
OPENVINO_ASSERT(m_impl->m_outputs.size() == 1,
"PrePostProcessor::output() - function must have exactly one output, got ",
"PrePostProcessor::output() - Model must have exactly one output, got ",
m_impl->m_outputs.size());
return m_impl->m_outputs.front();
}
OutputInfo& PrePostProcessor::output(size_t output_index) {
OPENVINO_ASSERT(m_impl->m_outputs.size() > output_index,
"PrePostProcessor::output(size_t) - function doesn't have input with index ",
"PrePostProcessor::output(size_t) - Model doesn't have input with index ",
output_index,
". Total number of inputs is ",
m_impl->m_inputs.size());
+2 -2
View File
@@ -418,7 +418,7 @@ vector<float> read_float_vector(shared_ptr<runtime::Tensor> tv) {
float_vec.push_back(static_cast<float>(value));
}
} else {
throw ngraph_error("Unsupported nGraph element type.");
throw ngraph_error("Unsupported OpenVINO element type.");
}
return float_vec;
@@ -494,7 +494,7 @@ vector<int64_t> read_index_vector(shared_ptr<runtime::Tensor> tv) {
index_vec.push_back(static_cast<int64_t>(value));
}
} else {
throw ngraph_error("Unsupported nGraph element type.");
throw ngraph_error("Unsupported OpenVINO element type.");
}
return index_vec;
-10
View File
@@ -85,11 +85,6 @@ protected:
};
TEST_P(all_close_f_param_test, test_boundaries) {
if (getenv_bool("NGRAPH_GTEST_INFO")) {
// Print short string documenting which test is being run
std::cout << "[ INFO ] Test params: (" << expected << ", " << tolerance_bits << ")\n";
}
// Format verbose info to only print out in case of test failure
stringstream ss;
ss << "Testing target of: " << expected << " (" << test::float_to_bits(expected) << ")\n";
@@ -208,11 +203,6 @@ protected:
};
TEST_P(all_close_f_double_param_test, test_boundaries) {
if (getenv_bool("NGRAPH_GTEST_INFO")) {
// Print short string documenting which test is being run
std::cout << "[ INFO ] Test params: (" << expected << ", " << tolerance_bits << ")\n";
}
// Format verbose info to only print out in case of test failure
stringstream ss;
ss << "Testing target of: " << expected << " (" << test::double_to_bits(expected) << ")\n";
+3 -3
View File
@@ -135,13 +135,13 @@ public:
void add_expected_output(const Shape& expected_shape, const std::vector<T>& values) {
const auto results = m_function->get_results();
NGRAPH_CHECK(m_output_index < results.size(), "All function results already have expected outputs.");
NGRAPH_CHECK(m_output_index < results.size(), "All model results already have expected outputs.");
const auto& output_pshape = results.at(m_output_index)->get_output_partial_shape(0);
NGRAPH_CHECK(output_pshape.compatible(expected_shape),
"Provided expected output shape ",
expected_shape,
" is not compatible with nGraph function's output shape ",
" is not compatible with OpenVINO model's output shape ",
output_pshape,
" for output ",
m_output_index);
@@ -158,7 +158,7 @@ public:
void add_expected_output(const std::vector<T>& values) {
const auto results = m_function->get_results();
NGRAPH_CHECK(m_output_index < results.size(), "All function results already have expected outputs.");
NGRAPH_CHECK(m_output_index < results.size(), "All model results already have expected outputs.");
const auto shape = results.at(m_output_index)->get_shape();
add_expected_output<T>(shape, values);
+1 -1
View File
@@ -217,7 +217,7 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_unsupported_op) {
FAIL() << "Expected ngraph::ngraph_error";
} catch (ngraph::ngraph_error const& err) {
std::string what{err.what()};
EXPECT_NE(what.find("nGraph does not support"), std::string::npos);
EXPECT_NE(what.find("OpenVINO does not support"), std::string::npos);
EXPECT_NE(what.find("FakeOpName"), std::string::npos);
EXPECT_NE(what.find("AnotherFakeOpName"), std::string::npos);
} catch (...) {
+2 -2
View File
@@ -327,7 +327,7 @@ uint32_t matching_mantissa_bits(uint64_t distance) {
}
bool all_below_min_signal = below_min_count == distances.size();
if (rc && (getenv_bool("NGRAPH_GTEST_INFO"))) {
if (rc) {
// Short unobtrusive message when passing
std::cout << "[ INFO ] Verifying match of <= " << (FLOAT_MANTISSA_BITS - tolerance_bits)
<< " mantissa bits (" << FLOAT_MANTISSA_BITS << " bits precision - " << tolerance_bits
@@ -435,7 +435,7 @@ uint32_t matching_mantissa_bits(uint64_t distance) {
}
bool all_below_min_signal = below_min_count == distances.size();
if (rc && (getenv_bool("NGRAPH_GTEST_INFO"))) {
if (rc) {
// Short unobtrusive message when passing
std::cout << "[ INFO ] Verifying match of >= " << (DOUBLE_MANTISSA_BITS - tolerance_bits)
<< " mantissa bits (" << DOUBLE_MANTISSA_BITS << " bits precision - " << tolerance_bits
+1 -1
View File
@@ -90,7 +90,7 @@ std::shared_ptr<SharedRTInfo> ModelAccessor::get_shared_info() const {
if (auto f = m_function.lock()) {
return f->m_shared_rt_info;
}
throw ngraph::ngraph_error("Original function is not available");
throw ngraph::ngraph_error("Original model is not available");
}
std::set<std::shared_ptr<SharedRTInfo>> NodeAccessor::get_shared_info() const {
+3 -3
View File
@@ -177,7 +177,7 @@ ngraph::op::v5::Loop::SpecialBodyPorts XmlDeserializer::parsePurposeAttribute(co
const auto up_io_map = updated_io_map(node, body_node);
NGRAPH_CHECK(!up_io_map.inputs.empty() || !up_io_map.outputs.empty(),
"No parameters or results found in body Function.");
"No parameters or results found in body Model.");
// Parse PortMap: external_port_id for inputs/outputs does not always appear in consecutive
// order
@@ -496,12 +496,12 @@ std::shared_ptr<ngraph::Function> XmlDeserializer::parse_function(
auto node = createNode(inputs, p.xml, weights, p.params);
id_to_node[layer_id] = node;
// Check that output shape after nGraph node validation the same as in IR
// Check that output shape after OpenVINO node validation the same as in IR
// because IR always right!
// Temporary disabled!
// for (size_t i = 0; i < p.params.outputPorts.size(); ++i) {
// if (p.params.outputPorts[i].dims != node->output(i).get_shape()) {
// IE_THROW() << "Shape after nGraph infer " <<
// IE_THROW() << "Shape after Model infer " <<
// details::dumpVec(node->output(i).get_shape())
// << " differ from IR shapes: " <<
// details::dumpVec(p.params.outputPorts[i].dims);
@@ -60,7 +60,7 @@ public:
}
void on_adapter(const std::string& name, ov::ValueAccessor<std::shared_ptr<ov::Model>>& adapter) override {
throw ov::Exception("Function type is unsupported for rt info deserialization");
throw ov::Exception("Model type is unsupported for rt info deserialization");
}
void on_adapter(const std::string& name, ov::ValueAccessor<std::vector<int32_t>>& adapter) override {
@@ -129,7 +129,7 @@ Graph::Graph(const std::shared_ptr<ONNX_NAMESPACE::ModelProto>& model_proto,
}
NGRAPH_CHECK(unknown_operators.empty(),
"nGraph does not support the following ONNX operations: ",
"OpenVINO does not support the following ONNX operations: ",
detail::to_string(unknown_operators));
}
@@ -46,7 +46,7 @@ OutputVector batch_norm(const Node& node) {
saved_var};
}
throw ngraph_error("Cannot create nGraph batch norm with unsupported number of inputs");
throw ngraph_error("Cannot create OpenVINO batch norm with unsupported number of inputs");
}
} // namespace set_1
+2 -2
View File
@@ -53,7 +53,7 @@ void FrontEnd::translate_graph(const ov::frontend::InputModel::Ptr& model,
ov::ParameterVector params;
ov::ResultVector results;
const auto& model_tf = std::dynamic_pointer_cast<InputModel>(model);
FRONT_END_GENERAL_CHECK(model_tf, "nullptr for InputModel is given for translation into OV function");
FRONT_END_GENERAL_CHECK(model_tf, "nullptr for InputModel is given for translation into OV Model");
const auto& operation_places = model_tf->get_op_places();
const auto& model_inputs = model_tf->get_inputs();
const auto& model_outputs = model_tf->get_outputs();
@@ -255,7 +255,7 @@ void FrontEnd::translate_graph(const ov::frontend::InputModel::Ptr& model,
// TODO: reorder results and params according to indices given in RT info (if any)
// create the OV function
// create the OV Model
ng_function = std::make_shared<ov::Model>(results, params, model_name);
OPENVINO_DEBUG << "Done with translations";
}
@@ -97,7 +97,7 @@ TEST(ONNX_Importer_Tests, ImportModelWithNotSupportedOp) {
FAIL() << "Any expection was thrown despite the ONNX model is not supported";
}
catch(const ngraph::ngraph_error& error) {
EXPECT_PRED_FORMAT2(testing::IsSubstring, std::string("nGraph does not support the following ONNX operations: NotSupported"), error.what());
EXPECT_PRED_FORMAT2(testing::IsSubstring, std::string("OpenVINO does not support the following ONNX operations: NotSupported"), error.what());
}
catch(...) {
FAIL() << "Expected 'ngraph::ngraph_error' exception was not thrown despite the ONNX model is not supported";