Skip to content

Commit

Permalink
[ONNX Importer] Switch to opset6 (openvinotoolkit#4112)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsocha authored Feb 5, 2021
1 parent 90347c2 commit 65e2b4a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ngraph/frontend/onnx_import/src/default_opset.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "ngraph/opsets/opset5.hpp"
#include "ngraph/opsets/opset6.hpp"

namespace ngraph
{
namespace onnx_import
{
namespace default_opset = ngraph::opset5;
namespace default_opset = ngraph::opset6;
}
}
3 changes: 2 additions & 1 deletion ngraph/frontend/onnx_import/src/op/gather_elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#pragma once

#include "default_opset.hpp"
#include "ngraph/output_vector.hpp"

namespace ngraph
Expand All @@ -33,7 +34,7 @@ namespace ngraph
auto indices = ng_inputs.at(1);
auto axis = node.get_attribute_value<int64_t>("axis", 0);

return {std::make_shared<ngraph::op::v6::GatherElements>(data, indices, axis)};
return {std::make_shared<default_opset::GatherElements>(data, indices, axis)};
}
} // namespace set_1
} // namespace op
Expand Down
3 changes: 2 additions & 1 deletion ngraph/frontend/onnx_import/src/op/instance_norm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ namespace ngraph
const auto reduction_axes =
common::get_monotonic_range_along_node_rank(data, 2);

auto mvn = std::make_shared<default_opset::MVN>(data, false, true, epsilon);
auto mvn = std::make_shared<default_opset::MVN>(
data, reduction_axes, true, epsilon, ngraph::op::MVNEpsMode::INSIDE_SQRT);

std::shared_ptr<ngraph::Node> data_shape_node;
if (data_pshape.is_static())
Expand Down
2 changes: 1 addition & 1 deletion ngraph/frontend/onnx_import/src/op/loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ namespace ngraph
body_inputs[0]); // current iteration body input
const auto body = std::make_shared<ngraph::Function>(body_outputs, body_params);
auto loop = std::make_shared<default_opset::Loop>(trip_count, termination_cond);
ngraph::opset5::Loop::SpecialBodyPorts spec_ports{0, 0};
default_opset::Loop::SpecialBodyPorts spec_ports{0, 0};
loop->set_special_body_ports(spec_ports);
loop->set_function(body);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "default_opset.hpp"
#include "ngraph/axis_set.hpp"
#include "ngraph/op/mvn.hpp"
#include "ngraph/opsets/opset5.hpp"
#include "ngraph/validation_util.hpp"
#include "op/mean_variance_normalization.hpp"

Expand All @@ -38,7 +39,7 @@ namespace ngraph
bool normalize_variance =
node.get_attribute_value<std::int64_t>("normalize_variance", 1);

return {std::make_shared<default_opset::MVN>(
return {std::make_shared<ngraph::opset5::MVN>(
data, across_channels, normalize_variance)};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "ngraph/builder/reduce_ops.hpp"
#include "ngraph/builder/split.hpp"
#include "ngraph/node.hpp"
#include "ngraph/opsets/opset5.hpp"
#include "onnx_import/core/node.hpp"
#include "utils/common.hpp"
#include "utils/reshape.hpp"
Expand Down Expand Up @@ -84,7 +85,7 @@ namespace ngraph
data, detail::create_group_norm_shape(data, num_groups), true);

auto mvn =
std::make_shared<default_opset::MVN>(data_reshaped, false, true, eps);
std::make_shared<ngraph::opset5::MVN>(data_reshaped, false, true, eps);
std::shared_ptr<ngraph::Node> result =
std::make_shared<default_opset::Reshape>(mvn, data_shape_node, true);

Expand Down
2 changes: 1 addition & 1 deletion ngraph/python/tests/test_onnx/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def expect_fail(test_case_path, xfail): # type: (str) -> None
"OnnxBackendNodeModelTest.test_squeeze_cpu",
"OnnxBackendNodeModelTest.test_squeeze_negative_axes_cpu",),
(xfail_issue_44976,
"OnnxBackendNodeModelTest.test_quantizelinear_axis_cpu",)
"OnnxBackendNodeModelTest.test_quantizelinear_axis_cpu",),
]

for test_group in tests_expected_to_fail:
Expand Down
4 changes: 2 additions & 2 deletions ngraph/test/onnx/onnx_import_controlflow.in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,12 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_controlflow_loop_the_proper_opset_in_subgraph)
return std::string{op->get_type_name()} == "Loop";
});
const auto body_ops =
ngraph::as_type_ptr<ngraph::opset5::Loop>(*loop_node_it)->get_function()->get_ops();
ngraph::as_type_ptr<default_opset::Loop>(*loop_node_it)->get_function()->get_ops();
const auto body_mul_node_it =
std::find_if(body_ops.begin(), body_ops.end(), [](const std::shared_ptr<Node>& op) {
return std::string{op->get_type_name()} == "Multiply";
});
const auto body_mul_node = ngraph::as_type_ptr<ngraph::opset5::Multiply>(*body_mul_node_it);
const auto body_mul_node = ngraph::as_type_ptr<default_opset::Multiply>(*body_mul_node_it);
EXPECT_TRUE(body_mul_node);
EXPECT_EQ(
body_mul_node->get_autob().m_type,
Expand Down

0 comments on commit 65e2b4a

Please sign in to comment.