Move Visitor tests to new api (#19379)
* Moved visitor tests to new API * Fixed build for Windows
This commit is contained in:
parent
350c4d2363
commit
679369c707
@ -2,52 +2,45 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/core/attribute_visitor.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
|
||||
TEST(attributes, dimension) {
|
||||
NodeBuilder builder;
|
||||
AttributeVisitor& loader = builder.get_node_loader();
|
||||
AttributeVisitor& saver = builder.get_node_saver();
|
||||
ov::test::NodeBuilder builder;
|
||||
ov::AttributeVisitor& loader = builder.get_node_loader();
|
||||
ov::AttributeVisitor& saver = builder.get_node_saver();
|
||||
|
||||
Dimension dyn = Dimension(-1);
|
||||
ov::Dimension dyn = ov::Dimension(-1);
|
||||
saver.on_attribute("dyn", dyn);
|
||||
Dimension g_dyn;
|
||||
ov::Dimension g_dyn;
|
||||
loader.on_attribute("dyn", g_dyn);
|
||||
EXPECT_EQ(dyn, g_dyn);
|
||||
|
||||
Dimension scalar = Dimension(10);
|
||||
ov::Dimension scalar = ov::Dimension(10);
|
||||
saver.on_attribute("scalar", scalar);
|
||||
Dimension g_scalar;
|
||||
ov::Dimension g_scalar;
|
||||
loader.on_attribute("scalar", g_scalar);
|
||||
EXPECT_EQ(scalar, g_scalar);
|
||||
|
||||
Dimension boundaries1 = Dimension(2, 100);
|
||||
ov::Dimension boundaries1 = ov::Dimension(2, 100);
|
||||
saver.on_attribute("boundaries1", boundaries1);
|
||||
Dimension g_boundaries1;
|
||||
ov::Dimension g_boundaries1;
|
||||
loader.on_attribute("boundaries1", g_boundaries1);
|
||||
EXPECT_EQ(boundaries1, g_boundaries1);
|
||||
|
||||
Dimension boundaries2 = Dimension(-1, 100);
|
||||
ov::Dimension boundaries2 = ov::Dimension(-1, 100);
|
||||
saver.on_attribute("boundaries2", boundaries2);
|
||||
Dimension g_boundaries2;
|
||||
ov::Dimension g_boundaries2;
|
||||
loader.on_attribute("boundaries2", g_boundaries2);
|
||||
EXPECT_EQ(boundaries2, g_boundaries2);
|
||||
|
||||
Dimension boundaries3 = Dimension(5, -1);
|
||||
ov::Dimension boundaries3 = ov::Dimension(5, -1);
|
||||
saver.on_attribute("boundaries3", boundaries3);
|
||||
Dimension g_boundaries3;
|
||||
ov::Dimension g_boundaries3;
|
||||
loader.on_attribute("boundaries3", g_boundaries3);
|
||||
EXPECT_EQ(boundaries3, g_boundaries3);
|
||||
}
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/abs.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Abs, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Abs, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/acos.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Acos, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Acos, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/acosh.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v3::Acosh, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v3::Acosh, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,23 +2,21 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/adaptive_avg_pool.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
TEST(attributes, adaptive_avg_pool_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::AdaptiveAvgPool>();
|
||||
const auto A = make_shared<op::Parameter>(element::f32, Shape{1, 3, 5, 4});
|
||||
const auto out_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {4, 3});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<ov::op::v8::AdaptiveAvgPool>();
|
||||
const auto A = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1, 3, 5, 4});
|
||||
const auto out_shape = ov::op::v0::Constant::create<int64_t>(ov::element::i64, ov::Shape{2}, {4, 3});
|
||||
|
||||
const auto adaptive_pool = make_shared<opset8::AdaptiveAvgPool>(A, out_shape);
|
||||
NodeBuilder builder(adaptive_pool, {A, out_shape});
|
||||
const auto adaptive_pool = std::make_shared<ov::op::v8::AdaptiveAvgPool>(A, out_shape);
|
||||
ov::test::NodeBuilder builder(adaptive_pool, {A, out_shape});
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,24 +2,22 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/adaptive_max_pool.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
TEST(attributes, adaptive_max_pool_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::AdaptiveMaxPool>();
|
||||
const auto A = make_shared<op::Parameter>(element::f32, Shape{1, 3, 5, 4});
|
||||
const auto out_shape = op::Constant::create<int64_t>(element::i64, Shape{2}, {4, 3});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<ov::op::v8::AdaptiveMaxPool>();
|
||||
const auto A = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1, 3, 5, 4});
|
||||
const auto out_shape = ov::op::v0::Constant::create<int64_t>(ov::element::i64, ov::Shape{2}, {4, 3});
|
||||
|
||||
const auto adaptive_pool = make_shared<opset8::AdaptiveMaxPool>(A, out_shape);
|
||||
NodeBuilder builder(adaptive_pool, {A, out_shape});
|
||||
auto g_adaptive_pool = ov::as_type_ptr<opset8::AdaptiveMaxPool>(builder.create());
|
||||
const auto adaptive_pool = std::make_shared<ov::op::v8::AdaptiveMaxPool>(A, out_shape);
|
||||
ov::test::NodeBuilder builder(adaptive_pool, {A, out_shape});
|
||||
auto g_adaptive_pool = ov::as_type_ptr<ov::op::v8::AdaptiveMaxPool>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 1;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/add.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::Add, ngraph::element::f32>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::Add, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,7 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/asin.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Asin, ngraph::element::f32>>;
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Asin, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,7 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/asinh.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v3::Asinh, ngraph::element::f32>>;
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v3::Asinh, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,25 +2,19 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset6.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
#include "openvino/op/read_value.hpp"
|
||||
#include "openvino/op/util/variable.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
TEST(attributes, assign_v3_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::Assign>();
|
||||
const auto in = make_shared<op::Parameter>(element::f32, Shape{1});
|
||||
const string variable_id = "v0";
|
||||
const auto read_value = make_shared<opset3::ReadValue>(in, variable_id);
|
||||
const auto assign = make_shared<opset3::Assign>(read_value, variable_id);
|
||||
NodeBuilder builder(assign, {read_value});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<ov::op::v3::Assign>();
|
||||
const auto in = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1});
|
||||
const std::string variable_id = "v0";
|
||||
const auto read_value = std::make_shared<ov::op::v3::ReadValue>(in, variable_id);
|
||||
const auto assign = std::make_shared<ov::op::v3::Assign>(read_value, variable_id);
|
||||
ov::test::NodeBuilder builder(assign, {read_value});
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 1;
|
||||
@ -28,12 +22,13 @@ TEST(attributes, assign_v3_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, assign_v6_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset6::Assign>();
|
||||
const auto in = make_shared<op::Parameter>(element::f32, Shape{1});
|
||||
const auto variable = std::make_shared<Variable>(VariableInfo{PartialShape::dynamic(), element::dynamic, "v0"});
|
||||
const auto read_value = make_shared<opset6::ReadValue>(in, variable);
|
||||
const auto assign = make_shared<opset6::Assign>(read_value, variable);
|
||||
NodeBuilder builder(assign, {read_value});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<ov::op::v6::Assign>();
|
||||
const auto in = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1});
|
||||
const auto variable = std::make_shared<ov::op::util::Variable>(
|
||||
ov::op::util::VariableInfo{ov::PartialShape::dynamic(), ov::element::dynamic, "v0"});
|
||||
const auto read_value = std::make_shared<ov::op::v6::ReadValue>(in, variable);
|
||||
const auto assign = std::make_shared<ov::op::v6::Assign>(read_value, variable);
|
||||
ov::test::NodeBuilder builder(assign, {read_value});
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 1;
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/atan.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v0::Atan, ngraph::element::f32>>;
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v0::Atan, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Types, UnaryOperatorTypeName);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/atanh.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v3::Atanh, ngraph::element::f32>>;
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v3::Atanh, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Types, UnaryOperatorTypeName);
|
||||
|
@ -2,21 +2,19 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/avg_pool.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
|
||||
TEST(attributes, avg_pool_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::AvgPool>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{64, 3, 5});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<op::v1::AvgPool>();
|
||||
auto data = make_shared<op::v0::Parameter>(element::f32, Shape{64, 3, 5});
|
||||
|
||||
auto strides = Strides{2};
|
||||
auto pads_begin = Shape{1};
|
||||
@ -27,13 +25,13 @@ TEST(attributes, avg_pool_op) {
|
||||
auto auto_pad = op::PadType::EXPLICIT;
|
||||
|
||||
auto avg_pool =
|
||||
make_shared<opset1::AvgPool>(data, strides, pads_begin, pads_end, kernel, exclude_pad, rounding_mode, auto_pad);
|
||||
make_shared<op::v1::AvgPool>(data, strides, pads_begin, pads_end, kernel, exclude_pad, rounding_mode, auto_pad);
|
||||
|
||||
avg_pool->set_pads_begin(pads_begin);
|
||||
avg_pool->set_pads_end(pads_end);
|
||||
|
||||
NodeBuilder builder(avg_pool, {data});
|
||||
auto g_avg_pool = ov::as_type_ptr<opset1::AvgPool>(builder.create());
|
||||
ov::test::NodeBuilder builder(avg_pool, {data});
|
||||
auto g_avg_pool = ov::as_type_ptr<op::v1::AvgPool>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_avg_pool->get_strides(), avg_pool->get_strides());
|
||||
EXPECT_EQ(g_avg_pool->get_pads_begin(), avg_pool->get_pads_begin());
|
||||
@ -44,8 +42,8 @@ TEST(attributes, avg_pool_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, avg_pool_op_valid) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::AvgPool>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{64, 3, 5});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<op::v1::AvgPool>();
|
||||
auto data = make_shared<op::v0::Parameter>(element::f32, Shape{64, 3, 5});
|
||||
|
||||
auto strides = Strides{2};
|
||||
auto pads_begin = Shape{1};
|
||||
@ -56,10 +54,10 @@ TEST(attributes, avg_pool_op_valid) {
|
||||
auto auto_pad = op::PadType::VALID;
|
||||
|
||||
auto avg_pool =
|
||||
make_shared<opset1::AvgPool>(data, strides, pads_begin, pads_end, kernel, exclude_pad, rounding_mode, auto_pad);
|
||||
make_shared<op::v1::AvgPool>(data, strides, pads_begin, pads_end, kernel, exclude_pad, rounding_mode, auto_pad);
|
||||
|
||||
NodeBuilder builder(avg_pool, {data});
|
||||
auto g_avg_pool = ov::as_type_ptr<opset1::AvgPool>(builder.create());
|
||||
ov::test::NodeBuilder builder(avg_pool, {data});
|
||||
auto g_avg_pool = ov::as_type_ptr<op::v1::AvgPool>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_avg_pool->get_strides(), avg_pool->get_strides());
|
||||
EXPECT_EQ(g_avg_pool->get_pads_begin(), avg_pool->get_pads_begin());
|
||||
@ -70,8 +68,8 @@ TEST(attributes, avg_pool_op_valid) {
|
||||
}
|
||||
|
||||
TEST(attributes, avg_pool_v8_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::AvgPool>();
|
||||
const auto data = make_shared<op::Parameter>(element::i32, Shape{1, 3, 37, 37});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<op::v1::AvgPool>();
|
||||
const auto data = make_shared<op::v0::Parameter>(element::i32, Shape{1, 3, 37, 37});
|
||||
|
||||
const auto strides = Strides{1, 1};
|
||||
const auto pads_begin = Shape{1, 1};
|
||||
@ -82,9 +80,9 @@ TEST(attributes, avg_pool_v8_op) {
|
||||
const auto auto_pad = op::PadType::EXPLICIT;
|
||||
|
||||
const auto avg_pool =
|
||||
make_shared<opset8::AvgPool>(data, strides, pads_begin, pads_end, kernel, exclude_pad, rounding_mode, auto_pad);
|
||||
NodeBuilder builder(avg_pool, {data});
|
||||
auto g_avg_pool = ov::as_type_ptr<opset8::AvgPool>(builder.create());
|
||||
make_shared<op::v1::AvgPool>(data, strides, pads_begin, pads_end, kernel, exclude_pad, rounding_mode, auto_pad);
|
||||
ov::test::NodeBuilder builder(avg_pool, {data});
|
||||
auto g_avg_pool = ov::as_type_ptr<op::v1::AvgPool>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_avg_pool->get_strides(), avg_pool->get_strides());
|
||||
EXPECT_EQ(g_avg_pool->get_pads_begin(), avg_pool->get_pads_begin());
|
||||
|
@ -2,19 +2,17 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/batch_norm.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/core/partial_shape.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
|
||||
TEST(attributes, batch_norm_inference_op_v5) {
|
||||
PartialShape in_shape{1, 10};
|
||||
@ -22,16 +20,16 @@ TEST(attributes, batch_norm_inference_op_v5) {
|
||||
element::Type et = element::f32;
|
||||
double epsilon = 0.001;
|
||||
|
||||
NodeBuilder::get_ops().register_factory<op::v5::BatchNormInference>();
|
||||
auto data_batch = make_shared<op::Parameter>(et, in_shape);
|
||||
auto gamma = make_shared<op::Parameter>(et, ch_shape);
|
||||
auto beta = make_shared<op::Parameter>(et, ch_shape);
|
||||
auto mean = make_shared<op::Parameter>(et, ch_shape);
|
||||
auto var = make_shared<op::Parameter>(et, ch_shape);
|
||||
test::NodeBuilder::get_ops().register_factory<op::v5::BatchNormInference>();
|
||||
auto data_batch = make_shared<ov::op::v0::Parameter>(et, in_shape);
|
||||
auto gamma = make_shared<ov::op::v0::Parameter>(et, ch_shape);
|
||||
auto beta = make_shared<ov::op::v0::Parameter>(et, ch_shape);
|
||||
auto mean = make_shared<ov::op::v0::Parameter>(et, ch_shape);
|
||||
auto var = make_shared<ov::op::v0::Parameter>(et, ch_shape);
|
||||
auto batch_norm = make_shared<op::v5::BatchNormInference>(data_batch, gamma, beta, mean, var, epsilon);
|
||||
|
||||
const auto expected_attr_count = 1;
|
||||
NodeBuilder builder(batch_norm, {data_batch, gamma, beta, mean, var});
|
||||
test::NodeBuilder builder(batch_norm, {data_batch, gamma, beta, mean, var});
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
auto g_batch_norm = ov::as_type_ptr<op::v5::BatchNormInference>(builder.create());
|
||||
EXPECT_EQ(g_batch_norm->get_eps_value(), batch_norm->get_eps_value());
|
||||
@ -43,16 +41,16 @@ TEST(attributes, batch_norm_inference_op_v0) {
|
||||
element::Type et = element::f32;
|
||||
double epsilon = 0.001;
|
||||
|
||||
NodeBuilder::get_ops().register_factory<op::v0::BatchNormInference>();
|
||||
auto data_batch = make_shared<op::Parameter>(et, in_shape);
|
||||
auto gamma = make_shared<op::Parameter>(et, ch_shape);
|
||||
auto beta = make_shared<op::Parameter>(et, ch_shape);
|
||||
auto mean = make_shared<op::Parameter>(et, ch_shape);
|
||||
auto var = make_shared<op::Parameter>(et, ch_shape);
|
||||
test::NodeBuilder::get_ops().register_factory<op::v0::BatchNormInference>();
|
||||
auto data_batch = make_shared<ov::op::v0::Parameter>(et, in_shape);
|
||||
auto gamma = make_shared<ov::op::v0::Parameter>(et, ch_shape);
|
||||
auto beta = make_shared<ov::op::v0::Parameter>(et, ch_shape);
|
||||
auto mean = make_shared<ov::op::v0::Parameter>(et, ch_shape);
|
||||
auto var = make_shared<ov::op::v0::Parameter>(et, ch_shape);
|
||||
auto batch_norm = make_shared<op::v0::BatchNormInference>(data_batch, gamma, beta, mean, var, epsilon);
|
||||
|
||||
const auto expected_attr_count = 1;
|
||||
NodeBuilder builder(batch_norm, {gamma, beta, data_batch, mean, var});
|
||||
test::NodeBuilder builder(batch_norm, {gamma, beta, data_batch, mean, var});
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
auto g_batch_norm = ov::as_type_ptr<op::v0::BatchNormInference>(builder.create());
|
||||
EXPECT_EQ(g_batch_norm->get_eps_value(), batch_norm->get_eps_value());
|
||||
|
@ -2,24 +2,26 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/op/batch_to_space.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
|
||||
TEST(attributes, batch_to_space_op) {
|
||||
NodeBuilder::get_ops().register_factory<op::v1::BatchToSpace>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 128});
|
||||
auto block_shape = make_shared<op::Constant>(element::i64, Shape{2}, vector<int64_t>{1, 2});
|
||||
auto crops_begin = make_shared<op::Constant>(element::i64, Shape{2}, vector<int64_t>{0, 2});
|
||||
auto crops_end = make_shared<op::Constant>(element::i64, Shape{2}, vector<int64_t>{0, 0});
|
||||
test::NodeBuilder::get_ops().register_factory<op::v1::BatchToSpace>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 128});
|
||||
auto block_shape = make_shared<ov::op::v0::Constant>(element::i64, Shape{2}, vector<int64_t>{1, 2});
|
||||
auto crops_begin = make_shared<ov::op::v0::Constant>(element::i64, Shape{2}, vector<int64_t>{0, 2});
|
||||
auto crops_end = make_shared<ov::op::v0::Constant>(element::i64, Shape{2}, vector<int64_t>{0, 0});
|
||||
auto batch2space = make_shared<op::v1::BatchToSpace>(data, block_shape, crops_begin, crops_end);
|
||||
|
||||
NodeBuilder builder(batch2space, {data});
|
||||
test::NodeBuilder builder(batch2space, {data});
|
||||
const auto expected_attr_count = 0;
|
||||
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,19 +2,16 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/binary_convolution.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/convolution.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, bin_convolution) {
|
||||
NodeBuilder::get_ops().register_factory<op::v1::Convolution>();
|
||||
@ -28,8 +25,8 @@ TEST(attributes, bin_convolution) {
|
||||
const float pad_value = 1.0f;
|
||||
const auto auto_pad = op::PadType::SAME_LOWER;
|
||||
|
||||
auto data_batch = make_shared<op::Parameter>(element::f32, data_batch_shape);
|
||||
auto filters = make_shared<op::Parameter>(element::u1, filters_shape);
|
||||
auto data_batch = make_shared<ov::op::v0::Parameter>(element::f32, data_batch_shape);
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::u1, filters_shape);
|
||||
|
||||
auto conv = make_shared<op::v1::BinaryConvolution>(data_batch,
|
||||
filters,
|
||||
|
@ -4,14 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
template <typename T, ngraph::element::Type_t ELEMENT_TYPE>
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
template <typename T, ov::element::Type_t ELEMENT_TYPE>
|
||||
class BinaryOperatorType {
|
||||
public:
|
||||
using op_type = T;
|
||||
static constexpr ngraph::element::Type_t element_type = ELEMENT_TYPE;
|
||||
static constexpr ov::element::Type_t element_type = ELEMENT_TYPE;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -22,8 +23,8 @@ public:
|
||||
template <typename T>
|
||||
static std::string GetName(int) {
|
||||
using OP_Type = typename T::op_type;
|
||||
constexpr ngraph::element::Type precision(T::element_type);
|
||||
const ngraph::Node::type_info_t typeinfo = OP_Type::get_type_info_static();
|
||||
constexpr ov::element::Type precision(T::element_type);
|
||||
const ov::Node::type_info_t typeinfo = OP_Type::get_type_info_static();
|
||||
return std::string{typeinfo.name} + "_" + precision.get_type_name();
|
||||
}
|
||||
};
|
||||
@ -32,17 +33,17 @@ TYPED_TEST_SUITE_P(BinaryOperatorVisitor);
|
||||
|
||||
TYPED_TEST_P(BinaryOperatorVisitor, Auto_Broadcast) {
|
||||
using OP_Type = typename TypeParam::op_type;
|
||||
const ngraph::element::Type_t element_type = TypeParam::element_type;
|
||||
const ov::element::Type_t element_type = TypeParam::element_type;
|
||||
|
||||
ngraph::test::NodeBuilder::get_ops().register_factory<OP_Type>();
|
||||
const auto A = std::make_shared<ngraph::op::Parameter>(element_type, ngraph::PartialShape{1, 2, 3});
|
||||
const auto B = std::make_shared<ngraph::op::Parameter>(element_type, ngraph::PartialShape{3, 2, 1});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<OP_Type>();
|
||||
const auto A = std::make_shared<ov::op::v0::Parameter>(element_type, ov::PartialShape{1, 2, 3});
|
||||
const auto B = std::make_shared<ov::op::v0::Parameter>(element_type, ov::PartialShape{3, 2, 1});
|
||||
|
||||
auto auto_broadcast = ngraph::op::AutoBroadcastType::NUMPY;
|
||||
auto auto_broadcast = ov::op::AutoBroadcastType::NUMPY;
|
||||
|
||||
const auto op_func = std::make_shared<OP_Type>(A, B, auto_broadcast);
|
||||
ngraph::test::NodeBuilder builder(op_func, {A, B});
|
||||
const auto g_op_func = ngraph::as_type_ptr<OP_Type>(builder.create());
|
||||
ov::test::NodeBuilder builder(op_func, {A, B});
|
||||
const auto g_op_func = ov::as_type_ptr<OP_Type>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 1;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
@ -51,15 +52,15 @@ TYPED_TEST_P(BinaryOperatorVisitor, Auto_Broadcast) {
|
||||
|
||||
TYPED_TEST_P(BinaryOperatorVisitor, No_Broadcast) {
|
||||
using OP_Type = typename TypeParam::op_type;
|
||||
const ngraph::element::Type_t element_type = TypeParam::element_type;
|
||||
const ov::element::Type_t element_type = TypeParam::element_type;
|
||||
|
||||
ngraph::test::NodeBuilder::get_ops().register_factory<OP_Type>();
|
||||
const auto A = std::make_shared<ngraph::op::Parameter>(element_type, ngraph::PartialShape{1, 2, 3});
|
||||
const auto B = std::make_shared<ngraph::op::Parameter>(element_type, ngraph::PartialShape{1, 2, 3});
|
||||
ov::test::NodeBuilder::get_ops().register_factory<OP_Type>();
|
||||
const auto A = std::make_shared<ov::op::v0::Parameter>(element_type, ov::PartialShape{1, 2, 3});
|
||||
const auto B = std::make_shared<ov::op::v0::Parameter>(element_type, ov::PartialShape{1, 2, 3});
|
||||
|
||||
const auto op_func = std::make_shared<OP_Type>(A, B);
|
||||
ngraph::test::NodeBuilder builder(op_func, {A, B});
|
||||
const auto g_op_func = ngraph::as_type_ptr<OP_Type>(builder.create());
|
||||
ov::test::NodeBuilder builder(op_func, {A, B});
|
||||
const auto g_op_func = ov::as_type_ptr<OP_Type>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 1;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,55 +2,53 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "openvino/op/broadcast.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, broadcast_v1) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::Broadcast>();
|
||||
const auto arg = make_shared<op::Parameter>(element::i64, Shape{1, 3, 1});
|
||||
const auto shape = make_shared<op::Parameter>(element::i64, Shape{3});
|
||||
const auto axes_mapping = make_shared<op::Parameter>(element::i64, Shape{3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::Broadcast>();
|
||||
const auto arg = make_shared<ov::op::v0::Parameter>(element::i64, Shape{1, 3, 1});
|
||||
const auto shape = make_shared<ov::op::v0::Parameter>(element::i64, Shape{3});
|
||||
const auto axes_mapping = make_shared<ov::op::v0::Parameter>(element::i64, Shape{3});
|
||||
const auto broadcast_spec = ov::op::AutoBroadcastType::NONE;
|
||||
|
||||
const auto broadcast_v3 = make_shared<op::v1::Broadcast>(arg, shape, axes_mapping, broadcast_spec);
|
||||
NodeBuilder builder(broadcast_v3, {arg, shape, axes_mapping});
|
||||
auto g_broadcast_v3 = ov::as_type_ptr<opset1::Broadcast>(builder.create());
|
||||
auto g_broadcast_v3 = ov::as_type_ptr<ov::op::v1::Broadcast>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_broadcast_v3->get_broadcast_spec().m_type, broadcast_spec);
|
||||
}
|
||||
|
||||
TEST(attributes, broadcast_v3) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::Broadcast>();
|
||||
const auto arg = make_shared<op::Parameter>(element::i64, Shape{1, 3, 1});
|
||||
const auto shape = make_shared<op::Parameter>(element::i64, Shape{3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::Broadcast>();
|
||||
const auto arg = make_shared<ov::op::v0::Parameter>(element::i64, Shape{1, 3, 1});
|
||||
const auto shape = make_shared<ov::op::v0::Parameter>(element::i64, Shape{3});
|
||||
const auto broadcast_spec = op::BroadcastType::BIDIRECTIONAL;
|
||||
|
||||
const auto broadcast_v3 = make_shared<op::v3::Broadcast>(arg, shape, broadcast_spec);
|
||||
NodeBuilder builder(broadcast_v3, {arg, shape});
|
||||
auto g_broadcast_v3 = ov::as_type_ptr<opset3::Broadcast>(builder.create());
|
||||
auto g_broadcast_v3 = ov::as_type_ptr<ov::op::v3::Broadcast>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_broadcast_v3->get_broadcast_spec(), broadcast_spec);
|
||||
}
|
||||
|
||||
TEST(attributes, broadcast_v3_explicit) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::Broadcast>();
|
||||
const auto arg = make_shared<op::Parameter>(element::i64, Shape{1, 3, 1});
|
||||
const auto shape = make_shared<op::Parameter>(element::i64, Shape{3});
|
||||
const auto axes_mapping = make_shared<op::Parameter>(element::i64, Shape{3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::Broadcast>();
|
||||
const auto arg = make_shared<ov::op::v0::Parameter>(element::i64, Shape{1, 3, 1});
|
||||
const auto shape = make_shared<ov::op::v0::Parameter>(element::i64, Shape{3});
|
||||
const auto axes_mapping = make_shared<ov::op::v0::Parameter>(element::i64, Shape{3});
|
||||
const auto broadcast_spec = op::BroadcastType::EXPLICIT;
|
||||
|
||||
const auto broadcast_v3 = make_shared<op::v3::Broadcast>(arg, shape, axes_mapping, broadcast_spec);
|
||||
NodeBuilder builder(broadcast_v3, {arg, shape, axes_mapping});
|
||||
auto g_broadcast_v3 = ov::as_type_ptr<opset3::Broadcast>(builder.create());
|
||||
auto g_broadcast_v3 = ov::as_type_ptr<ov::op::v3::Broadcast>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_broadcast_v3->get_broadcast_spec(), broadcast_spec);
|
||||
}
|
||||
|
@ -2,44 +2,41 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/bucketize.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, bucketize_v3_op_default_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::Bucketize>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 3, 4});
|
||||
auto buckets = make_shared<op::Parameter>(element::f32, Shape{5});
|
||||
auto bucketize = make_shared<opset3::Bucketize>(data, buckets);
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::Bucketize>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3, 4});
|
||||
auto buckets = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5});
|
||||
auto bucketize = make_shared<ov::op::v3::Bucketize>(data, buckets);
|
||||
NodeBuilder builder(bucketize, {data, buckets});
|
||||
|
||||
auto g_bucketize = ov::as_type_ptr<opset3::Bucketize>(builder.create());
|
||||
auto g_bucketize = ov::as_type_ptr<ov::op::v3::Bucketize>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_bucketize->get_output_type(), bucketize->get_output_type());
|
||||
EXPECT_EQ(g_bucketize->get_with_right_bound(), bucketize->get_with_right_bound());
|
||||
}
|
||||
|
||||
TEST(attributes, bucketize_v3_op_custom_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::Bucketize>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 3, 4});
|
||||
auto buckets = make_shared<op::Parameter>(element::f32, Shape{5});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::Bucketize>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3, 4});
|
||||
auto buckets = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5});
|
||||
element::Type output_type = element::i32;
|
||||
bool with_right_bound = false;
|
||||
|
||||
auto bucketize = make_shared<opset3::Bucketize>(data, buckets, output_type, with_right_bound);
|
||||
auto bucketize = make_shared<ov::op::v3::Bucketize>(data, buckets, output_type, with_right_bound);
|
||||
NodeBuilder builder(bucketize, {data, buckets});
|
||||
|
||||
auto g_bucketize = ov::as_type_ptr<opset3::Bucketize>(builder.create());
|
||||
auto g_bucketize = ov::as_type_ptr<ov::op::v3::Bucketize>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_bucketize->get_output_type(), bucketize->get_output_type());
|
||||
EXPECT_EQ(g_bucketize->get_with_right_bound(), bucketize->get_with_right_bound());
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/ceiling.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Ceiling, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Ceiling, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,27 +2,27 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/clamp.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, clamp_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::Clamp>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 4});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::Clamp>();
|
||||
auto data = make_shared<op::v0::Parameter>(element::f32, Shape{2, 4});
|
||||
|
||||
double min = 0.4;
|
||||
double max = 5.6;
|
||||
|
||||
const auto clamp = make_shared<opset1::Clamp>(data, min, max);
|
||||
const auto clamp = make_shared<op::v0::Clamp>(data, min, max);
|
||||
NodeBuilder builder(clamp, {data});
|
||||
auto g_clamp = ov::as_type_ptr<opset1::Clamp>(builder.create());
|
||||
auto g_clamp = ov::as_type_ptr<op::v0::Clamp>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 2;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,27 +2,26 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/concat.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, concat_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::Concat>();
|
||||
auto input1 = make_shared<op::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
auto input2 = make_shared<op::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
auto input3 = make_shared<op::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::Concat>();
|
||||
auto input1 = make_shared<ov::op::v0::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
auto input2 = make_shared<ov::op::v0::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
auto input3 = make_shared<ov::op::v0::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
int64_t axis = 2;
|
||||
|
||||
auto concat = make_shared<opset1::Concat>(ov::NodeVector{input1, input2, input3}, axis);
|
||||
auto concat = make_shared<ov::op::v0::Concat>(ov::NodeVector{input1, input2, input3}, axis);
|
||||
NodeBuilder builder(concat, {input1, input2, input3});
|
||||
auto g_concat = ov::as_type_ptr<opset1::Concat>(builder.create());
|
||||
auto g_concat = ov::as_type_ptr<ov::op::v0::Concat>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_concat->get_axis(), concat->get_axis());
|
||||
}
|
||||
|
@ -2,20 +2,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "ngraph/runtime/host_tensor.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, constant_op) {
|
||||
vector<float> data{5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f};
|
||||
@ -58,10 +53,9 @@ TEST(attributes, constant_op_identical_elements) {
|
||||
ASSERT_TRUE(g_k->get_all_data_elements_bitwise_identical());
|
||||
}
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
TEST(attributes, constant_op_from_host_tensor_different_elements) {
|
||||
vector<int64_t> data{5, 4, 3, 2, 1, 0};
|
||||
auto tensor = std::make_shared<runtime::HostTensor>(element::i64, Shape{2, 3}, &data[0]);
|
||||
auto tensor = ov::Tensor(element::i64, Shape{2, 3}, &data[0]);
|
||||
auto k = make_shared<op::v0::Constant>(tensor);
|
||||
ASSERT_FALSE(k->get_all_data_elements_bitwise_identical());
|
||||
NodeBuilder builder(k);
|
||||
@ -77,7 +71,7 @@ TEST(attributes, constant_op_from_host_tensor_different_elements) {
|
||||
|
||||
TEST(attributes, constant_op_from_host_tensor_identical_elements) {
|
||||
vector<int64_t> data{5, 5, 5, 5, 5, 5};
|
||||
auto tensor = std::make_shared<runtime::HostTensor>(element::i64, Shape{2, 3}, &data[0]);
|
||||
auto tensor = ov::Tensor(element::i64, Shape{2, 3}, &data[0]);
|
||||
auto k = make_shared<op::v0::Constant>(tensor);
|
||||
ASSERT_TRUE(k->get_all_data_elements_bitwise_identical());
|
||||
NodeBuilder builder(k);
|
||||
|
@ -2,19 +2,20 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "openvino/op/convert.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, convert_op_v0) {
|
||||
using Convert = op::v0::Convert;
|
||||
|
||||
NodeBuilder::get_ops().register_factory<Convert>();
|
||||
auto data = std::make_shared<op::Parameter>(element::f32, Shape{2, 4});
|
||||
auto data = std::make_shared<op::v0::Parameter>(element::f32, Shape{2, 4});
|
||||
const element::Type destination_type = element::Type_t::i32;
|
||||
|
||||
const auto convert = std::make_shared<Convert>(data, destination_type);
|
||||
|
@ -2,16 +2,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/i420_to_bgr.hpp"
|
||||
#include "openvino/op/i420_to_rgb.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ov;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, convert_color_i420_rgb) {
|
||||
NodeBuilder::get_ops().register_factory<op::v8::I420toRGB>();
|
||||
|
@ -2,16 +2,16 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/op/nv12_to_bgr.hpp"
|
||||
#include "openvino/op/nv12_to_rgb.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ov;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, convert_color_nv12_rgb) {
|
||||
NodeBuilder::get_ops().register_factory<op::v8::NV12toRGB>();
|
||||
|
@ -2,25 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/convert_like.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/concat.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, convert_like_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::ConvertLike>();
|
||||
auto data = make_shared<op::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
auto like = make_shared<op::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::ConvertLike>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
auto like = make_shared<ov::op::v0::Parameter>(element::i64, Shape{1, 2, 3});
|
||||
|
||||
auto convertLike = make_shared<opset1::ConvertLike>(data, like);
|
||||
auto convertLike = make_shared<ov::op::v1::ConvertLike>(data, like);
|
||||
NodeBuilder builder(convertLike, {data, like});
|
||||
auto g_convertLike = ov::as_type_ptr<opset1::Concat>(builder.create());
|
||||
auto g_convertLike = ov::as_type_ptr<ov::op::v0::Concat>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,24 +2,21 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/convolution.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, convolution) {
|
||||
NodeBuilder::get_ops().register_factory<op::v1::Convolution>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 16, 124, 124});
|
||||
auto filters = make_shared<op::Parameter>(element::f32, Shape{2, 16, 3, 3});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 16, 124, 124});
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 16, 3, 3});
|
||||
auto strides = Strides{1, 1};
|
||||
auto pads_begin = CoordinateDiff{1, 2};
|
||||
auto pads_end = CoordinateDiff{1, 2};
|
||||
@ -43,8 +40,8 @@ TEST(attributes, convolution) {
|
||||
|
||||
TEST(attributes, convolution2) {
|
||||
NodeBuilder::get_ops().register_factory<op::v1::Convolution>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 3, 227, 227});
|
||||
auto filters = make_shared<op::Parameter>(element::f32, Shape{96, 3, 227, 227});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 227, 227});
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::f32, Shape{96, 3, 227, 227});
|
||||
auto strides = Strides{4, 4};
|
||||
auto pads_begin = CoordinateDiff{0, 0};
|
||||
auto pads_end = CoordinateDiff{0, 0};
|
||||
|
@ -2,37 +2,32 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/convolution.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, convolution_backprop_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::ConvolutionBackpropData>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 16, 124, 124});
|
||||
auto filters = make_shared<op::Parameter>(element::f32, Shape{16, 2, 3, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::ConvolutionBackpropData>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 16, 124, 124});
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::f32, Shape{16, 2, 3, 3});
|
||||
auto strides = Strides{1, 1};
|
||||
auto pads_begin = CoordinateDiff{1, 2};
|
||||
auto pads_end = CoordinateDiff{1, 2};
|
||||
auto dilations = Strides{1, 1};
|
||||
auto convolution = make_shared<opset1::ConvolutionBackpropData>(data,
|
||||
filters,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations,
|
||||
op::PadType::VALID);
|
||||
auto convolution = make_shared<ov::op::v1::ConvolutionBackpropData>(data,
|
||||
filters,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations,
|
||||
op::PadType::VALID);
|
||||
NodeBuilder builder(convolution, {data, filters});
|
||||
auto g_convolution = ov::as_type_ptr<opset1::ConvolutionBackpropData>(builder.create());
|
||||
auto g_convolution = ov::as_type_ptr<ov::op::v1::ConvolutionBackpropData>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 6;
|
||||
@ -46,10 +41,10 @@ TEST(attributes, convolution_backprop_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, convolution_backprop_output_shape_output_padding) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::ConvolutionBackpropData>();
|
||||
const auto data = make_shared<op::Parameter>(element::f32, Shape{1, 16, 124, 124});
|
||||
const auto filter = make_shared<op::Parameter>(element::f32, Shape{16, 2, 3, 3});
|
||||
const auto output_shape = make_shared<op::Parameter>(element::i32, Shape{2});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::ConvolutionBackpropData>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 16, 124, 124});
|
||||
const auto filter = make_shared<ov::op::v0::Parameter>(element::f32, Shape{16, 2, 3, 3});
|
||||
const auto output_shape = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2});
|
||||
|
||||
const auto strides = Strides{2, 1};
|
||||
const auto pads_begin = CoordinateDiff{3, 4};
|
||||
@ -65,17 +60,17 @@ TEST(attributes, convolution_backprop_output_shape_output_padding) {
|
||||
op::PadType::NOTSET};
|
||||
|
||||
for (auto padType : allPadTypes) {
|
||||
const auto convolution = make_shared<opset1::ConvolutionBackpropData>(data,
|
||||
filter,
|
||||
output_shape,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations,
|
||||
padType,
|
||||
output_padding);
|
||||
const auto convolution = make_shared<ov::op::v1::ConvolutionBackpropData>(data,
|
||||
filter,
|
||||
output_shape,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations,
|
||||
padType,
|
||||
output_padding);
|
||||
NodeBuilder builder(convolution, {data, filter});
|
||||
const auto g_convolution = ov::as_type_ptr<opset1::ConvolutionBackpropData>(builder.create());
|
||||
const auto g_convolution = ov::as_type_ptr<ov::op::v1::ConvolutionBackpropData>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 6;
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/cos.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Cos, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Cos, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/cosh.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Cosh, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Cosh, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,25 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/ctc_greedy_decoder.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, ctc_greedy_decoder_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::CTCGreedyDecoder>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::CTCGreedyDecoder>();
|
||||
bool m_ctc_merge_repeated = false;
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{3, 1, 3});
|
||||
auto masks = make_shared<op::Parameter>(element::i32, Shape{3, 1});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{3, 1, 3});
|
||||
auto masks = make_shared<ov::op::v0::Parameter>(element::i32, Shape{3, 1});
|
||||
auto decoder = make_shared<op::v0::CTCGreedyDecoder>(data, masks, m_ctc_merge_repeated);
|
||||
|
||||
NodeBuilder builder(decoder, {data, masks});
|
||||
auto g_decoder = ov::as_type_ptr<opset1::CTCGreedyDecoder>(builder.create());
|
||||
auto g_decoder = ov::as_type_ptr<ov::op::v0::CTCGreedyDecoder>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_decoder->get_ctc_merge_repeated(), decoder->get_ctc_merge_repeated());
|
||||
}
|
||||
|
@ -2,27 +2,27 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset6.hpp"
|
||||
#include "openvino/op/ctc_greedy_decoder_seq_len.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, ctc_greedy_decoder_seq_len_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset6::CTCGreedyDecoderSeqLen>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v6::CTCGreedyDecoderSeqLen>();
|
||||
bool merge_repeated = false;
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 3, 3});
|
||||
auto seq_len = make_shared<op::Parameter>(element::i32, Shape{1});
|
||||
auto blank_index = op::Constant::create<int32_t>(element::i32, Shape{}, {2});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 3});
|
||||
auto seq_len = make_shared<ov::op::v0::Parameter>(element::i32, Shape{1});
|
||||
auto blank_index = ov::op::v0::Constant::create<int32_t>(element::i32, Shape{}, {2});
|
||||
auto decoder = make_shared<op::v6::CTCGreedyDecoderSeqLen>(data, seq_len, blank_index, merge_repeated);
|
||||
|
||||
NodeBuilder builder(decoder, {data, seq_len, blank_index});
|
||||
auto g_decoder = ov::as_type_ptr<opset6::CTCGreedyDecoderSeqLen>(builder.create());
|
||||
auto g_decoder = ov::as_type_ptr<ov::op::v6::CTCGreedyDecoderSeqLen>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_decoder->get_merge_repeated(), decoder->get_merge_repeated());
|
||||
}
|
||||
|
@ -2,32 +2,29 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/ctc_loss.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, ctc_loss) {
|
||||
NodeBuilder::get_ops().register_factory<opset4::CTCLoss>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v4::CTCLoss>();
|
||||
|
||||
auto logits = make_shared<op::Parameter>(element::f32, Shape{10, 120, 28});
|
||||
auto logit_length = make_shared<op::Parameter>(element::i32, Shape{10});
|
||||
auto labels = make_shared<op::Parameter>(element::i32, Shape{10, 120});
|
||||
auto label_length = make_shared<op::Parameter>(element::i32, Shape{10});
|
||||
auto blank_index = make_shared<op::Parameter>(element::i32, Shape{});
|
||||
auto logits = make_shared<ov::op::v0::Parameter>(element::f32, Shape{10, 120, 28});
|
||||
auto logit_length = make_shared<ov::op::v0::Parameter>(element::i32, Shape{10});
|
||||
auto labels = make_shared<ov::op::v0::Parameter>(element::i32, Shape{10, 120});
|
||||
auto label_length = make_shared<ov::op::v0::Parameter>(element::i32, Shape{10});
|
||||
auto blank_index = make_shared<ov::op::v0::Parameter>(element::i32, Shape{});
|
||||
|
||||
auto ctc_loss = make_shared<opset4::CTCLoss>(logits, logit_length, labels, label_length, blank_index);
|
||||
auto ctc_loss = make_shared<ov::op::v4::CTCLoss>(logits, logit_length, labels, label_length, blank_index);
|
||||
NodeBuilder builder(ctc_loss, {logits, logit_length, labels, label_length, blank_index});
|
||||
auto g_ctc_loss = as_type_ptr<opset4::CTCLoss>(builder.create());
|
||||
auto g_ctc_loss = as_type_ptr<ov::op::v4::CTCLoss>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 3;
|
||||
|
@ -2,25 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "openvino/op/cum_sum.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, cum_sum_op_default_attributes_no_axis_input) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::CumSum>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::CumSum>();
|
||||
|
||||
Shape shape{1, 4};
|
||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
||||
auto cs = make_shared<op::CumSum>(A);
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto cs = make_shared<op::v0::CumSum>(A);
|
||||
|
||||
NodeBuilder builder(cs, {A});
|
||||
auto g_cs = ov::as_type_ptr<opset3::CumSum>(builder.create());
|
||||
auto g_cs = ov::as_type_ptr<op::v0::CumSum>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 2;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
@ -30,15 +30,15 @@ TEST(attributes, cum_sum_op_default_attributes_no_axis_input) {
|
||||
}
|
||||
|
||||
TEST(attributes, cum_sum_op_default_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::CumSum>();
|
||||
NodeBuilder::get_ops().register_factory<op::v0::CumSum>();
|
||||
|
||||
Shape shape{1, 4};
|
||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
||||
auto axis = make_shared<op::Parameter>(element::i32, Shape{1});
|
||||
auto cs = make_shared<op::CumSum>(A, axis);
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto axis = make_shared<ov::op::v0::Parameter>(element::i32, Shape{1});
|
||||
auto cs = make_shared<op::v0::CumSum>(A, axis);
|
||||
|
||||
NodeBuilder builder(cs, {A, axis});
|
||||
auto g_cs = ov::as_type_ptr<opset3::CumSum>(builder.create());
|
||||
auto g_cs = ov::as_type_ptr<op::v0::CumSum>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 2;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
@ -48,17 +48,17 @@ TEST(attributes, cum_sum_op_default_attributes) {
|
||||
}
|
||||
|
||||
TEST(attributes, cum_sum_op_custom_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::CumSum>();
|
||||
NodeBuilder::get_ops().register_factory<op::v0::CumSum>();
|
||||
|
||||
Shape shape{1, 4};
|
||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
||||
auto axis = make_shared<op::Parameter>(element::i32, Shape{1});
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto axis = make_shared<ov::op::v0::Parameter>(element::i32, Shape{1});
|
||||
bool exclusive = true;
|
||||
bool reverse = true;
|
||||
auto cs = make_shared<op::CumSum>(A, axis, exclusive, reverse);
|
||||
auto cs = make_shared<op::v0::CumSum>(A, axis, exclusive, reverse);
|
||||
|
||||
NodeBuilder builder(cs, {A, axis});
|
||||
auto g_cs = ov::as_type_ptr<opset3::CumSum>(builder.create());
|
||||
auto g_cs = ov::as_type_ptr<op::v0::CumSum>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 2;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,32 +2,35 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/deformable_convolution.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, deformable_convolution_default_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::DeformableConvolution>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::DeformableConvolution>();
|
||||
const Shape inputs_shape{1, 1, 5, 5};
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 1, 5, 5});
|
||||
auto filters = make_shared<op::Parameter>(element::f32, Shape{1, 1, 3, 3});
|
||||
auto offsets = make_shared<op::Parameter>(element::f32, Shape{1, 18, 3, 3});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 5, 5});
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 3, 3});
|
||||
auto offsets = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 18, 3, 3});
|
||||
auto strides = Strides{1, 1};
|
||||
auto pads_begin = CoordinateDiff{0, 0};
|
||||
auto pads_end = CoordinateDiff{0, 0};
|
||||
auto dilations = Strides{1, 1};
|
||||
auto convolution =
|
||||
make_shared<opset1::DeformableConvolution>(data, offsets, filters, strides, pads_begin, pads_end, dilations);
|
||||
auto convolution = make_shared<ov::op::v1::DeformableConvolution>(data,
|
||||
offsets,
|
||||
filters,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations);
|
||||
NodeBuilder builder(convolution, {data, offsets, filters});
|
||||
auto g_convolution = ov::as_type_ptr<opset1::DeformableConvolution>(builder.create());
|
||||
auto g_convolution = ov::as_type_ptr<ov::op::v1::DeformableConvolution>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 7;
|
||||
@ -43,27 +46,27 @@ TEST(attributes, deformable_convolution_default_attributes) {
|
||||
}
|
||||
|
||||
TEST(attributes, deformable_convolution_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::DeformableConvolution>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::DeformableConvolution>();
|
||||
const Shape inputs_shape{1, 1, 5, 5};
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 2, 5, 5});
|
||||
auto filters = make_shared<op::Parameter>(element::f32, Shape{2, 1, 3, 3});
|
||||
auto offsets = make_shared<op::Parameter>(element::f32, Shape{1, 36, 5, 5});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 5, 5});
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 1, 3, 3});
|
||||
auto offsets = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 36, 5, 5});
|
||||
auto strides = Strides{1, 1};
|
||||
auto pads_begin = CoordinateDiff{0, 0};
|
||||
auto pads_end = CoordinateDiff{0, 0};
|
||||
auto dilations = Strides{1, 1};
|
||||
auto convolution = make_shared<opset1::DeformableConvolution>(data,
|
||||
offsets,
|
||||
filters,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations,
|
||||
op::PadType::SAME_LOWER,
|
||||
2,
|
||||
2);
|
||||
auto convolution = make_shared<ov::op::v1::DeformableConvolution>(data,
|
||||
offsets,
|
||||
filters,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations,
|
||||
op::PadType::SAME_LOWER,
|
||||
2,
|
||||
2);
|
||||
NodeBuilder builder(convolution, {data, offsets, filters});
|
||||
auto g_convolution = ov::as_type_ptr<opset1::DeformableConvolution>(builder.create());
|
||||
auto g_convolution = ov::as_type_ptr<ov::op::v1::DeformableConvolution>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 7;
|
||||
@ -79,19 +82,24 @@ TEST(attributes, deformable_convolution_attributes) {
|
||||
}
|
||||
|
||||
TEST(attributes, deformable_convolution_v8_default_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::DeformableConvolution>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v8::DeformableConvolution>();
|
||||
const Shape inputs_shape{1, 1, 5, 5};
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 1, 5, 5});
|
||||
auto filters = make_shared<op::Parameter>(element::f32, Shape{1, 1, 3, 3});
|
||||
auto offsets = make_shared<op::Parameter>(element::f32, Shape{1, 18, 3, 3});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 5, 5});
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 3, 3});
|
||||
auto offsets = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 18, 3, 3});
|
||||
auto strides = Strides{1, 1};
|
||||
auto pads_begin = CoordinateDiff{0, 0};
|
||||
auto pads_end = CoordinateDiff{0, 0};
|
||||
auto dilations = Strides{1, 1};
|
||||
auto convolution =
|
||||
make_shared<opset8::DeformableConvolution>(data, offsets, filters, strides, pads_begin, pads_end, dilations);
|
||||
auto convolution = make_shared<ov::op::v8::DeformableConvolution>(data,
|
||||
offsets,
|
||||
filters,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations);
|
||||
NodeBuilder builder(convolution, {data, offsets, filters});
|
||||
auto g_convolution = ov::as_type_ptr<opset8::DeformableConvolution>(builder.create());
|
||||
auto g_convolution = ov::as_type_ptr<ov::op::v8::DeformableConvolution>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 8;
|
||||
@ -108,30 +116,30 @@ TEST(attributes, deformable_convolution_v8_default_attributes) {
|
||||
}
|
||||
|
||||
TEST(attributes, deformable_convolution_v8_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::DeformableConvolution>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v8::DeformableConvolution>();
|
||||
const Shape inputs_shape{1, 1, 5, 5};
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 2, 5, 5});
|
||||
auto filters = make_shared<op::Parameter>(element::f32, Shape{2, 1, 3, 3});
|
||||
auto offsets = make_shared<op::Parameter>(element::f32, Shape{1, 36, 5, 5});
|
||||
auto mask = make_shared<op::Parameter>(element::f32, Shape{1, 18, 5, 5});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 5, 5});
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 1, 3, 3});
|
||||
auto offsets = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 36, 5, 5});
|
||||
auto mask = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 18, 5, 5});
|
||||
auto strides = Strides{1, 1};
|
||||
auto pads_begin = CoordinateDiff{0, 0};
|
||||
auto pads_end = CoordinateDiff{0, 0};
|
||||
auto dilations = Strides{1, 1};
|
||||
auto convolution = make_shared<opset8::DeformableConvolution>(data,
|
||||
offsets,
|
||||
filters,
|
||||
mask,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations,
|
||||
op::PadType::SAME_LOWER,
|
||||
2,
|
||||
2,
|
||||
true);
|
||||
auto convolution = make_shared<ov::op::v8::DeformableConvolution>(data,
|
||||
offsets,
|
||||
filters,
|
||||
mask,
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
dilations,
|
||||
op::PadType::SAME_LOWER,
|
||||
2,
|
||||
2,
|
||||
true);
|
||||
NodeBuilder builder(convolution, {data, offsets, filters, mask});
|
||||
auto g_convolution = ov::as_type_ptr<opset8::DeformableConvolution>(builder.create());
|
||||
auto g_convolution = ov::as_type_ptr<ov::op::v8::DeformableConvolution>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 8;
|
||||
|
@ -2,21 +2,20 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/deformable_psroi_pooling.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, deformable_psroi_pooling_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::DeformablePSROIPooling>();
|
||||
auto input = make_shared<op::Parameter>(element::f32, Shape{2, 16, 67, 32});
|
||||
auto coords = make_shared<op::Parameter>(element::f32, Shape{300, 5});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::DeformablePSROIPooling>();
|
||||
auto input = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 16, 67, 32});
|
||||
auto coords = make_shared<ov::op::v0::Parameter>(element::f32, Shape{300, 5});
|
||||
|
||||
const int output_dim = 4;
|
||||
const float spatial_scale = 0.0625;
|
||||
@ -27,18 +26,18 @@ TEST(attributes, deformable_psroi_pooling_op) {
|
||||
const float trans_std = 0.1f;
|
||||
const int part_size = 3;
|
||||
|
||||
auto op = make_shared<opset1::DeformablePSROIPooling>(input,
|
||||
coords,
|
||||
output_dim,
|
||||
spatial_scale,
|
||||
group_size,
|
||||
mode,
|
||||
spatial_bins_x,
|
||||
spatial_bins_y,
|
||||
trans_std,
|
||||
part_size);
|
||||
auto op = make_shared<ov::op::v1::DeformablePSROIPooling>(input,
|
||||
coords,
|
||||
output_dim,
|
||||
spatial_scale,
|
||||
group_size,
|
||||
mode,
|
||||
spatial_bins_x,
|
||||
spatial_bins_y,
|
||||
trans_std,
|
||||
part_size);
|
||||
NodeBuilder builder(op, {input, coords});
|
||||
auto g_op = ov::as_type_ptr<opset1::DeformablePSROIPooling>(builder.create());
|
||||
auto g_op = ov::as_type_ptr<ov::op::v1::DeformablePSROIPooling>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_op->get_output_dim(), op->get_output_dim());
|
||||
EXPECT_EQ(g_op->get_spatial_scale(), op->get_spatial_scale());
|
||||
@ -51,10 +50,10 @@ TEST(attributes, deformable_psroi_pooling_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, deformable_psroi_pooling_op2) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::DeformablePSROIPooling>();
|
||||
auto input = make_shared<op::Parameter>(element::f32, Shape{2, 16, 67, 32});
|
||||
auto coords = make_shared<op::Parameter>(element::f32, Shape{300, 5});
|
||||
auto offset = make_shared<op::Parameter>(element::i64, Shape{300, 2, 2, 2});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::DeformablePSROIPooling>();
|
||||
auto input = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 16, 67, 32});
|
||||
auto coords = make_shared<ov::op::v0::Parameter>(element::f32, Shape{300, 5});
|
||||
auto offset = make_shared<ov::op::v0::Parameter>(element::i64, Shape{300, 2, 2, 2});
|
||||
|
||||
const int output_dim = 4;
|
||||
const float spatial_scale = 0.0625;
|
||||
@ -65,19 +64,19 @@ TEST(attributes, deformable_psroi_pooling_op2) {
|
||||
const float trans_std = 0.1f;
|
||||
const int part_size = 3;
|
||||
|
||||
auto op = make_shared<opset1::DeformablePSROIPooling>(input,
|
||||
coords,
|
||||
offset,
|
||||
output_dim,
|
||||
spatial_scale,
|
||||
group_size,
|
||||
mode,
|
||||
spatial_bins_x,
|
||||
spatial_bins_y,
|
||||
trans_std,
|
||||
part_size);
|
||||
auto op = make_shared<ov::op::v1::DeformablePSROIPooling>(input,
|
||||
coords,
|
||||
offset,
|
||||
output_dim,
|
||||
spatial_scale,
|
||||
group_size,
|
||||
mode,
|
||||
spatial_bins_x,
|
||||
spatial_bins_y,
|
||||
trans_std,
|
||||
part_size);
|
||||
NodeBuilder builder(op, {input, coords, offset});
|
||||
auto g_op = ov::as_type_ptr<opset1::DeformablePSROIPooling>(builder.create());
|
||||
auto g_op = ov::as_type_ptr<ov::op::v1::DeformablePSROIPooling>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_op->get_output_dim(), op->get_output_dim());
|
||||
EXPECT_EQ(g_op->get_spatial_scale(), op->get_spatial_scale());
|
||||
|
@ -2,29 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/depth_to_space.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, depth_to_space) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::DepthToSpace>();
|
||||
auto data = std::make_shared<op::Parameter>(element::f32, Shape{1, 8, 2, 2});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::DepthToSpace>();
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 8, 2, 2});
|
||||
|
||||
const auto block_size = 2;
|
||||
const auto mode = "blocks_first";
|
||||
|
||||
const auto dts = std::make_shared<opset1::DepthToSpace>(data, mode, block_size);
|
||||
const auto dts = std::make_shared<ov::op::v0::DepthToSpace>(data, mode, block_size);
|
||||
NodeBuilder builder(dts, {data});
|
||||
auto g_dts = ov::as_type_ptr<opset1::DepthToSpace>(builder.create());
|
||||
auto g_dts = ov::as_type_ptr<ov::op::v0::DepthToSpace>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 2;
|
||||
|
@ -4,20 +4,17 @@
|
||||
|
||||
#include "openvino/op/detection_output.hpp"
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/util/attr_types.hpp"
|
||||
#include "openvino/opsets/opset8.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using namespace ov::op;
|
||||
using namespace ov::op::util;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
namespace {
|
||||
void initialize_attributes(DetectionOutputBase::AttributesBase& attrs) {
|
||||
void initialize_attributes(ov::op::util::DetectionOutputBase::AttributesBase& attrs) {
|
||||
attrs.background_label_id = 0;
|
||||
attrs.top_k = 1;
|
||||
attrs.variance_encoded_in_target = false;
|
||||
@ -34,8 +31,8 @@ void initialize_attributes(DetectionOutputBase::AttributesBase& attrs) {
|
||||
attrs.input_width = 32;
|
||||
attrs.objectness_score = 0.73f;
|
||||
}
|
||||
void is_equal_attrs(const DetectionOutputBase::AttributesBase& attrs1,
|
||||
const DetectionOutputBase::AttributesBase& attrs2) {
|
||||
void is_equal_attrs(const ov::op::util::DetectionOutputBase::AttributesBase& attrs1,
|
||||
const ov::op::util::DetectionOutputBase::AttributesBase& attrs2) {
|
||||
EXPECT_EQ(attrs1.background_label_id, attrs2.background_label_id);
|
||||
EXPECT_EQ(attrs1.top_k, attrs2.top_k);
|
||||
EXPECT_EQ(attrs1.variance_encoded_in_target, attrs2.variance_encoded_in_target);
|
||||
@ -95,9 +92,9 @@ TEST(attributes, detection_output_v8) {
|
||||
initialize_attributes(attrs);
|
||||
|
||||
auto detection_output =
|
||||
make_shared<v8::DetectionOutput>(box_logits, class_preds, proposals, aux_class_preds, aux_box_pred, attrs);
|
||||
make_shared<op::v8::DetectionOutput>(box_logits, class_preds, proposals, aux_class_preds, aux_box_pred, attrs);
|
||||
NodeBuilder builder(detection_output, {box_logits, class_preds, proposals, aux_class_preds, aux_box_pred});
|
||||
auto g_detection_output = ov::as_type_ptr<v8::DetectionOutput>(builder.create());
|
||||
auto g_detection_output = ov::as_type_ptr<op::v8::DetectionOutput>(builder.create());
|
||||
|
||||
const auto do_attrs = detection_output->get_attrs();
|
||||
const auto g_do_attrs = g_detection_output->get_attrs();
|
||||
|
@ -2,14 +2,16 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/op/dft.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, dft_op) {
|
||||
NodeBuilder::get_ops().register_factory<op::v7::DFT>();
|
||||
@ -27,7 +29,7 @@ TEST(attributes, dft_op) {
|
||||
TEST(attributes, dft_op_signal) {
|
||||
NodeBuilder::get_ops().register_factory<op::v7::DFT>();
|
||||
auto data = make_shared<op::v0::Parameter>(element::f32, Shape{2, 10, 10, 2});
|
||||
auto signal = op::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {20});
|
||||
auto signal = ov::op::v0::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {20});
|
||||
auto axes = op::v0::Constant::create<int64_t>(element::i64, Shape{1}, {2});
|
||||
auto dft = make_shared<op::v7::DFT>(data, axes, signal);
|
||||
|
||||
|
@ -2,37 +2,27 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
/*
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/divide.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::Divide, ngraph::element::f32>>;
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
||||
*/
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, divide) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::Divide>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::Divide>();
|
||||
|
||||
const auto in1 = make_shared<op::Parameter>(element::f32, Shape{2, 4});
|
||||
const auto in2 = make_shared<op::Parameter>(element::f32, Shape{2, 4});
|
||||
const auto in1 = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 4});
|
||||
const auto in2 = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 4});
|
||||
const bool pythondiv = true;
|
||||
const op::AutoBroadcastSpec& auto_broadcast = op::AutoBroadcastSpec(op::AutoBroadcastType::NUMPY);
|
||||
const auto divide = make_shared<opset1::Divide>(in1, in2, pythondiv, auto_broadcast);
|
||||
const auto divide = make_shared<ov::op::v1::Divide>(in1, in2, pythondiv, auto_broadcast);
|
||||
|
||||
NodeBuilder builder(divide, {in1, in2});
|
||||
auto g_divide = ov::as_type_ptr<opset1::Divide>(builder.create());
|
||||
auto g_divide = ov::as_type_ptr<ov::op::v1::Divide>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 2;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,24 +2,23 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset7.hpp"
|
||||
#include "openvino/op/einsum.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, einsum_v7_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset7::Einsum>();
|
||||
auto input1 = make_shared<opset1::Parameter>(element::i32, Shape{2, 3});
|
||||
auto input2 = make_shared<opset1::Parameter>(element::i32, Shape{3, 4});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v7::Einsum>();
|
||||
auto input1 = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2, 3});
|
||||
auto input2 = make_shared<ov::op::v0::Parameter>(element::i32, Shape{3, 4});
|
||||
std::string equation = "ab,bc->ac";
|
||||
auto einsum = make_shared<opset7::Einsum>(OutputVector{input1, input2}, equation);
|
||||
auto einsum = make_shared<ov::op::v7::Einsum>(OutputVector{input1, input2}, equation);
|
||||
NodeBuilder builder(einsum, {input1, input2});
|
||||
auto g_einsum = ov::as_type_ptr<opset7::Einsum>(builder.create());
|
||||
auto g_einsum = ov::as_type_ptr<ov::op::v7::Einsum>(builder.create());
|
||||
EXPECT_EQ(g_einsum->get_equation(), einsum->get_equation());
|
||||
}
|
||||
|
@ -2,29 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/elu.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, elu_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::Elu>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 4});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::Elu>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 4});
|
||||
|
||||
double alpha = 0.1;
|
||||
|
||||
const auto elu = make_shared<opset1::Elu>(data, alpha);
|
||||
const auto elu = make_shared<ov::op::v0::Elu>(data, alpha);
|
||||
NodeBuilder builder(elu, {data});
|
||||
auto g_elu = ov::as_type_ptr<opset1::Elu>(builder.create());
|
||||
auto g_elu = ov::as_type_ptr<ov::op::v0::Elu>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_elu->get_alpha(), elu->get_alpha());
|
||||
}
|
||||
|
@ -2,68 +2,68 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "openvino/op/embedding_segments_sum.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(visitor_without_attribute, embedding_segments_sum_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::EmbeddingSegmentsSum>();
|
||||
auto emb_table = make_shared<op::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::EmbeddingSegmentsSum>();
|
||||
auto emb_table = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
|
||||
auto indices = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto segment_ids = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto num_segments = make_shared<op::Parameter>(element::i64, Shape{});
|
||||
auto per_sample_weights = make_shared<op::Parameter>(element::f32, Shape{4});
|
||||
auto default_index = make_shared<op::Parameter>(element::i64, Shape{});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto segment_ids = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto num_segments = make_shared<ov::op::v0::Parameter>(element::i64, Shape{});
|
||||
auto per_sample_weights = make_shared<ov::op::v0::Parameter>(element::f32, Shape{4});
|
||||
auto default_index = make_shared<ov::op::v0::Parameter>(element::i64, Shape{});
|
||||
|
||||
auto ess = make_shared<opset3::EmbeddingSegmentsSum>(emb_table,
|
||||
indices,
|
||||
segment_ids,
|
||||
num_segments,
|
||||
default_index,
|
||||
per_sample_weights);
|
||||
auto ess = make_shared<ov::op::v3::EmbeddingSegmentsSum>(emb_table,
|
||||
indices,
|
||||
segment_ids,
|
||||
num_segments,
|
||||
default_index,
|
||||
per_sample_weights);
|
||||
NodeBuilder builder(ess, {emb_table, indices, segment_ids, num_segments, default_index, per_sample_weights});
|
||||
EXPECT_NO_THROW(auto g_ess = ov::as_type_ptr<opset3::EmbeddingSegmentsSum>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_ess = ov::as_type_ptr<ov::op::v3::EmbeddingSegmentsSum>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
}
|
||||
|
||||
TEST(visitor_without_attribute, embedding_segments_sum_op2) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::EmbeddingSegmentsSum>();
|
||||
auto emb_table = make_shared<op::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::EmbeddingSegmentsSum>();
|
||||
auto emb_table = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
|
||||
auto indices = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto segment_ids = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto num_segments = make_shared<op::Parameter>(element::i64, Shape{});
|
||||
auto default_index = make_shared<op::Parameter>(element::i64, Shape{});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto segment_ids = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto num_segments = make_shared<ov::op::v0::Parameter>(element::i64, Shape{});
|
||||
auto default_index = make_shared<ov::op::v0::Parameter>(element::i64, Shape{});
|
||||
|
||||
auto ess = make_shared<opset3::EmbeddingSegmentsSum>(emb_table, indices, segment_ids, num_segments, default_index);
|
||||
auto ess =
|
||||
make_shared<ov::op::v3::EmbeddingSegmentsSum>(emb_table, indices, segment_ids, num_segments, default_index);
|
||||
NodeBuilder builder(ess, {emb_table, indices, segment_ids, num_segments, default_index});
|
||||
EXPECT_NO_THROW(auto g_ess = ov::as_type_ptr<opset3::EmbeddingSegmentsSum>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_ess = ov::as_type_ptr<ov::op::v3::EmbeddingSegmentsSum>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
}
|
||||
|
||||
TEST(visitor_without_attribute, embedding_segments_sum_op3) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::EmbeddingSegmentsSum>();
|
||||
auto emb_table = make_shared<op::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::EmbeddingSegmentsSum>();
|
||||
auto emb_table = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
|
||||
auto indices = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto segment_ids = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto num_segments = make_shared<op::Parameter>(element::i64, Shape{});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto segment_ids = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto num_segments = make_shared<ov::op::v0::Parameter>(element::i64, Shape{});
|
||||
|
||||
auto ess = make_shared<opset3::EmbeddingSegmentsSum>(emb_table, indices, segment_ids, num_segments);
|
||||
auto ess = make_shared<ov::op::v3::EmbeddingSegmentsSum>(emb_table, indices, segment_ids, num_segments);
|
||||
NodeBuilder builder(ess, {emb_table, indices, segment_ids, num_segments});
|
||||
EXPECT_NO_THROW(auto g_ess = ov::as_type_ptr<opset3::EmbeddingSegmentsSum>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_ess = ov::as_type_ptr<ov::op::v3::EmbeddingSegmentsSum>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,61 +2,59 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/embeddingbag_offsets_sum.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(visitor_without_attribute, embedding_bag_offsets_sum_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<op::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
|
||||
auto indices = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto offsets = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto default_index = make_shared<op::Parameter>(element::i64, Shape{});
|
||||
auto per_sample_weights = make_shared<op::Parameter>(element::f32, Shape{4});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto offsets = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto default_index = make_shared<ov::op::v0::Parameter>(element::i64, Shape{});
|
||||
auto per_sample_weights = make_shared<ov::op::v0::Parameter>(element::f32, Shape{4});
|
||||
|
||||
auto ebos =
|
||||
make_shared<opset3::EmbeddingBagOffsetsSum>(emb_table, indices, offsets, default_index, per_sample_weights);
|
||||
make_shared<ov::op::v3::EmbeddingBagOffsetsSum>(emb_table, indices, offsets, default_index, per_sample_weights);
|
||||
NodeBuilder builder(ebos, {emb_table, indices, offsets, default_index, per_sample_weights});
|
||||
EXPECT_NO_THROW(auto g_ebos = ov::as_type_ptr<opset3::EmbeddingBagOffsetsSum>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_ebos = ov::as_type_ptr<ov::op::v3::EmbeddingBagOffsetsSum>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
}
|
||||
|
||||
TEST(visitor_without_attribute, embedding_bag_offsets_sum_op2) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<op::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
|
||||
auto indices = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto offsets = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto default_index = make_shared<op::Parameter>(element::i64, Shape{});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto offsets = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto default_index = make_shared<ov::op::v0::Parameter>(element::i64, Shape{});
|
||||
|
||||
auto ebos = make_shared<opset3::EmbeddingBagOffsetsSum>(emb_table, indices, offsets, default_index);
|
||||
auto ebos = make_shared<ov::op::v3::EmbeddingBagOffsetsSum>(emb_table, indices, offsets, default_index);
|
||||
NodeBuilder builder(ebos, {emb_table, indices, offsets, default_index});
|
||||
EXPECT_NO_THROW(auto g_ebos = ov::as_type_ptr<opset3::EmbeddingBagOffsetsSum>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_ebos = ov::as_type_ptr<ov::op::v3::EmbeddingBagOffsetsSum>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
}
|
||||
|
||||
TEST(visitor_without_attribute, embedding_bag_offsets_sum_op3) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<op::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2, 3});
|
||||
|
||||
auto indices = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto offsets = make_shared<op::Parameter>(element::i64, Shape{4});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
auto offsets = make_shared<ov::op::v0::Parameter>(element::i64, Shape{4});
|
||||
|
||||
auto ebos = make_shared<opset3::EmbeddingBagOffsetsSum>(emb_table, indices, offsets);
|
||||
auto ebos = make_shared<ov::op::v3::EmbeddingBagOffsetsSum>(emb_table, indices, offsets);
|
||||
NodeBuilder builder(ebos, {emb_table, indices, offsets});
|
||||
EXPECT_NO_THROW(auto g_ebos = ov::as_type_ptr<opset3::EmbeddingBagOffsetsSum>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_ebos = ov::as_type_ptr<ov::op::v3::EmbeddingBagOffsetsSum>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,39 +2,39 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "openvino/op/embeddingbag_packedsum.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/embeddingbag_offsets_sum.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(visitor_without_attribute, embedding_bag_packed_sum_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<op::Parameter>(element::f32, Shape{5, 2});
|
||||
auto indices = make_shared<op::Parameter>(element::i64, Shape{3, 4});
|
||||
auto per_sample_weights = make_shared<op::Parameter>(element::f32, Shape{3, 4});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i64, Shape{3, 4});
|
||||
auto per_sample_weights = make_shared<ov::op::v0::Parameter>(element::f32, Shape{3, 4});
|
||||
|
||||
auto ebps = make_shared<opset3::EmbeddingBagPackedSum>(emb_table, indices, per_sample_weights);
|
||||
auto ebps = make_shared<ov::op::v3::EmbeddingBagPackedSum>(emb_table, indices, per_sample_weights);
|
||||
NodeBuilder builder(ebps, {emb_table, indices, per_sample_weights});
|
||||
EXPECT_NO_THROW(auto g_ebps = ov::as_type_ptr<opset3::EmbeddingBagPackedSum>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_ebps = ov::as_type_ptr<ov::op::v3::EmbeddingBagPackedSum>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
}
|
||||
|
||||
TEST(visitor_without_attribute, embedding_bag_packed_sum_op2) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<op::Parameter>(element::f32, Shape{5, 2});
|
||||
auto indices = make_shared<op::Parameter>(element::i64, Shape{3, 4});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::EmbeddingBagOffsetsSum>();
|
||||
auto emb_table = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i64, Shape{3, 4});
|
||||
|
||||
auto ebps = make_shared<opset3::EmbeddingBagPackedSum>(emb_table, indices);
|
||||
auto ebps = make_shared<ov::op::v3::EmbeddingBagPackedSum>(emb_table, indices);
|
||||
NodeBuilder builder(ebps, {emb_table, indices});
|
||||
EXPECT_NO_THROW(auto g_ebps = ov::as_type_ptr<opset3::EmbeddingBagPackedSum>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_ebps = ov::as_type_ptr<ov::op::v3::EmbeddingBagPackedSum>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/equal.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::Equal, ngraph::element::f32>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::Equal, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/erf.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Erf, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Erf, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_atrribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/exp.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Exp, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v0::Exp, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_atrribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,21 +2,20 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/experimental_detectron_detection_output.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset6.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
using Attrs = opset6::ExperimentalDetectronDetectionOutput::Attributes;
|
||||
using ExperimentalDetection = opset6::ExperimentalDetectronDetectionOutput;
|
||||
using Attrs = ov::op::v6::ExperimentalDetectronDetectionOutput::Attributes;
|
||||
using ExperimentalDetection = ov::op::v6::ExperimentalDetectronDetectionOutput;
|
||||
|
||||
TEST(attributes, detectron_detection_output) {
|
||||
NodeBuilder::get_ops().register_factory<ExperimentalDetection>();
|
||||
@ -31,10 +30,10 @@ TEST(attributes, detectron_detection_output) {
|
||||
attrs.post_nms_count = 2000;
|
||||
attrs.score_threshold = 0.05000000074505806f;
|
||||
|
||||
auto rois = std::make_shared<op::Parameter>(element::f32, Shape{1000, 4});
|
||||
auto deltas = std::make_shared<op::Parameter>(element::f32, Shape{1000, 324});
|
||||
auto scores = std::make_shared<op::Parameter>(element::f32, Shape{1000, 81});
|
||||
auto im_info = std::make_shared<op::Parameter>(element::f32, Shape{1, 3});
|
||||
auto rois = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1000, 4});
|
||||
auto deltas = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1000, 324});
|
||||
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1000, 81});
|
||||
auto im_info = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3});
|
||||
|
||||
auto detection = std::make_shared<ExperimentalDetection>(rois, deltas, scores, im_info, attrs);
|
||||
|
||||
|
@ -2,21 +2,20 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/experimental_detectron_generate_proposals.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset6.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
using ExperimentalProposals = opset6::ExperimentalDetectronGenerateProposalsSingleImage;
|
||||
using Attrs = opset6::ExperimentalDetectronGenerateProposalsSingleImage::Attributes;
|
||||
using ExperimentalProposals = ov::op::v6::ExperimentalDetectronGenerateProposalsSingleImage;
|
||||
using Attrs = ov::op::v6::ExperimentalDetectronGenerateProposalsSingleImage::Attributes;
|
||||
|
||||
TEST(attributes, detectron_proposals) {
|
||||
NodeBuilder::get_ops().register_factory<ExperimentalProposals>();
|
||||
@ -27,10 +26,10 @@ TEST(attributes, detectron_proposals) {
|
||||
attrs.post_nms_count = 1000;
|
||||
attrs.pre_nms_count = 1000;
|
||||
|
||||
auto im_info = std::make_shared<op::Parameter>(element::f32, Shape{3});
|
||||
auto anchors = std::make_shared<op::Parameter>(element::f32, Shape{201600, 4});
|
||||
auto deltas = std::make_shared<op::Parameter>(element::f32, Shape{12, 200, 336});
|
||||
auto scores = std::make_shared<op::Parameter>(element::f32, Shape{3, 200, 336});
|
||||
auto im_info = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{3});
|
||||
auto anchors = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{201600, 4});
|
||||
auto deltas = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{12, 200, 336});
|
||||
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{3, 200, 336});
|
||||
|
||||
auto proposals = std::make_shared<ExperimentalProposals>(im_info, anchors, deltas, scores, attrs);
|
||||
|
||||
|
@ -2,21 +2,20 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/experimental_detectron_prior_grid_generator.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset6.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
using ExperimentalGenerator = opset6::ExperimentalDetectronPriorGridGenerator;
|
||||
using Attrs = opset6::ExperimentalDetectronPriorGridGenerator::Attributes;
|
||||
using ExperimentalGenerator = ov::op::v6::ExperimentalDetectronPriorGridGenerator;
|
||||
using Attrs = ov::op::v6::ExperimentalDetectronPriorGridGenerator::Attributes;
|
||||
|
||||
TEST(attributes, detectron_prior_grid_generator) {
|
||||
NodeBuilder::get_ops().register_factory<ExperimentalGenerator>();
|
||||
@ -28,9 +27,9 @@ TEST(attributes, detectron_prior_grid_generator) {
|
||||
attrs.stride_x = 64;
|
||||
attrs.stride_y = 64;
|
||||
|
||||
auto priors = std::make_shared<op::Parameter>(element::f32, Shape{3, 4});
|
||||
auto feature_map = std::make_shared<op::Parameter>(element::f32, Shape{1, 3, 100, 100});
|
||||
auto im_data = std::make_shared<op::Parameter>(element::f32, Shape{1, 3, 100, 200});
|
||||
auto priors = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{3, 4});
|
||||
auto feature_map = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 100, 100});
|
||||
auto im_data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 100, 200});
|
||||
|
||||
auto proposals = std::make_shared<ExperimentalGenerator>(priors, feature_map, im_data, attrs);
|
||||
|
||||
|
@ -2,26 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset6.hpp"
|
||||
#include "openvino/op/experimental_detectron_topkrois.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, experimental_detectron_topkrois_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset6::ExperimentalDetectronTopKROIs>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v6::ExperimentalDetectronTopKROIs>();
|
||||
size_t num_rois = 1;
|
||||
auto input_rois = std::make_shared<op::Parameter>(element::f32, Shape{2, 4});
|
||||
auto input_probs = std::make_shared<op::Parameter>(element::f32, Shape{2});
|
||||
auto input_rois = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 4});
|
||||
auto input_probs = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2});
|
||||
auto topkrois = std::make_shared<op::v6::ExperimentalDetectronTopKROIs>(input_rois, input_probs, num_rois);
|
||||
|
||||
NodeBuilder builder(topkrois, {input_rois, input_probs});
|
||||
auto g_topkrois = ov::as_type_ptr<opset6::ExperimentalDetectronTopKROIs>(builder.create());
|
||||
auto g_topkrois = ov::as_type_ptr<ov::op::v6::ExperimentalDetectronTopKROIs>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_topkrois->get_max_rois(), topkrois->get_max_rois());
|
||||
}
|
||||
|
@ -2,32 +2,29 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/extractimagepatches.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, extractimagepatches_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset3::ExtractImagePatches>();
|
||||
auto data = make_shared<op::Parameter>(element::i32, Shape{64, 3, 10, 10});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::ExtractImagePatches>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::i32, Shape{64, 3, 10, 10});
|
||||
|
||||
auto sizes = Shape{3, 3};
|
||||
auto strides = Strides{5, 5};
|
||||
auto rates = Shape{1, 1};
|
||||
auto padtype_padding = ngraph::op::PadType::VALID;
|
||||
|
||||
auto extractimagepatches = make_shared<opset3::ExtractImagePatches>(data, sizes, strides, rates, padtype_padding);
|
||||
auto extractimagepatches =
|
||||
make_shared<ov::op::v3::ExtractImagePatches>(data, sizes, strides, rates, padtype_padding);
|
||||
NodeBuilder builder(extractimagepatches, {data});
|
||||
auto g_extractimagepatches = ov::as_type_ptr<opset3::ExtractImagePatches>(builder.create());
|
||||
auto g_extractimagepatches = ov::as_type_ptr<ov::op::v3::ExtractImagePatches>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 4;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,16 +2,16 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/opsets/opset9.hpp"
|
||||
#include "openvino/op/eye.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ov;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, eye_op) {
|
||||
NodeBuilder::get_ops().register_factory<op::v9::Eye>();
|
||||
|
@ -2,35 +2,31 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/fake_quantize.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, fake_quantize_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::FakeQuantize>();
|
||||
const auto data = make_shared<op::Parameter>(element::f32, Shape{1, 2, 3, 4});
|
||||
const auto input_low = make_shared<op::Parameter>(element::f32, Shape{});
|
||||
const auto input_high = make_shared<op::Parameter>(element::f32, Shape{});
|
||||
const auto output_low = make_shared<op::Parameter>(element::f32, Shape{});
|
||||
const auto output_high = make_shared<op::Parameter>(element::f32, Shape{});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::FakeQuantize>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 3, 4});
|
||||
const auto input_low = make_shared<ov::op::v0::Parameter>(element::f32, Shape{});
|
||||
const auto input_high = make_shared<ov::op::v0::Parameter>(element::f32, Shape{});
|
||||
const auto output_low = make_shared<ov::op::v0::Parameter>(element::f32, Shape{});
|
||||
const auto output_high = make_shared<ov::op::v0::Parameter>(element::f32, Shape{});
|
||||
|
||||
auto levels = 5;
|
||||
auto auto_broadcast = op::AutoBroadcastType::NUMPY;
|
||||
|
||||
const auto fake_quantize =
|
||||
make_shared<op::FakeQuantize>(data, input_low, input_high, output_low, output_high, levels, auto_broadcast);
|
||||
make_shared<op::v0::FakeQuantize>(data, input_low, input_high, output_low, output_high, levels, auto_broadcast);
|
||||
NodeBuilder builder(fake_quantize, {data, input_low, input_high, output_low, output_high});
|
||||
auto g_fake_quantize = ov::as_type_ptr<opset1::FakeQuantize>(builder.create());
|
||||
auto g_fake_quantize = ov::as_type_ptr<op::v0::FakeQuantize>(builder.create());
|
||||
|
||||
// attribute count
|
||||
const auto expected_attr_count = 2;
|
||||
|
@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/floor.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v0::Floor, ngraph::element::f32>,
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/floor_mod.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::FloorMod, ngraph::element::f32>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::FloorMod, ngraph::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -4,31 +4,31 @@
|
||||
|
||||
#include "openvino/op/util/framework_node.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "common_test_utils/graph_comparator.hpp"
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "openvino/op/util/attr_types.hpp"
|
||||
#include "openvino/opsets/opset10.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/multiply.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ov;
|
||||
using namespace ov::opset10;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, framework_node_op) {
|
||||
NodeBuilder::get_ops().register_factory<op::util::FrameworkNode>();
|
||||
auto X = make_shared<Parameter>(element::f32, Shape{1, 2, 2});
|
||||
auto Y = make_shared<Parameter>(element::f32, Shape{1, 2, 2});
|
||||
auto cond = make_shared<Constant>(element::boolean, Shape{1}, true);
|
||||
auto cond2 = make_shared<Constant>(element::boolean, Shape{1}, false);
|
||||
auto Xt = make_shared<Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Yt = make_shared<Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Xe = make_shared<Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Ye = make_shared<Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto then_op = make_shared<Multiply>(Xt, Yt);
|
||||
auto res0 = make_shared<Result>(then_op);
|
||||
auto res1 = make_shared<Result>(Xe);
|
||||
auto X = make_shared<op::v0::Parameter>(element::f32, Shape{1, 2, 2});
|
||||
auto Y = make_shared<op::v0::Parameter>(element::f32, Shape{1, 2, 2});
|
||||
auto cond = make_shared<op::v0::Constant>(element::boolean, Shape{1}, true);
|
||||
auto cond2 = make_shared<op::v0::Constant>(element::boolean, Shape{1}, false);
|
||||
auto Xt = make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Yt = make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Xe = make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Ye = make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto then_op = make_shared<op::v1::Multiply>(Xt, Yt);
|
||||
auto res0 = make_shared<op::v0::Result>(then_op);
|
||||
auto res1 = make_shared<op::v0::Result>(Xe);
|
||||
auto body1 = make_shared<Model>(OutputVector{res0}, ParameterVector{Xt, Yt});
|
||||
auto body2 = make_shared<Model>(OutputVector{res1}, ParameterVector{Xe});
|
||||
auto fn_op = make_shared<op::util::FrameworkNode>(OutputVector{cond}, 0, 2);
|
||||
|
@ -2,55 +2,54 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset7.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/gather.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, gather_v1_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::Gather>();
|
||||
auto data = make_shared<opset1::Parameter>(element::i32, Shape{2, 3, 4});
|
||||
auto indices = make_shared<opset1::Parameter>(element::i32, Shape{2});
|
||||
auto axis = make_shared<opset1::Constant>(element::i32, Shape{}, 2);
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::Gather>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2, 3, 4});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2});
|
||||
auto axis = make_shared<ov::op::v0::Constant>(element::i32, Shape{}, 2);
|
||||
|
||||
auto gather = make_shared<opset1::Gather>(data, indices, axis);
|
||||
auto gather = make_shared<ov::op::v1::Gather>(data, indices, axis);
|
||||
NodeBuilder builder(gather, {data, indices, axis});
|
||||
auto g_gather = ov::as_type_ptr<opset1::Gather>(builder.create());
|
||||
auto g_gather = ov::as_type_ptr<ov::op::v1::Gather>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gather->get_batch_dims(), gather->get_batch_dims());
|
||||
}
|
||||
|
||||
TEST(attributes, gather_v7_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset7::Gather>();
|
||||
auto data = make_shared<opset1::Parameter>(element::i32, Shape{2, 3, 4});
|
||||
auto indices = make_shared<opset1::Parameter>(element::i32, Shape{2});
|
||||
auto axis = make_shared<opset1::Constant>(element::i32, Shape{}, 2);
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v7::Gather>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2, 3, 4});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2});
|
||||
auto axis = make_shared<ov::op::v0::Constant>(element::i32, Shape{}, 2);
|
||||
int64_t batch_dims = 1;
|
||||
|
||||
auto gather = make_shared<opset7::Gather>(data, indices, axis, batch_dims);
|
||||
auto gather = make_shared<ov::op::v7::Gather>(data, indices, axis, batch_dims);
|
||||
NodeBuilder builder(gather, {data, indices, axis});
|
||||
auto g_gather = ov::as_type_ptr<opset7::Gather>(builder.create());
|
||||
auto g_gather = ov::as_type_ptr<ov::op::v7::Gather>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gather->get_batch_dims(), gather->get_batch_dims());
|
||||
}
|
||||
|
||||
TEST(attributes, gather_v8_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::Gather>();
|
||||
auto data = make_shared<opset1::Parameter>(element::i32, Shape{2, 3, 4});
|
||||
auto indices = make_shared<opset1::Parameter>(element::i32, Shape{2});
|
||||
auto axis = make_shared<opset1::Constant>(element::i32, Shape{}, 2);
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v8::Gather>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2, 3, 4});
|
||||
auto indices = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2});
|
||||
auto axis = make_shared<ov::op::v0::Constant>(element::i32, Shape{}, 2);
|
||||
int64_t batch_dims = 1;
|
||||
|
||||
auto gather = make_shared<opset8::Gather>(data, indices, axis, batch_dims);
|
||||
auto gather = make_shared<ov::op::v8::Gather>(data, indices, axis, batch_dims);
|
||||
NodeBuilder builder(gather, {data, indices, axis});
|
||||
auto g_gather = ov::as_type_ptr<opset8::Gather>(builder.create());
|
||||
auto g_gather = ov::as_type_ptr<ov::op::v8::Gather>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gather->get_batch_dims(), gather->get_batch_dims());
|
||||
}
|
||||
|
@ -2,26 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset6.hpp"
|
||||
#include "openvino/op/gather_elements.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, gather_elements_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset6::GatherElements>();
|
||||
auto arg1 = make_shared<opset1::Parameter>(element::i32, PartialShape{3});
|
||||
auto arg2 = make_shared<opset1::Parameter>(element::i32, PartialShape{7});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v6::GatherElements>();
|
||||
auto arg1 = make_shared<ov::op::v0::Parameter>(element::i32, PartialShape{3});
|
||||
auto arg2 = make_shared<ov::op::v0::Parameter>(element::i32, PartialShape{7});
|
||||
int64_t axis = 0;
|
||||
|
||||
auto gather_el = make_shared<opset6::GatherElements>(arg1, arg2, axis);
|
||||
auto gather_el = make_shared<ov::op::v6::GatherElements>(arg1, arg2, axis);
|
||||
NodeBuilder builder(gather_el, {arg1, arg2});
|
||||
auto g_gather_el = ov::as_type_ptr<opset6::GatherElements>(builder.create());
|
||||
auto g_gather_el = ov::as_type_ptr<ov::op::v6::GatherElements>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gather_el->get_axis(), gather_el->get_axis());
|
||||
}
|
||||
|
@ -2,40 +2,38 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/gather_nd.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, gather_nd_v5_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset5::GatherND>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v5::GatherND>();
|
||||
int batch_dims = 1;
|
||||
auto P = make_shared<op::Parameter>(element::f32, Shape{2, 3, 4});
|
||||
auto I = make_shared<op::Parameter>(element::i32, Shape{2, 1});
|
||||
auto P = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3, 4});
|
||||
auto I = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2, 1});
|
||||
auto G = make_shared<op::v5::GatherND>(P, I, batch_dims);
|
||||
|
||||
NodeBuilder builder(G, {P, I});
|
||||
auto g_G = ov::as_type_ptr<opset5::GatherND>(builder.create());
|
||||
auto g_G = ov::as_type_ptr<ov::op::v5::GatherND>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_G->get_batch_dims(), G->get_batch_dims());
|
||||
}
|
||||
|
||||
TEST(attributes, gather_nd_v8_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::GatherND>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v8::GatherND>();
|
||||
int batch_dims = 1;
|
||||
auto P = make_shared<op::Parameter>(element::f32, Shape{2, 3, 4});
|
||||
auto I = make_shared<op::Parameter>(element::i32, Shape{2, 1});
|
||||
auto P = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3, 4});
|
||||
auto I = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2, 1});
|
||||
auto G = make_shared<op::v8::GatherND>(P, I, batch_dims);
|
||||
|
||||
NodeBuilder builder(G, {P, I});
|
||||
auto g_G = ov::as_type_ptr<opset8::GatherND>(builder.create());
|
||||
auto g_G = ov::as_type_ptr<ov::op::v8::GatherND>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_G->get_batch_dims(), G->get_batch_dims());
|
||||
}
|
||||
|
@ -2,27 +2,26 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/gather_tree.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, gather_tree_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::GatherTree>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::GatherTree>();
|
||||
|
||||
auto step_ids = std::make_shared<op::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
auto parent_idx = std::make_shared<op::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
auto max_seq_len = std::make_shared<op::Parameter>(element::f32, Shape{2});
|
||||
auto end_token = std::make_shared<op::Parameter>(element::f32, Shape{});
|
||||
auto step_ids = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
auto parent_idx = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
auto max_seq_len = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2});
|
||||
auto end_token = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{});
|
||||
|
||||
auto gather_tree = std::make_shared<opset1::GatherTree>(step_ids, parent_idx, max_seq_len, end_token);
|
||||
auto gather_tree = std::make_shared<ov::op::v1::GatherTree>(step_ids, parent_idx, max_seq_len, end_token);
|
||||
NodeBuilder builder(gather_tree, {step_ids, parent_idx, max_seq_len, end_token});
|
||||
EXPECT_NO_THROW(auto g_gather_tree = ov::as_type_ptr<opset1::GatherTree>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_gather_tree = ov::as_type_ptr<ov::op::v1::GatherTree>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,53 +2,53 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset2.hpp"
|
||||
#include "ngraph/opsets/opset7.hpp"
|
||||
#include "openvino/op/gelu.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/dft.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, gelu_op_erf) {
|
||||
NodeBuilder::get_ops().register_factory<opset7::Gelu>();
|
||||
const auto data_input = make_shared<op::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v7::Gelu>();
|
||||
const auto data_input = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
const auto approximation_mode = op::GeluApproximationMode::ERF;
|
||||
const auto gelu = make_shared<opset7::Gelu>(data_input, approximation_mode);
|
||||
const auto gelu = make_shared<ov::op::v7::Gelu>(data_input, approximation_mode);
|
||||
NodeBuilder builder(gelu, {data_input});
|
||||
auto g_gelu = ov::as_type_ptr<opset7::Gelu>(builder.create());
|
||||
auto g_gelu = ov::as_type_ptr<ov::op::v7::Gelu>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gelu->get_approximation_mode(), gelu->get_approximation_mode());
|
||||
}
|
||||
|
||||
TEST(attributes, gelu_op_tanh) {
|
||||
NodeBuilder::get_ops().register_factory<opset7::Gelu>();
|
||||
const auto data_input = make_shared<op::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v7::Gelu>();
|
||||
const auto data_input = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
const auto approximation_mode = op::GeluApproximationMode::TANH;
|
||||
const auto gelu = make_shared<opset7::Gelu>(data_input, approximation_mode);
|
||||
const auto gelu = make_shared<ov::op::v7::Gelu>(data_input, approximation_mode);
|
||||
NodeBuilder builder(gelu, {data_input});
|
||||
auto g_gelu = ov::as_type_ptr<opset7::Gelu>(builder.create());
|
||||
auto g_gelu = ov::as_type_ptr<ov::op::v7::Gelu>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gelu->get_approximation_mode(), gelu->get_approximation_mode());
|
||||
}
|
||||
|
||||
TEST(attributes, gelu_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset7::Gelu>();
|
||||
const auto data_input = make_shared<op::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
const auto gelu = make_shared<opset7::Gelu>(data_input);
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v7::Gelu>();
|
||||
const auto data_input = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
const auto gelu = make_shared<ov::op::v7::Gelu>(data_input);
|
||||
NodeBuilder builder(gelu, {data_input});
|
||||
auto g_gelu = ov::as_type_ptr<opset7::Gelu>(builder.create());
|
||||
auto g_gelu = ov::as_type_ptr<ov::op::v7::Gelu>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gelu->get_approximation_mode(), gelu->get_approximation_mode());
|
||||
}
|
||||
|
||||
TEST(attributes, gelu_v0_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset2::Gelu>();
|
||||
const auto data_input = make_shared<op::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
const auto gelu = make_shared<opset2::Gelu>(data_input);
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::Gelu>();
|
||||
const auto data_input = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 3});
|
||||
const auto gelu = make_shared<ov::op::v0::Gelu>(data_input);
|
||||
NodeBuilder builder(gelu, {data_input});
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_NO_THROW(auto g_gelu = ov::as_type_ptr<op::v7::DFT>(builder.create()));
|
||||
|
@ -2,21 +2,20 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/generate_proposals.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset9.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
using GenerateProposals = opset9::GenerateProposals;
|
||||
using Attrs = opset9::GenerateProposals::Attributes;
|
||||
using GenerateProposals = ov::op::v9::GenerateProposals;
|
||||
using Attrs = ov::op::v9::GenerateProposals::Attributes;
|
||||
|
||||
TEST(attributes, generate_proposals) {
|
||||
NodeBuilder::get_ops().register_factory<GenerateProposals>();
|
||||
@ -29,10 +28,10 @@ TEST(attributes, generate_proposals) {
|
||||
attrs.normalized = true;
|
||||
attrs.nms_eta = 1.0f;
|
||||
|
||||
auto im_info = std::make_shared<op::Parameter>(element::f32, Shape{1, 4});
|
||||
auto anchors = std::make_shared<op::Parameter>(element::f32, Shape{200, 336, 3, 4});
|
||||
auto deltas = std::make_shared<op::Parameter>(element::f32, Shape{1, 12, 200, 336});
|
||||
auto scores = std::make_shared<op::Parameter>(element::f32, Shape{1, 3, 200, 336});
|
||||
auto im_info = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 4});
|
||||
auto anchors = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{200, 336, 3, 4});
|
||||
auto deltas = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 12, 200, 336});
|
||||
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 200, 336});
|
||||
|
||||
auto proposals = std::make_shared<GenerateProposals>(im_info, anchors, deltas, scores, attrs);
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/greater.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::Greater, ngraph::element::f32>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::Greater, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -3,8 +3,8 @@
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/greater_eq.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::GreaterEqual, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::GreaterEqual, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,24 +2,24 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/opsets/opset9.hpp"
|
||||
#include "openvino/op/grid_sample.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ov;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, grid_sample_defaults) {
|
||||
NodeBuilder::get_ops().register_factory<opset9::GridSample>();
|
||||
const auto data = make_shared<opset9::Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
const auto grid = make_shared<opset9::Parameter>(element::f32, Shape{1, 5, 5, 2});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v9::GridSample>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
const auto grid = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 5, 5, 2});
|
||||
|
||||
const auto op = make_shared<opset9::GridSample>(data, grid, opset9::GridSample::Attributes{});
|
||||
const auto op = make_shared<ov::op::v9::GridSample>(data, grid, ov::op::v9::GridSample::Attributes{});
|
||||
NodeBuilder builder(op, {data, grid});
|
||||
EXPECT_NO_THROW(auto g_op = ov::as_type_ptr<opset9::GridSample>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_op = ov::as_type_ptr<ov::op::v9::GridSample>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 3;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,25 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/grn.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, grn_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::GRN>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 3, 4, 5});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::GRN>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3, 4, 5});
|
||||
|
||||
float bias = 1.25f;
|
||||
|
||||
auto grn = make_shared<opset1::GRN>(data, bias);
|
||||
auto grn = make_shared<ov::op::v0::GRN>(data, bias);
|
||||
NodeBuilder builder(grn, {data});
|
||||
auto g_grn = ov::as_type_ptr<opset1::GRN>(builder.create());
|
||||
auto g_grn = ov::as_type_ptr<ov::op::v0::GRN>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 1;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,29 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/group_conv.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, group_conv_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::GroupConvolution>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 12, 224, 224});
|
||||
auto filters = make_shared<op::Parameter>(element::f32, Shape{4, 1, 3, 5, 5});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::GroupConvolution>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 12, 224, 224});
|
||||
auto filters = make_shared<ov::op::v0::Parameter>(element::f32, Shape{4, 1, 3, 5, 5});
|
||||
auto strides = Strides{1, 1};
|
||||
auto pads_begin = CoordinateDiff{1, 2};
|
||||
auto pads_end = CoordinateDiff{1, 2};
|
||||
auto dilations = Strides{1, 1};
|
||||
auto group_conv = make_shared<opset1::GroupConvolution>(data,
|
||||
auto group_conv = make_shared<op::v1::GroupConvolution>(data,
|
||||
filters,
|
||||
strides,
|
||||
pads_begin,
|
||||
@ -32,7 +28,7 @@ TEST(attributes, group_conv_op) {
|
||||
dilations,
|
||||
op::PadType::VALID);
|
||||
NodeBuilder builder(group_conv, {data, filters});
|
||||
auto g_group_conv = ov::as_type_ptr<opset1::GroupConvolution>(builder.create());
|
||||
auto g_group_conv = ov::as_type_ptr<op::v1::GroupConvolution>(builder.create());
|
||||
EXPECT_EQ(g_group_conv->get_strides(), group_conv->get_strides());
|
||||
EXPECT_EQ(g_group_conv->get_pads_begin(), group_conv->get_pads_begin());
|
||||
EXPECT_EQ(g_group_conv->get_pads_end(), group_conv->get_pads_end());
|
||||
@ -41,10 +37,10 @@ TEST(attributes, group_conv_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, group_conv_backprop_data_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::GroupConvolutionBackpropData>();
|
||||
const auto data = make_shared<op::Parameter>(element::f32, Shape{1, 20, 224, 224});
|
||||
const auto filter = make_shared<op::Parameter>(element::f32, Shape{4, 5, 2, 3, 3});
|
||||
const auto output_shape = make_shared<op::Parameter>(element::i32, Shape{2});
|
||||
NodeBuilder::get_ops().register_factory<op::v1::GroupConvolutionBackpropData>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 20, 224, 224});
|
||||
const auto filter = make_shared<ov::op::v0::Parameter>(element::f32, Shape{4, 5, 2, 3, 3});
|
||||
const auto output_shape = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2});
|
||||
|
||||
const auto strides = Strides{2, 1};
|
||||
const auto pads_begin = CoordinateDiff{3, 4};
|
||||
@ -53,7 +49,7 @@ TEST(attributes, group_conv_backprop_data_op) {
|
||||
const auto auto_pad = op::PadType::EXPLICIT;
|
||||
const auto output_padding = CoordinateDiff{3, 4};
|
||||
|
||||
const auto gcbd = make_shared<opset1::GroupConvolutionBackpropData>(data,
|
||||
const auto gcbd = make_shared<op::v1::GroupConvolutionBackpropData>(data,
|
||||
filter,
|
||||
output_shape,
|
||||
strides,
|
||||
@ -63,7 +59,7 @@ TEST(attributes, group_conv_backprop_data_op) {
|
||||
auto_pad,
|
||||
output_padding);
|
||||
NodeBuilder builder(gcbd, {data, filter});
|
||||
const auto g_gcbd = ov::as_type_ptr<opset1::GroupConvolutionBackpropData>(builder.create());
|
||||
const auto g_gcbd = ov::as_type_ptr<op::v1::GroupConvolutionBackpropData>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gcbd->get_strides(), gcbd->get_strides());
|
||||
EXPECT_EQ(g_gcbd->get_pads_begin(), gcbd->get_pads_begin());
|
||||
|
@ -2,25 +2,26 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/opsets/opset12.hpp"
|
||||
#include "openvino/op/group_normalization.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/unique.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ov;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, group_normalization) {
|
||||
NodeBuilder::get_ops().register_factory<opset12::Unique>();
|
||||
const auto data = make_shared<opset12::Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
const auto scale = make_shared<opset12::Parameter>(element::f32, Shape{3});
|
||||
const auto bias = make_shared<opset12::Parameter>(element::f32, Shape{3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v10::Unique>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
const auto scale = make_shared<ov::op::v0::Parameter>(element::f32, Shape{3});
|
||||
const auto bias = make_shared<ov::op::v0::Parameter>(element::f32, Shape{3});
|
||||
|
||||
const auto op = make_shared<opset12::GroupNormalization>(data, scale, bias, 3, 0.00001f);
|
||||
const auto op = make_shared<ov::op::v12::GroupNormalization>(data, scale, bias, 3, 0.00001f);
|
||||
NodeBuilder builder(op);
|
||||
auto g_unique = ov::as_type_ptr<opset12::GroupNormalization>(builder.create());
|
||||
auto g_unique = ov::as_type_ptr<ov::op::v12::GroupNormalization>(builder.create());
|
||||
|
||||
constexpr auto expected_attr_count = 2;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,44 +2,40 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/gru_cell.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, gru_cell_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset5::GRUCell>();
|
||||
auto X = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<op::Parameter>(element::f32, Shape{9, 3});
|
||||
auto R = make_shared<op::Parameter>(element::f32, Shape{9, 3});
|
||||
const auto initial_hidden_state = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::GRUCell>();
|
||||
auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<ov::op::v0::Parameter>(element::f32, Shape{9, 3});
|
||||
auto R = make_shared<ov::op::v0::Parameter>(element::f32, Shape{9, 3});
|
||||
const auto initial_hidden_state = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
|
||||
const auto hidden_size = 3;
|
||||
const std::vector<std::string> activations = {"tanh", "sigmoid"};
|
||||
auto activations_alpha = std::vector<float>{1.0, 1.5};
|
||||
auto activations_beta = std::vector<float>{2.0, 1.0};
|
||||
const float clip = 0.5f;
|
||||
const auto gru_cell = make_shared<opset5::GRUCell>(X,
|
||||
initial_hidden_state,
|
||||
W,
|
||||
R,
|
||||
hidden_size,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip,
|
||||
false);
|
||||
const auto gru_cell = make_shared<ov::op::v3::GRUCell>(X,
|
||||
initial_hidden_state,
|
||||
W,
|
||||
R,
|
||||
hidden_size,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip,
|
||||
false);
|
||||
NodeBuilder builder(gru_cell, {X, initial_hidden_state, W, R});
|
||||
auto g_gru_cell = ov::as_type_ptr<opset5::GRUCell>(builder.create());
|
||||
auto g_gru_cell = ov::as_type_ptr<ov::op::v3::GRUCell>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gru_cell->get_hidden_size(), gru_cell->get_hidden_size());
|
||||
EXPECT_EQ(g_gru_cell->get_activations(), gru_cell->get_activations());
|
||||
@ -50,31 +46,31 @@ TEST(attributes, gru_cell_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, gru_cell_op2) {
|
||||
NodeBuilder::get_ops().register_factory<opset5::GRUCell>();
|
||||
auto X = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<op::Parameter>(element::f32, Shape{9, 3});
|
||||
auto R = make_shared<op::Parameter>(element::f32, Shape{9, 3});
|
||||
const auto initial_hidden_state = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto B = make_shared<op::Parameter>(element::f32, Shape{9});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v3::GRUCell>();
|
||||
auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<ov::op::v0::Parameter>(element::f32, Shape{9, 3});
|
||||
auto R = make_shared<ov::op::v0::Parameter>(element::f32, Shape{9, 3});
|
||||
const auto initial_hidden_state = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{9});
|
||||
|
||||
const auto hidden_size = 3;
|
||||
const std::vector<std::string> activations = {"tanh", "sigmoid"};
|
||||
auto activations_alpha = std::vector<float>{1.0, 1.5};
|
||||
auto activations_beta = std::vector<float>{2.0, 1.0};
|
||||
const float clip = 0.5f;
|
||||
const auto gru_cell = make_shared<opset5::GRUCell>(X,
|
||||
initial_hidden_state,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
hidden_size,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip,
|
||||
false);
|
||||
const auto gru_cell = make_shared<ov::op::v3::GRUCell>(X,
|
||||
initial_hidden_state,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
hidden_size,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip,
|
||||
false);
|
||||
NodeBuilder builder(gru_cell, {X, initial_hidden_state, W, R, B});
|
||||
auto g_gru_cell = ov::as_type_ptr<opset5::GRUCell>(builder.create());
|
||||
auto g_gru_cell = ov::as_type_ptr<ov::op::v3::GRUCell>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gru_cell->get_hidden_size(), gru_cell->get_hidden_size());
|
||||
EXPECT_EQ(g_gru_cell->get_activations(), gru_cell->get_activations());
|
||||
|
@ -2,22 +2,18 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/gru_sequence.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, gru_sequence_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset5::GRUSequence>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v5::GRUSequence>();
|
||||
|
||||
const size_t batch_size = 4;
|
||||
const size_t num_directions = 2;
|
||||
@ -25,15 +21,16 @@ TEST(attributes, gru_sequence_op) {
|
||||
const size_t input_size = 16;
|
||||
const size_t hidden_size = 64;
|
||||
|
||||
const auto X = make_shared<op::Parameter>(element::f32, Shape{batch_size, seq_length, input_size});
|
||||
const auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, seq_length, input_size});
|
||||
const auto initial_hidden_state =
|
||||
make_shared<op::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto initial_cell_state =
|
||||
make_shared<op::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto sequence_lengths = make_shared<op::Parameter>(element::i32, Shape{batch_size});
|
||||
const auto W = make_shared<op::Parameter>(element::f32, Shape{num_directions, 3 * hidden_size, input_size});
|
||||
const auto R = make_shared<op::Parameter>(element::f32, Shape{num_directions, 3 * hidden_size, hidden_size});
|
||||
const auto B = make_shared<op::Parameter>(element::f32, Shape{num_directions, 3 * hidden_size});
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto sequence_lengths = make_shared<ov::op::v0::Parameter>(element::i32, Shape{batch_size});
|
||||
const auto W = make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 3 * hidden_size, input_size});
|
||||
const auto R =
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 3 * hidden_size, hidden_size});
|
||||
const auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 3 * hidden_size});
|
||||
|
||||
const auto gru_direction = op::RecurrentSequenceDirection::BIDIRECTIONAL;
|
||||
const std::vector<float> activations_alpha = {1, 2};
|
||||
@ -41,20 +38,20 @@ TEST(attributes, gru_sequence_op) {
|
||||
const std::vector<std::string> activations = {"tanh", "sigmoid"};
|
||||
const float clip_threshold = 0.5f;
|
||||
|
||||
const auto gru_sequence = make_shared<opset5::GRUSequence>(X,
|
||||
initial_hidden_state,
|
||||
sequence_lengths,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
hidden_size,
|
||||
gru_direction,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip_threshold);
|
||||
const auto gru_sequence = make_shared<ov::op::v5::GRUSequence>(X,
|
||||
initial_hidden_state,
|
||||
sequence_lengths,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
hidden_size,
|
||||
gru_direction,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip_threshold);
|
||||
NodeBuilder builder(gru_sequence, {X, initial_hidden_state, sequence_lengths, W, R, B});
|
||||
auto g_gru_sequence = ov::as_type_ptr<opset5::GRUSequence>(builder.create());
|
||||
auto g_gru_sequence = ov::as_type_ptr<ov::op::v5::GRUSequence>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_gru_sequence->get_hidden_size(), gru_sequence->get_hidden_size());
|
||||
EXPECT_EQ(g_gru_sequence->get_activations(), gru_sequence->get_activations());
|
||||
|
@ -2,25 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/hard_sigmoid.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, hardsigmoid_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::HardSigmoid>();
|
||||
const auto data = make_shared<op::Parameter>(element::f32, Shape{2, 5});
|
||||
const auto alpha = make_shared<op::Parameter>(element::f32, Shape{});
|
||||
const auto beta = make_shared<op::Parameter>(element::f32, Shape{});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::HardSigmoid>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 5});
|
||||
const auto alpha = make_shared<ov::op::v0::Parameter>(element::f32, Shape{});
|
||||
const auto beta = make_shared<ov::op::v0::Parameter>(element::f32, Shape{});
|
||||
|
||||
const auto hardsigmoid = make_shared<opset1::HardSigmoid>(data, alpha, beta);
|
||||
const auto hardsigmoid = make_shared<ov::op::v0::HardSigmoid>(data, alpha, beta);
|
||||
NodeBuilder builder(hardsigmoid, {data, alpha, beta});
|
||||
EXPECT_NO_THROW(auto g_hardsigmoid = ov::as_type_ptr<opset1::HardSigmoid>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_hardsigmoid = ov::as_type_ptr<ov::op::v0::HardSigmoid>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/hsigmoid.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v5::HSigmoid, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v5::HSigmoid, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_atrribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/hswish.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v4::HSwish, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v4::HSwish, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_atrribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,19 +2,21 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/op/idft.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, idft_op) {
|
||||
NodeBuilder::get_ops().register_factory<op::v7::IDFT>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 10, 10, 2});
|
||||
auto axes = op::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {2});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 10, 10, 2});
|
||||
auto axes = ov::op::v0::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {2});
|
||||
auto idft = make_shared<op::v7::IDFT>(data, axes);
|
||||
|
||||
NodeBuilder builder(idft, {data, axes});
|
||||
@ -26,9 +28,9 @@ TEST(attributes, idft_op) {
|
||||
|
||||
TEST(attributes, idft_op_signal) {
|
||||
NodeBuilder::get_ops().register_factory<op::v7::IDFT>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 10, 10, 2});
|
||||
auto axes = op::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {2});
|
||||
auto signal = op::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {20});
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 10, 10, 2});
|
||||
auto axes = ov::op::v0::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {2});
|
||||
auto signal = ov::op::v0::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {20});
|
||||
auto idft = make_shared<op::v7::IDFT>(data, axes, signal);
|
||||
|
||||
NodeBuilder builder(idft, {data, axes, signal});
|
||||
|
@ -2,35 +2,35 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/if.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "common_test_utils/graph_comparator.hpp"
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/multiply.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using namespace ngraph::opset8;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, if_op) {
|
||||
NodeBuilder::get_ops().register_factory<If>();
|
||||
auto X = make_shared<Parameter>(element::f32, Shape{1, 2, 2});
|
||||
auto Y = make_shared<Parameter>(element::f32, Shape{1, 2, 2});
|
||||
auto cond = std::make_shared<Constant>(element::boolean, Shape{1}, true);
|
||||
auto cond2 = std::make_shared<Constant>(element::boolean, Shape{1}, false);
|
||||
auto Xt = make_shared<op::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Yt = make_shared<op::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Xe = make_shared<op::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Ye = make_shared<op::Parameter>(element::f32, PartialShape::dynamic());
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v8::If>();
|
||||
auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 2});
|
||||
auto Y = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 2});
|
||||
auto cond = std::make_shared<ov::op::v0::Constant>(element::boolean, Shape{1}, true);
|
||||
auto cond2 = std::make_shared<ov::op::v0::Constant>(element::boolean, Shape{1}, false);
|
||||
auto Xt = make_shared<ov::op::v0::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Yt = make_shared<ov::op::v0::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Xe = make_shared<ov::op::v0::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto Ye = make_shared<ov::op::v0::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto then_op = std::make_shared<op::v1::Multiply>(Xt, Yt);
|
||||
auto res0 = make_shared<op::Result>(then_op);
|
||||
auto res1 = make_shared<op::Result>(Xe);
|
||||
auto then_body = make_shared<ngraph::Function>(OutputVector{res0}, ParameterVector{Xt, Yt});
|
||||
auto else_body = make_shared<ngraph::Function>(OutputVector{res1}, ParameterVector{Xe});
|
||||
auto if_op = make_shared<If>(cond);
|
||||
auto res0 = make_shared<ov::op::v0::Result>(then_op);
|
||||
auto res1 = make_shared<ov::op::v0::Result>(Xe);
|
||||
auto then_body = make_shared<ov::Model>(OutputVector{res0}, ParameterVector{Xt, Yt});
|
||||
auto else_body = make_shared<ov::Model>(OutputVector{res1}, ParameterVector{Xe});
|
||||
auto if_op = make_shared<ov::op::v8::If>(cond);
|
||||
if_op->set_then_body(then_body);
|
||||
if_op->set_else_body(else_body);
|
||||
if_op->set_input(X, Xt, Xe);
|
||||
@ -38,7 +38,7 @@ TEST(attributes, if_op) {
|
||||
if_op->set_output(res0, res1);
|
||||
if_op->validate_and_infer_types();
|
||||
NodeBuilder builder(if_op);
|
||||
auto g_if = ov::as_type_ptr<If>(builder.create());
|
||||
auto g_if = ov::as_type_ptr<ov::op::v8::If>(builder.create());
|
||||
EXPECT_EQ(g_if->get_input_descriptions(0), if_op->get_input_descriptions(0));
|
||||
EXPECT_EQ(g_if->get_input_descriptions(1), if_op->get_input_descriptions(1));
|
||||
EXPECT_EQ(g_if->get_output_descriptions(0), if_op->get_output_descriptions(0));
|
||||
|
@ -2,27 +2,24 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset11.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/interpolate.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, interpolate_op1) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::Interpolate>();
|
||||
auto img = make_shared<op::Parameter>(element::f32, Shape{1, 3, 32, 32});
|
||||
auto out_shape = make_shared<op::Parameter>(element::i32, Shape{2});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::Interpolate>();
|
||||
auto img = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 32, 32});
|
||||
auto out_shape = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2});
|
||||
|
||||
op::v0::InterpolateAttrs interp_atrs;
|
||||
op::v0::Interpolate::Attributes interp_atrs;
|
||||
interp_atrs.axes = AxisSet{1, 2};
|
||||
interp_atrs.mode = "cubic";
|
||||
interp_atrs.align_corners = true;
|
||||
@ -30,9 +27,9 @@ TEST(attributes, interpolate_op1) {
|
||||
interp_atrs.pads_begin = vector<size_t>{0, 0};
|
||||
interp_atrs.pads_end = vector<size_t>{0, 0};
|
||||
|
||||
auto interpolate = make_shared<opset1::Interpolate>(img, out_shape, interp_atrs);
|
||||
auto interpolate = make_shared<ov::op::v0::Interpolate>(img, out_shape, interp_atrs);
|
||||
NodeBuilder builder(interpolate, {img, out_shape});
|
||||
auto g_interpolate = ov::as_type_ptr<opset1::Interpolate>(builder.create());
|
||||
auto g_interpolate = ov::as_type_ptr<ov::op::v0::Interpolate>(builder.create());
|
||||
|
||||
const auto i_attrs = interpolate->get_attrs();
|
||||
const auto g_i_attrs = g_interpolate->get_attrs();
|
||||
@ -46,9 +43,9 @@ TEST(attributes, interpolate_op1) {
|
||||
}
|
||||
|
||||
TEST(attributes, interpolate_op4) {
|
||||
NodeBuilder::get_ops().register_factory<opset4::Interpolate>();
|
||||
auto img = make_shared<op::Parameter>(element::f32, Shape{1, 3, 32, 32});
|
||||
auto out_shape = make_shared<op::Parameter>(element::i32, Shape{2});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v4::Interpolate>();
|
||||
auto img = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 32, 32});
|
||||
auto out_shape = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2});
|
||||
auto scales = op::v0::Constant::create(element::f32, {1}, {1.0});
|
||||
|
||||
op::v4::Interpolate::InterpolateAttrs attrs;
|
||||
@ -61,9 +58,9 @@ TEST(attributes, interpolate_op4) {
|
||||
attrs.antialias = true;
|
||||
attrs.cube_coeff = -0.75;
|
||||
|
||||
auto interpolate = make_shared<opset4::Interpolate>(img, out_shape, scales, attrs);
|
||||
auto interpolate = make_shared<ov::op::v4::Interpolate>(img, out_shape, scales, attrs);
|
||||
NodeBuilder builder(interpolate, {img, out_shape, scales});
|
||||
auto g_interpolate = ov::as_type_ptr<opset4::Interpolate>(builder.create());
|
||||
auto g_interpolate = ov::as_type_ptr<ov::op::v4::Interpolate>(builder.create());
|
||||
|
||||
const auto i_attrs = interpolate->get_attrs();
|
||||
const auto g_i_attrs = g_interpolate->get_attrs();
|
||||
@ -79,8 +76,8 @@ TEST(attributes, interpolate_op4) {
|
||||
}
|
||||
|
||||
TEST(attributes, interpolate_op11) {
|
||||
NodeBuilder::get_ops().register_factory<opset11::Interpolate>();
|
||||
const auto img = make_shared<op::Parameter>(element::f32, Shape{1, 3, 32, 32});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v11::Interpolate>();
|
||||
const auto img = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 32, 32});
|
||||
const auto scales = op::v0::Constant::create(element::f32, {4}, {1.0, 1.0, 2.0, 2.0});
|
||||
|
||||
op::v11::Interpolate::InterpolateAttrs attrs;
|
||||
@ -93,9 +90,9 @@ TEST(attributes, interpolate_op11) {
|
||||
attrs.antialias = true;
|
||||
attrs.cube_coeff = -0.75;
|
||||
|
||||
auto interpolate = make_shared<opset11::Interpolate>(img, scales, attrs);
|
||||
auto interpolate = make_shared<ov::op::v11::Interpolate>(img, scales, attrs);
|
||||
NodeBuilder builder(interpolate, {img, scales});
|
||||
auto g_interpolate = ov::as_type_ptr<opset11::Interpolate>(builder.create());
|
||||
auto g_interpolate = ov::as_type_ptr<ov::op::v11::Interpolate>(builder.create());
|
||||
|
||||
const auto i_attrs = interpolate->get_attrs();
|
||||
const auto g_i_attrs = g_interpolate->get_attrs();
|
||||
|
@ -2,14 +2,16 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/op/irdft.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, irdft_op) {
|
||||
NodeBuilder::get_ops().register_factory<op::v9::IRDFT>();
|
||||
@ -27,7 +29,7 @@ TEST(attributes, irdft_op) {
|
||||
TEST(attributes, irdft_op_signal) {
|
||||
NodeBuilder::get_ops().register_factory<op::v9::IRDFT>();
|
||||
auto data = make_shared<op::v0::Parameter>(element::f32, Shape{2, 10, 10, 2});
|
||||
auto signal = op::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {20});
|
||||
auto signal = op::v0::Constant::create<int64_t>(element::Type_t::i64, Shape{1}, {20});
|
||||
auto axes = op::v0::Constant::create<int64_t>(element::i64, Shape{1}, {2});
|
||||
auto irdft = make_shared<op::v9::IRDFT>(data, axes, signal);
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/opsets/opset10.hpp"
|
||||
#include "openvino/op/is_finite.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v10::IsFinite, ngraph::element::f32>>;
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v10::IsFinite, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Types, UnaryOperatorTypeName);
|
||||
|
@ -2,25 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/opsets/opset10.hpp"
|
||||
#include "openvino/op/is_inf.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ov;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov::opset10;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, is_inf_defaults) {
|
||||
NodeBuilder::get_ops().register_factory<IsInf>();
|
||||
const auto data = make_shared<Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v10::IsInf>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
|
||||
const auto is_inf = make_shared<IsInf>(data);
|
||||
const auto is_inf = make_shared<ov::op::v10::IsInf>(data);
|
||||
NodeBuilder builder(is_inf);
|
||||
|
||||
auto g_is_inf = ov::as_type_ptr<IsInf>(builder.create());
|
||||
auto g_is_inf = ov::as_type_ptr<ov::op::v10::IsInf>(builder.create());
|
||||
|
||||
const auto is_inf_attrs = is_inf->get_attributes();
|
||||
const auto g_is_inf_attrs = g_is_inf->get_attributes();
|
||||
@ -30,15 +30,15 @@ TEST(attributes, is_inf_defaults) {
|
||||
}
|
||||
|
||||
TEST(attributes, is_inf_positive_only) {
|
||||
NodeBuilder::get_ops().register_factory<IsInf>();
|
||||
const auto data = make_shared<Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v10::IsInf>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
|
||||
IsInf::Attributes attributes{};
|
||||
ov::op::v10::IsInf::Attributes attributes{};
|
||||
attributes.detect_negative = false;
|
||||
const auto is_inf = make_shared<IsInf>(data, attributes);
|
||||
const auto is_inf = make_shared<ov::op::v10::IsInf>(data, attributes);
|
||||
NodeBuilder builder(is_inf);
|
||||
|
||||
auto g_is_inf = ov::as_type_ptr<IsInf>(builder.create());
|
||||
auto g_is_inf = ov::as_type_ptr<ov::op::v10::IsInf>(builder.create());
|
||||
|
||||
const auto is_inf_attrs = is_inf->get_attributes();
|
||||
const auto g_is_inf_attrs = g_is_inf->get_attributes();
|
||||
@ -48,15 +48,15 @@ TEST(attributes, is_inf_positive_only) {
|
||||
}
|
||||
|
||||
TEST(attributes, is_inf_negative_only) {
|
||||
NodeBuilder::get_ops().register_factory<IsInf>();
|
||||
const auto data = make_shared<Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v10::IsInf>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
|
||||
IsInf::Attributes attributes{};
|
||||
ov::op::v10::IsInf::Attributes attributes{};
|
||||
attributes.detect_positive = false;
|
||||
const auto is_inf = make_shared<IsInf>(data, attributes);
|
||||
const auto is_inf = make_shared<ov::op::v10::IsInf>(data, attributes);
|
||||
NodeBuilder builder(is_inf);
|
||||
|
||||
auto g_is_inf = ov::as_type_ptr<IsInf>(builder.create());
|
||||
auto g_is_inf = ov::as_type_ptr<ov::op::v10::IsInf>(builder.create());
|
||||
|
||||
const auto is_inf_attrs = is_inf->get_attributes();
|
||||
const auto g_is_inf_attrs = g_is_inf->get_attributes();
|
||||
@ -66,16 +66,16 @@ TEST(attributes, is_inf_negative_only) {
|
||||
}
|
||||
|
||||
TEST(attributes, is_inf_detect_none) {
|
||||
NodeBuilder::get_ops().register_factory<IsInf>();
|
||||
const auto data = make_shared<Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v10::IsInf>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 3, 10, 10});
|
||||
|
||||
IsInf::Attributes attributes{};
|
||||
ov::op::v10::IsInf::Attributes attributes{};
|
||||
attributes.detect_negative = false;
|
||||
attributes.detect_positive = false;
|
||||
const auto is_inf = make_shared<IsInf>(data, attributes);
|
||||
const auto is_inf = make_shared<ov::op::v10::IsInf>(data, attributes);
|
||||
NodeBuilder builder(is_inf);
|
||||
|
||||
auto g_is_inf = ov::as_type_ptr<IsInf>(builder.create());
|
||||
auto g_is_inf = ov::as_type_ptr<ov::op::v10::IsInf>(builder.create());
|
||||
|
||||
const auto is_inf_attrs = is_inf->get_attributes();
|
||||
const auto g_is_inf_attrs = g_is_inf->get_attributes();
|
||||
|
@ -2,7 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/is_nan.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v10::IsNaN, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Types, UnaryOperatorTypeName);
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/less.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::Less, ngraph::element::f32>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::Less, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -3,8 +3,8 @@
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/less_eq.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::LessEqual, ngraph::element::f32>>;
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::LessEqual, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,9 +2,11 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/log.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v0::Log, ngraph::element::f32>,
|
||||
UnaryOperatorType<ov::op::v0::Log, ngraph::element::f16>>;
|
||||
using Types = ::testing::Types<UnaryOperatorType<ov::op::v0::Log, ov::element::f32>,
|
||||
UnaryOperatorType<ov::op::v0::Log, ov::element::f16>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Types, UnaryOperatorTypeName);
|
||||
|
@ -2,29 +2,25 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/log_softmax.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, logsoftmax_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset5::LogSoftmax>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{3, 2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v5::LogSoftmax>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{3, 2, 3});
|
||||
|
||||
int64_t axis = 2;
|
||||
|
||||
const auto logsoftmax = make_shared<opset5::LogSoftmax>(data, axis);
|
||||
const auto logsoftmax = make_shared<ov::op::v5::LogSoftmax>(data, axis);
|
||||
NodeBuilder builder(logsoftmax, {data});
|
||||
auto g_logsoftmax = ov::as_type_ptr<opset5::LogSoftmax>(builder.create());
|
||||
auto g_logsoftmax = ov::as_type_ptr<ov::op::v5::LogSoftmax>(builder.create());
|
||||
|
||||
const auto expected_attr_count = 1;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/logical_and.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::LogicalAnd, ngraph::element::boolean>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::LogicalAnd, ov::element::boolean>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,8 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/op/logical_not.hpp"
|
||||
|
||||
#include "unary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v1::LogicalNot, ngraph::element::boolean>>;
|
||||
using Type = ::testing::Types<UnaryOperatorType<ov::op::v1::LogicalNot, ov::element::boolean>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, UnaryOperatorVisitor, Type, UnaryOperatorTypeName);
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/logical_or.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::LogicalOr, ngraph::element::boolean>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::LogicalOr, ov::element::boolean>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/logical_xor.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::LogicalXor, ngraph::element::boolean>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::LogicalXor, ov::element::boolean>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,33 +2,29 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/lrn.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, lrn_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::LRN>();
|
||||
const auto arg = make_shared<op::Parameter>(element::f32, Shape{1, 2, 3, 4});
|
||||
const auto axes = make_shared<op::Parameter>(element::i32, Shape{2});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::LRN>();
|
||||
const auto arg = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2, 3, 4});
|
||||
const auto axes = make_shared<ov::op::v0::Parameter>(element::i32, Shape{2});
|
||||
|
||||
const double alpha = 1.1;
|
||||
const double beta = 2.2;
|
||||
const double bias = 3.3;
|
||||
const size_t size = 4;
|
||||
|
||||
const auto lrn = make_shared<opset1::LRN>(arg, axes, alpha, beta, bias, size);
|
||||
const auto lrn = make_shared<ov::op::v0::LRN>(arg, axes, alpha, beta, bias, size);
|
||||
NodeBuilder builder(lrn, {arg, axes});
|
||||
auto g_lrn = ov::as_type_ptr<opset1::LRN>(builder.create());
|
||||
auto g_lrn = ov::as_type_ptr<ov::op::v0::LRN>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_lrn->get_alpha(), lrn->get_alpha());
|
||||
EXPECT_EQ(g_lrn->get_beta(), lrn->get_beta());
|
||||
|
@ -2,28 +2,24 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/lstm_cell.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, lstm_cell_v0_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::LSTMCell>();
|
||||
auto X = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto H = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<op::Parameter>(element::f32, Shape{12, 3});
|
||||
auto R = make_shared<op::Parameter>(element::f32, Shape{12, 3});
|
||||
const auto initial_hidden_state = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
const auto initial_cell_state = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::LSTMCell>();
|
||||
auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto H = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<ov::op::v0::Parameter>(element::f32, Shape{12, 3});
|
||||
auto R = make_shared<ov::op::v0::Parameter>(element::f32, Shape{12, 3});
|
||||
const auto initial_hidden_state = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
const auto initial_cell_state = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
|
||||
const auto hidden_size = 3;
|
||||
auto weights_format = ov::op::LSTMWeightsFormat::IFCO;
|
||||
@ -32,20 +28,20 @@ TEST(attributes, lstm_cell_v0_op) {
|
||||
auto activations_beta = std::vector<float>{2.0, 1.0};
|
||||
const float clip = 0.5f;
|
||||
auto input_forget = false;
|
||||
const auto lstm_cell = make_shared<opset1::LSTMCell>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
W,
|
||||
R,
|
||||
hidden_size,
|
||||
weights_format,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip,
|
||||
input_forget);
|
||||
const auto lstm_cell = make_shared<ov::op::v0::LSTMCell>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
W,
|
||||
R,
|
||||
hidden_size,
|
||||
weights_format,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip,
|
||||
input_forget);
|
||||
NodeBuilder builder(lstm_cell, {X, initial_hidden_state, initial_cell_state, W, R});
|
||||
auto g_lstm_cell = ov::as_type_ptr<opset1::LSTMCell>(builder.create());
|
||||
auto g_lstm_cell = ov::as_type_ptr<ov::op::v0::LSTMCell>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_lstm_cell->get_hidden_size(), lstm_cell->get_hidden_size());
|
||||
EXPECT_EQ(g_lstm_cell->get_activations(), lstm_cell->get_activations());
|
||||
@ -55,31 +51,31 @@ TEST(attributes, lstm_cell_v0_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, lstm_cell_v4_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset4::LSTMCell>();
|
||||
auto X = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto H = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<op::Parameter>(element::f32, Shape{12, 3});
|
||||
auto R = make_shared<op::Parameter>(element::f32, Shape{12, 3});
|
||||
const auto initial_hidden_state = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
const auto initial_cell_state = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v4::LSTMCell>();
|
||||
auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto H = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<ov::op::v0::Parameter>(element::f32, Shape{12, 3});
|
||||
auto R = make_shared<ov::op::v0::Parameter>(element::f32, Shape{12, 3});
|
||||
const auto initial_hidden_state = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
const auto initial_cell_state = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
|
||||
const auto hidden_size = 3;
|
||||
const std::vector<std::string> activations = {"tanh", "sigmoid", "tanh"};
|
||||
auto activations_alpha = std::vector<float>{1.0, 1.5};
|
||||
auto activations_beta = std::vector<float>{2.0, 1.0};
|
||||
const float clip = 0.5f;
|
||||
const auto lstm_cell = make_shared<opset4::LSTMCell>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
W,
|
||||
R,
|
||||
hidden_size,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip);
|
||||
const auto lstm_cell = make_shared<ov::op::v4::LSTMCell>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
W,
|
||||
R,
|
||||
hidden_size,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip);
|
||||
NodeBuilder builder(lstm_cell, {X, initial_hidden_state, initial_cell_state, W, R});
|
||||
auto g_lstm_cell = ov::as_type_ptr<opset4::LSTMCell>(builder.create());
|
||||
auto g_lstm_cell = ov::as_type_ptr<ov::op::v4::LSTMCell>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_lstm_cell->get_hidden_size(), lstm_cell->get_hidden_size());
|
||||
EXPECT_EQ(g_lstm_cell->get_activations(), lstm_cell->get_activations());
|
||||
@ -89,33 +85,33 @@ TEST(attributes, lstm_cell_v4_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, lstm_cell_v4_op2) {
|
||||
NodeBuilder::get_ops().register_factory<opset4::LSTMCell>();
|
||||
auto X = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto H = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<op::Parameter>(element::f32, Shape{12, 3});
|
||||
auto R = make_shared<op::Parameter>(element::f32, Shape{12, 3});
|
||||
const auto initial_hidden_state = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
const auto initial_cell_state = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto B = make_shared<op::Parameter>(element::f32, Shape{12});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v4::LSTMCell>();
|
||||
auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto H = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto W = make_shared<ov::op::v0::Parameter>(element::f32, Shape{12, 3});
|
||||
auto R = make_shared<ov::op::v0::Parameter>(element::f32, Shape{12, 3});
|
||||
const auto initial_hidden_state = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
const auto initial_cell_state = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3});
|
||||
auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{12});
|
||||
|
||||
const auto hidden_size = 3;
|
||||
const std::vector<std::string> activations = {"tanh", "sigmoid", "tanh"};
|
||||
auto activations_alpha = std::vector<float>{1.0, 1.5};
|
||||
auto activations_beta = std::vector<float>{2.0, 1.0};
|
||||
const float clip = 0.5f;
|
||||
const auto lstm_cell = make_shared<opset4::LSTMCell>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
hidden_size,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip);
|
||||
const auto lstm_cell = make_shared<ov::op::v4::LSTMCell>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
hidden_size,
|
||||
activations,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
clip);
|
||||
NodeBuilder builder(lstm_cell, {X, initial_hidden_state, initial_cell_state, W, R, B});
|
||||
auto g_lstm_cell = ov::as_type_ptr<opset4::LSTMCell>(builder.create());
|
||||
auto g_lstm_cell = ov::as_type_ptr<ov::op::v4::LSTMCell>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_lstm_cell->get_hidden_size(), lstm_cell->get_hidden_size());
|
||||
EXPECT_EQ(g_lstm_cell->get_activations(), lstm_cell->get_activations());
|
||||
|
@ -2,22 +2,18 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/lstm_sequence.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, lstm_sequence_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset5::LSTMSequence>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v5::LSTMSequence>();
|
||||
|
||||
const size_t batch_size = 4;
|
||||
const size_t num_directions = 2;
|
||||
@ -25,15 +21,16 @@ TEST(attributes, lstm_sequence_op) {
|
||||
const size_t input_size = 16;
|
||||
const size_t hidden_size = 64;
|
||||
|
||||
const auto X = make_shared<op::Parameter>(element::f32, Shape{batch_size, seq_length, input_size});
|
||||
const auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, seq_length, input_size});
|
||||
const auto initial_hidden_state =
|
||||
make_shared<op::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto initial_cell_state =
|
||||
make_shared<op::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto sequence_lengths = make_shared<op::Parameter>(element::i32, Shape{batch_size});
|
||||
const auto W = make_shared<op::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size, input_size});
|
||||
const auto R = make_shared<op::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size, hidden_size});
|
||||
const auto B = make_shared<op::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size});
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto sequence_lengths = make_shared<ov::op::v0::Parameter>(element::i32, Shape{batch_size});
|
||||
const auto W = make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size, input_size});
|
||||
const auto R =
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size, hidden_size});
|
||||
const auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size});
|
||||
|
||||
const auto lstm_direction = op::RecurrentSequenceDirection::BIDIRECTIONAL;
|
||||
const std::vector<float> activations_alpha = {1, 2, 3};
|
||||
@ -41,21 +38,21 @@ TEST(attributes, lstm_sequence_op) {
|
||||
const std::vector<std::string> activations = {"tanh", "sigmoid", "tanh"};
|
||||
const float clip_threshold = 0.5f;
|
||||
|
||||
const auto lstm_sequence = make_shared<opset5::LSTMSequence>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
sequence_lengths,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
hidden_size,
|
||||
lstm_direction,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
activations,
|
||||
clip_threshold);
|
||||
const auto lstm_sequence = make_shared<ov::op::v5::LSTMSequence>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
sequence_lengths,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
hidden_size,
|
||||
lstm_direction,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
activations,
|
||||
clip_threshold);
|
||||
NodeBuilder builder(lstm_sequence, {X, initial_hidden_state, initial_cell_state, sequence_lengths, W, R, B});
|
||||
auto g_lstm_sequence = ov::as_type_ptr<opset5::LSTMSequence>(builder.create());
|
||||
auto g_lstm_sequence = ov::as_type_ptr<ov::op::v5::LSTMSequence>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_lstm_sequence->get_hidden_size(), lstm_sequence->get_hidden_size());
|
||||
EXPECT_EQ(g_lstm_sequence->get_activations(), lstm_sequence->get_activations());
|
||||
@ -66,7 +63,7 @@ TEST(attributes, lstm_sequence_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, lstm_sequence_v1_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset5::LSTMSequence>();
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v5::LSTMSequence>();
|
||||
|
||||
const size_t batch_size = 4;
|
||||
const size_t num_directions = 2;
|
||||
@ -74,16 +71,17 @@ TEST(attributes, lstm_sequence_v1_op) {
|
||||
const size_t input_size = 16;
|
||||
const size_t hidden_size = 64;
|
||||
|
||||
const auto X = make_shared<op::Parameter>(element::f32, Shape{batch_size, seq_length, input_size});
|
||||
const auto X = make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, seq_length, input_size});
|
||||
const auto initial_hidden_state =
|
||||
make_shared<op::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto initial_cell_state =
|
||||
make_shared<op::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto sequence_lengths = make_shared<op::Parameter>(element::i32, Shape{batch_size});
|
||||
const auto W = make_shared<op::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size, input_size});
|
||||
const auto R = make_shared<op::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size, hidden_size});
|
||||
const auto B = make_shared<op::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size});
|
||||
const auto P = make_shared<op::Parameter>(element::f32, Shape{num_directions, 3 * hidden_size});
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{batch_size, num_directions, hidden_size});
|
||||
const auto sequence_lengths = make_shared<ov::op::v0::Parameter>(element::i32, Shape{batch_size});
|
||||
const auto W = make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size, input_size});
|
||||
const auto R =
|
||||
make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size, hidden_size});
|
||||
const auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 4 * hidden_size});
|
||||
const auto P = make_shared<ov::op::v0::Parameter>(element::f32, Shape{num_directions, 3 * hidden_size});
|
||||
|
||||
const auto lstm_direction = op::RecurrentSequenceDirection::BIDIRECTIONAL;
|
||||
const ov::op::LSTMWeightsFormat weights_format = ov::op::LSTMWeightsFormat::FICO;
|
||||
@ -93,24 +91,24 @@ TEST(attributes, lstm_sequence_v1_op) {
|
||||
const float clip_threshold = 0.5f;
|
||||
const bool input_forget = true;
|
||||
|
||||
const auto lstm_sequence = make_shared<opset1::LSTMSequence>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
sequence_lengths,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
P,
|
||||
hidden_size,
|
||||
lstm_direction,
|
||||
weights_format,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
activations,
|
||||
clip_threshold,
|
||||
input_forget);
|
||||
const auto lstm_sequence = make_shared<ov::op::v0::LSTMSequence>(X,
|
||||
initial_hidden_state,
|
||||
initial_cell_state,
|
||||
sequence_lengths,
|
||||
W,
|
||||
R,
|
||||
B,
|
||||
P,
|
||||
hidden_size,
|
||||
lstm_direction,
|
||||
weights_format,
|
||||
activations_alpha,
|
||||
activations_beta,
|
||||
activations,
|
||||
clip_threshold,
|
||||
input_forget);
|
||||
NodeBuilder builder(lstm_sequence, {X, initial_hidden_state, initial_cell_state, sequence_lengths, W, R, B, P});
|
||||
auto g_lstm_sequence = ov::as_type_ptr<opset1::LSTMSequence>(builder.create());
|
||||
auto g_lstm_sequence = ov::as_type_ptr<ov::op::v0::LSTMSequence>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_lstm_sequence->get_hidden_size(), lstm_sequence->get_hidden_size());
|
||||
EXPECT_EQ(g_lstm_sequence->get_activations(), lstm_sequence->get_activations());
|
||||
|
@ -2,102 +2,98 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/matmul.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, matmul_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::MatMul>();
|
||||
auto A = make_shared<op::Parameter>(element::f32, Shape{0, 2});
|
||||
auto B = make_shared<op::Parameter>(element::f32, Shape{2, 0});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::MatMul>();
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, Shape{0, 2});
|
||||
auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 0});
|
||||
|
||||
bool transpose_a = true;
|
||||
bool transpose_b = true;
|
||||
|
||||
auto matmul = make_shared<opset1::MatMul>(A, B, transpose_a, transpose_b);
|
||||
auto matmul = make_shared<ov::op::v0::MatMul>(A, B, transpose_a, transpose_b);
|
||||
NodeBuilder builder(matmul, {A, B});
|
||||
auto g_matmul = ov::as_type_ptr<opset1::MatMul>(builder.create());
|
||||
auto g_matmul = ov::as_type_ptr<ov::op::v0::MatMul>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a());
|
||||
EXPECT_EQ(g_matmul->get_transpose_b(), matmul->get_transpose_b());
|
||||
}
|
||||
|
||||
TEST(attributes, matmul_op2) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::MatMul>();
|
||||
auto A = make_shared<op::Parameter>(element::f32, Shape{10, 2});
|
||||
auto B = make_shared<op::Parameter>(element::f32, Shape{2, 1});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::MatMul>();
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, Shape{10, 2});
|
||||
auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 1});
|
||||
|
||||
bool transpose_a = false;
|
||||
bool transpose_b = false;
|
||||
|
||||
auto matmul = make_shared<opset1::MatMul>(A, B, transpose_a, transpose_b);
|
||||
auto matmul = make_shared<ov::op::v0::MatMul>(A, B, transpose_a, transpose_b);
|
||||
NodeBuilder builder(matmul, {A, B});
|
||||
auto g_matmul = ov::as_type_ptr<opset1::MatMul>(builder.create());
|
||||
auto g_matmul = ov::as_type_ptr<ov::op::v0::MatMul>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a());
|
||||
EXPECT_EQ(g_matmul->get_transpose_b(), matmul->get_transpose_b());
|
||||
}
|
||||
|
||||
TEST(attributes, matmul_op3) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::MatMul>();
|
||||
auto A = make_shared<op::Parameter>(element::f32, Shape{2, 10});
|
||||
auto B = make_shared<op::Parameter>(element::f32, Shape{2, 1});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::MatMul>();
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 10});
|
||||
auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 1});
|
||||
|
||||
bool transpose_a = true;
|
||||
bool transpose_b = false;
|
||||
|
||||
auto matmul = make_shared<opset1::MatMul>(A, B, transpose_a, transpose_b);
|
||||
auto matmul = make_shared<ov::op::v0::MatMul>(A, B, transpose_a, transpose_b);
|
||||
NodeBuilder builder(matmul, {A, B});
|
||||
auto g_matmul = ov::as_type_ptr<opset1::MatMul>(builder.create());
|
||||
auto g_matmul = ov::as_type_ptr<ov::op::v0::MatMul>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a());
|
||||
EXPECT_EQ(g_matmul->get_transpose_b(), matmul->get_transpose_b());
|
||||
}
|
||||
|
||||
TEST(attributes, matmul_op4) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::MatMul>();
|
||||
auto A = make_shared<op::Parameter>(element::f32, Shape{2, 3, 2});
|
||||
auto B = make_shared<op::Parameter>(element::f32, Shape{3, 2, 2, 1});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::MatMul>();
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 3, 2});
|
||||
auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{3, 2, 2, 1});
|
||||
|
||||
auto matmul = make_shared<opset1::MatMul>(A, B);
|
||||
auto matmul = make_shared<ov::op::v0::MatMul>(A, B);
|
||||
NodeBuilder builder(matmul, {A, B});
|
||||
auto g_matmul = ov::as_type_ptr<opset1::MatMul>(builder.create());
|
||||
auto g_matmul = ov::as_type_ptr<ov::op::v0::MatMul>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a());
|
||||
EXPECT_EQ(g_matmul->get_transpose_b(), matmul->get_transpose_b());
|
||||
}
|
||||
|
||||
TEST(attributes, matmul_op5) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::MatMul>();
|
||||
auto A = make_shared<op::Parameter>(element::f32, Shape{2});
|
||||
auto B = make_shared<op::Parameter>(element::f32, Shape{2, 10});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::MatMul>();
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2});
|
||||
auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 10});
|
||||
|
||||
auto matmul = make_shared<opset1::MatMul>(A, B);
|
||||
auto matmul = make_shared<ov::op::v0::MatMul>(A, B);
|
||||
NodeBuilder builder(matmul, {A, B});
|
||||
auto g_matmul = ov::as_type_ptr<opset1::MatMul>(builder.create());
|
||||
auto g_matmul = ov::as_type_ptr<ov::op::v0::MatMul>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a());
|
||||
EXPECT_EQ(g_matmul->get_transpose_b(), matmul->get_transpose_b());
|
||||
}
|
||||
|
||||
TEST(attributes, matmul_op6) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::MatMul>();
|
||||
auto A = make_shared<op::Parameter>(element::f32, Shape{1, 2048});
|
||||
auto B = make_shared<op::Parameter>(element::f32, Shape{2048, 1000});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v0::MatMul>();
|
||||
auto A = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 2048});
|
||||
auto B = make_shared<ov::op::v0::Parameter>(element::f32, Shape{2048, 1000});
|
||||
|
||||
auto matmul = make_shared<opset1::MatMul>(A, B);
|
||||
auto matmul = make_shared<ov::op::v0::MatMul>(A, B);
|
||||
NodeBuilder builder(matmul, {A, B});
|
||||
auto g_matmul = ov::as_type_ptr<opset1::MatMul>(builder.create());
|
||||
auto g_matmul = ov::as_type_ptr<ov::op::v0::MatMul>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a());
|
||||
EXPECT_EQ(g_matmul->get_transpose_b(), matmul->get_transpose_b());
|
||||
|
@ -2,42 +2,37 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset3.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/matrix_nms.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, matrix_nms_v8_op_custom_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::MatrixNms>();
|
||||
auto boxes = make_shared<op::Parameter>(element::f32, Shape{1, 1, 4});
|
||||
auto scores = make_shared<op::Parameter>(element::f32, Shape{1, 1, 1});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v8::MatrixNms>();
|
||||
auto boxes = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 4});
|
||||
auto scores = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1});
|
||||
|
||||
opset8::MatrixNms::Attributes attrs;
|
||||
attrs.sort_result_type = opset8::MatrixNms::SortResultType::SCORE;
|
||||
attrs.output_type = ngraph::element::i32;
|
||||
ov::op::v8::MatrixNms::Attributes attrs;
|
||||
attrs.sort_result_type = ov::op::v8::MatrixNms::SortResultType::SCORE;
|
||||
attrs.output_type = ov::element::i32;
|
||||
attrs.nms_top_k = 100;
|
||||
attrs.keep_top_k = 10;
|
||||
attrs.sort_result_across_batch = true;
|
||||
attrs.score_threshold = 0.1f;
|
||||
attrs.background_class = 2;
|
||||
attrs.decay_function = opset8::MatrixNms::DecayFunction::GAUSSIAN;
|
||||
attrs.decay_function = ov::op::v8::MatrixNms::DecayFunction::GAUSSIAN;
|
||||
attrs.gaussian_sigma = 0.2f;
|
||||
attrs.post_threshold = 0.3f;
|
||||
attrs.normalized = false;
|
||||
|
||||
auto nms = make_shared<opset8::MatrixNms>(boxes, scores, attrs);
|
||||
auto nms = make_shared<ov::op::v8::MatrixNms>(boxes, scores, attrs);
|
||||
NodeBuilder builder(nms, {boxes, scores});
|
||||
auto g_nms = ov::as_type_ptr<opset8::MatrixNms>(builder.create());
|
||||
auto g_nms = ov::as_type_ptr<ov::op::v8::MatrixNms>(builder.create());
|
||||
const auto expected_attr_count = 11;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
||||
@ -70,13 +65,13 @@ TEST(attributes, matrix_nms_v8_op_custom_attributes) {
|
||||
}
|
||||
|
||||
TEST(attributes, matrix_nms_v8_op_default_attributes) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::MatrixNms>();
|
||||
auto boxes = make_shared<op::Parameter>(element::f32, Shape{1, 1, 4});
|
||||
auto scores = make_shared<op::Parameter>(element::f32, Shape{1, 1, 1});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v8::MatrixNms>();
|
||||
auto boxes = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 4});
|
||||
auto scores = make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1});
|
||||
|
||||
auto nms = make_shared<opset8::MatrixNms>(boxes, scores, opset8::MatrixNms::Attributes());
|
||||
auto nms = make_shared<ov::op::v8::MatrixNms>(boxes, scores, ov::op::v8::MatrixNms::Attributes());
|
||||
NodeBuilder builder(nms, {boxes, scores});
|
||||
auto g_nms = ov::as_type_ptr<opset8::MatrixNms>(builder.create());
|
||||
auto g_nms = ov::as_type_ptr<ov::op::v8::MatrixNms>(builder.create());
|
||||
const auto expected_attr_count = 11;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
||||
|
@ -2,21 +2,19 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "ngraph/opsets/opset8.hpp"
|
||||
#include "openvino/op/max_pool.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using ngraph::test::ValueMap;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, max_pool_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset1::MaxPool>();
|
||||
auto data = make_shared<op::Parameter>(element::f32, Shape{64, 3, 5});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v1::MaxPool>();
|
||||
auto data = make_shared<ov::op::v0::Parameter>(element::f32, Shape{64, 3, 5});
|
||||
|
||||
auto strides = Strides{2};
|
||||
auto pads_begin = Shape{1};
|
||||
@ -25,9 +23,10 @@ TEST(attributes, max_pool_op) {
|
||||
auto rounding_mode = op::RoundingType::FLOOR;
|
||||
auto auto_pad = op::PadType::EXPLICIT;
|
||||
|
||||
auto max_pool = make_shared<opset1::MaxPool>(data, strides, pads_begin, pads_end, kernel, rounding_mode, auto_pad);
|
||||
auto max_pool =
|
||||
make_shared<ov::op::v1::MaxPool>(data, strides, pads_begin, pads_end, kernel, rounding_mode, auto_pad);
|
||||
NodeBuilder builder(max_pool, {data});
|
||||
auto g_max_pool = ov::as_type_ptr<opset1::MaxPool>(builder.create());
|
||||
auto g_max_pool = ov::as_type_ptr<ov::op::v1::MaxPool>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_max_pool->get_strides(), max_pool->get_strides());
|
||||
EXPECT_EQ(g_max_pool->get_pads_begin(), max_pool->get_pads_begin());
|
||||
@ -38,8 +37,8 @@ TEST(attributes, max_pool_op) {
|
||||
}
|
||||
|
||||
TEST(attributes, max_pool_v8_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset8::MaxPool>();
|
||||
const auto data = make_shared<op::Parameter>(element::i32, Shape{1, 3, 37, 37});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v8::MaxPool>();
|
||||
const auto data = make_shared<ov::op::v0::Parameter>(element::i32, Shape{1, 3, 37, 37});
|
||||
|
||||
const auto strides = Strides{1, 1};
|
||||
const auto dilations = Strides{1, 1};
|
||||
@ -50,17 +49,17 @@ TEST(attributes, max_pool_v8_op) {
|
||||
const auto auto_pad = op::PadType::EXPLICIT;
|
||||
const element::Type& index_element_type = element::i32;
|
||||
|
||||
const auto max_pool = make_shared<opset8::MaxPool>(data,
|
||||
strides,
|
||||
dilations,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
kernel,
|
||||
rounding_mode,
|
||||
auto_pad,
|
||||
index_element_type);
|
||||
const auto max_pool = make_shared<ov::op::v8::MaxPool>(data,
|
||||
strides,
|
||||
dilations,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
kernel,
|
||||
rounding_mode,
|
||||
auto_pad,
|
||||
index_element_type);
|
||||
NodeBuilder builder(max_pool, {data});
|
||||
auto g_max_pool = ov::as_type_ptr<opset8::MaxPool>(builder.create());
|
||||
auto g_max_pool = ov::as_type_ptr<ov::op::v8::MaxPool>(builder.create());
|
||||
|
||||
EXPECT_EQ(g_max_pool->get_strides(), max_pool->get_strides());
|
||||
EXPECT_EQ(g_max_pool->get_dilations(), max_pool->get_dilations());
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/maximum.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::Maximum, ngraph::element::f32>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::Maximum, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,9 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "binary_ops.hpp"
|
||||
#include "ngraph/opsets/opset1.hpp"
|
||||
#include "openvino/op/minimum.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ngraph::opset1::Minimum, ngraph::element::f32>>;
|
||||
#include "binary_ops.hpp"
|
||||
|
||||
using Type = ::testing::Types<BinaryOperatorType<ov::op::v1::Minimum, ov::element::f32>>;
|
||||
|
||||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_with_auto_broadcast, BinaryOperatorVisitor, Type, BinaryOperatorTypeName);
|
||||
|
@ -2,23 +2,22 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "common_test_utils/visitor.hpp"
|
||||
#include "openvino/op/mish.hpp"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "visitors/visitors.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
using ngraph::test::NodeBuilder;
|
||||
using namespace ov;
|
||||
using ov::test::NodeBuilder;
|
||||
|
||||
TEST(attributes, mish_op) {
|
||||
NodeBuilder::get_ops().register_factory<opset4::Mish>();
|
||||
const auto A = make_shared<op::Parameter>(element::f32, Shape{5, 2});
|
||||
NodeBuilder::get_ops().register_factory<ov::op::v4::Mish>();
|
||||
const auto A = make_shared<ov::op::v0::Parameter>(element::f32, Shape{5, 2});
|
||||
|
||||
const auto mish = make_shared<opset4::Mish>(A);
|
||||
const auto mish = make_shared<ov::op::v4::Mish>(A);
|
||||
NodeBuilder builder(mish, {A});
|
||||
EXPECT_NO_THROW(auto g_mish = ov::as_type_ptr<opset4::Mish>(builder.create()));
|
||||
EXPECT_NO_THROW(auto g_mish = ov::as_type_ptr<ov::op::v4::Mish>(builder.create()));
|
||||
|
||||
const auto expected_attr_count = 0;
|
||||
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user