diff --git a/src/core/tests/visitors/op/adaptive_avg_pool.cpp b/src/core/tests/visitors/op/adaptive_avg_pool.cpp index 79d878e77b5201..139946beb70cd0 100644 --- a/src/core/tests/visitors/op/adaptive_avg_pool.cpp +++ b/src/core/tests/visitors/op/adaptive_avg_pool.cpp @@ -18,7 +18,7 @@ TEST(attributes, adaptive_avg_pool_op) { const auto out_shape = op::Constant::create(element::i64, Shape{2}, {4, 3}); const auto adaptive_pool = make_shared(A, out_shape); - NodeBuilder builder(adaptive_pool); + NodeBuilder builder(adaptive_pool, {A, out_shape}); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/adaptive_max_pool.cpp b/src/core/tests/visitors/op/adaptive_max_pool.cpp index 8d6140b00400ac..3c7860fc812c08 100644 --- a/src/core/tests/visitors/op/adaptive_max_pool.cpp +++ b/src/core/tests/visitors/op/adaptive_max_pool.cpp @@ -18,7 +18,7 @@ TEST(attributes, adaptive_max_pool_op) { const auto out_shape = op::Constant::create(element::i64, Shape{2}, {4, 3}); const auto adaptive_pool = make_shared(A, out_shape); - NodeBuilder builder(adaptive_pool); + NodeBuilder builder(adaptive_pool, {A, out_shape}); auto g_adaptive_pool = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/assign.cpp b/src/core/tests/visitors/op/assign.cpp index cca991228ae529..bd65f6dac2800f 100644 --- a/src/core/tests/visitors/op/assign.cpp +++ b/src/core/tests/visitors/op/assign.cpp @@ -20,7 +20,7 @@ TEST(attributes, assign_v3_op) { const string variable_id = "v0"; const auto read_value = make_shared(in, variable_id); const auto assign = make_shared(read_value, variable_id); - NodeBuilder builder(assign); + NodeBuilder builder(assign, {read_value}); // attribute count const auto expected_attr_count = 1; @@ -33,7 +33,7 @@ TEST(attributes, assign_v6_op) { const auto variable = std::make_shared(VariableInfo{PartialShape::dynamic(), element::dynamic, "v0"}); const auto read_value = make_shared(in, variable); const auto assign = make_shared(read_value, variable); - NodeBuilder builder(assign); + NodeBuilder builder(assign, {read_value}); // attribute count const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/avg_pool.cpp b/src/core/tests/visitors/op/avg_pool.cpp index 13db240b47b7b8..25787eadb1ee18 100644 --- a/src/core/tests/visitors/op/avg_pool.cpp +++ b/src/core/tests/visitors/op/avg_pool.cpp @@ -29,7 +29,7 @@ TEST(attributes, avg_pool_op) { auto avg_pool = make_shared(data, strides, pads_begin, pads_end, kernel, exclude_pad, rounding_mode, auto_pad); - NodeBuilder builder(avg_pool); + NodeBuilder builder(avg_pool, {data}); auto g_avg_pool = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_avg_pool->get_strides(), avg_pool->get_strides()); @@ -54,7 +54,7 @@ TEST(attributes, avg_pool_v8_op) { const auto avg_pool = make_shared(data, strides, pads_begin, pads_end, kernel, exclude_pad, rounding_mode, auto_pad); - NodeBuilder builder(avg_pool); + NodeBuilder builder(avg_pool, {data}); auto g_avg_pool = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_avg_pool->get_strides(), avg_pool->get_strides()); diff --git a/src/core/tests/visitors/op/batch_norm.cpp b/src/core/tests/visitors/op/batch_norm.cpp index 688beaa1005743..12a75de8201e73 100644 --- a/src/core/tests/visitors/op/batch_norm.cpp +++ b/src/core/tests/visitors/op/batch_norm.cpp @@ -16,34 +16,44 @@ using namespace ngraph; using ngraph::test::NodeBuilder; using ngraph::test::ValueMap; -template -class BatchNormAttrTest : public ::testing::Test {}; - -TYPED_TEST_SUITE_P(BatchNormAttrTest); - -TYPED_TEST_P(BatchNormAttrTest, batch_norm_inference_op) { +TEST(attributes, batch_norm_inference_op_v5) { PartialShape in_shape{1, 10}; PartialShape ch_shape{in_shape[1]}; element::Type et = element::f32; double epsilon = 0.001; - NodeBuilder::get_ops().register_factory(); + NodeBuilder::get_ops().register_factory(); auto data_batch = make_shared(et, in_shape); auto gamma = make_shared(et, ch_shape); auto beta = make_shared(et, ch_shape); auto mean = make_shared(et, ch_shape); auto var = make_shared(et, ch_shape); - auto batch_norm = make_shared(data_batch, gamma, beta, mean, var, epsilon); + auto batch_norm = make_shared(data_batch, gamma, beta, mean, var, epsilon); const auto expected_attr_count = 1; - NodeBuilder builder(batch_norm); + 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(builder.create()); + auto g_batch_norm = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_batch_norm->get_eps_value(), batch_norm->get_eps_value()); } -REGISTER_TYPED_TEST_SUITE_P(BatchNormAttrTest, batch_norm_inference_op); +TEST(attributes, batch_norm_inference_op_v0) { + PartialShape in_shape{1, 10}; + PartialShape ch_shape{in_shape[1]}; + element::Type et = element::f32; + double epsilon = 0.001; -using Types = ::testing::Types; + NodeBuilder::get_ops().register_factory(); + auto data_batch = make_shared(et, in_shape); + auto gamma = make_shared(et, ch_shape); + auto beta = make_shared(et, ch_shape); + auto mean = make_shared(et, ch_shape); + auto var = make_shared(et, ch_shape); + auto batch_norm = make_shared(data_batch, gamma, beta, mean, var, epsilon); -INSTANTIATE_TYPED_TEST_SUITE_P(attributes, BatchNormAttrTest, Types); + const auto expected_attr_count = 1; + 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(builder.create()); + EXPECT_EQ(g_batch_norm->get_eps_value(), batch_norm->get_eps_value()); +} diff --git a/src/core/tests/visitors/op/batch_to_space.cpp b/src/core/tests/visitors/op/batch_to_space.cpp index 0948aa9659d166..2b5aee787a80e1 100644 --- a/src/core/tests/visitors/op/batch_to_space.cpp +++ b/src/core/tests/visitors/op/batch_to_space.cpp @@ -19,7 +19,7 @@ TEST(attributes, batch_to_space_op) { auto crops_end = make_shared(element::i64, Shape{2}, vector{0, 0}); auto batch2space = make_shared(data, block_shape, crops_begin, crops_end); - NodeBuilder builder(batch2space); + NodeBuilder builder(batch2space, {data}); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/binary_convolution.cpp b/src/core/tests/visitors/op/binary_convolution.cpp index 8c860cd4383972..de9511134c367c 100644 --- a/src/core/tests/visitors/op/binary_convolution.cpp +++ b/src/core/tests/visitors/op/binary_convolution.cpp @@ -40,7 +40,7 @@ TEST(attributes, bin_convolution) { mode, pad_value, auto_pad); - NodeBuilder builder(conv); + NodeBuilder builder(conv, {data_batch, filters}); auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count diff --git a/src/core/tests/visitors/op/binary_ops.hpp b/src/core/tests/visitors/op/binary_ops.hpp index 5d4fe0a9746b62..b705005da330ca 100644 --- a/src/core/tests/visitors/op/binary_ops.hpp +++ b/src/core/tests/visitors/op/binary_ops.hpp @@ -49,7 +49,7 @@ TYPED_TEST_P(BinaryOperatorVisitor, Auto_Broadcast) auto auto_broadcast = ngraph::op::AutoBroadcastType::NUMPY; const auto op_func = std::make_shared(A, B, auto_broadcast); - ngraph::test::NodeBuilder builder(op_func); + ngraph::test::NodeBuilder builder(op_func, {A, B}); const auto g_op_func = ngraph::as_type_ptr(builder.create()); const auto expected_attr_count = 1; @@ -69,7 +69,7 @@ TYPED_TEST_P(BinaryOperatorVisitor, No_Broadcast) std::make_shared(element_type, ngraph::PartialShape{1, 2, 3}); const auto op_func = std::make_shared(A, B); - ngraph::test::NodeBuilder builder(op_func); + ngraph::test::NodeBuilder builder(op_func, {A, B}); const auto g_op_func = ngraph::as_type_ptr(builder.create()); const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/broadcast.cpp b/src/core/tests/visitors/op/broadcast.cpp index 14f9f1a1802a85..7c3647ae3d6231 100644 --- a/src/core/tests/visitors/op/broadcast.cpp +++ b/src/core/tests/visitors/op/broadcast.cpp @@ -7,8 +7,6 @@ #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 "util/visitor.hpp" using namespace std; @@ -16,6 +14,20 @@ using namespace ngraph; using ngraph::test::NodeBuilder; using ngraph::test::ValueMap; +TEST(attributes, broadcast_v1) { + NodeBuilder::get_ops().register_factory(); + const auto arg = make_shared(element::i64, Shape{1, 3, 1}); + const auto shape = make_shared(element::i64, Shape{3}); + const auto axes_mapping = make_shared(element::i64, Shape{3}); + const auto broadcast_spec = ov::op::AutoBroadcastType::NONE; + + const auto broadcast_v3 = make_shared(arg, shape, axes_mapping, broadcast_spec); + NodeBuilder builder(broadcast_v3, {arg, shape, axes_mapping}); + auto g_broadcast_v3 = ov::as_type_ptr(builder.create()); + + EXPECT_EQ(g_broadcast_v3->get_broadcast_spec().m_type, broadcast_spec); +} + TEST(attributes, broadcast_v3) { NodeBuilder::get_ops().register_factory(); const auto arg = make_shared(element::i64, Shape{1, 3, 1}); @@ -23,7 +35,21 @@ TEST(attributes, broadcast_v3) { const auto broadcast_spec = op::BroadcastType::BIDIRECTIONAL; const auto broadcast_v3 = make_shared(arg, shape, broadcast_spec); - NodeBuilder builder(broadcast_v3); + NodeBuilder builder(broadcast_v3, {arg, shape}); + auto g_broadcast_v3 = ov::as_type_ptr(builder.create()); + + EXPECT_EQ(g_broadcast_v3->get_broadcast_spec(), broadcast_spec); +} + +TEST(attributes, broadcast_v3_explicit) { + NodeBuilder::get_ops().register_factory(); + const auto arg = make_shared(element::i64, Shape{1, 3, 1}); + const auto shape = make_shared(element::i64, Shape{3}); + const auto axes_mapping = make_shared(element::i64, Shape{3}); + const auto broadcast_spec = op::BroadcastType::EXPLICIT; + + const auto broadcast_v3 = make_shared(arg, shape, axes_mapping, broadcast_spec); + NodeBuilder builder(broadcast_v3, {arg, shape, axes_mapping}); auto g_broadcast_v3 = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_broadcast_v3->get_broadcast_spec(), broadcast_spec); diff --git a/src/core/tests/visitors/op/bucketize.cpp b/src/core/tests/visitors/op/bucketize.cpp index bfe6b212a562f9..f10796dac82798 100644 --- a/src/core/tests/visitors/op/bucketize.cpp +++ b/src/core/tests/visitors/op/bucketize.cpp @@ -21,7 +21,7 @@ TEST(attributes, bucketize_v3_op_default_attributes) { auto data = make_shared(element::f32, Shape{2, 3, 4}); auto buckets = make_shared(element::f32, Shape{5}); auto bucketize = make_shared(data, buckets); - NodeBuilder builder(bucketize); + NodeBuilder builder(bucketize, {data, buckets}); auto g_bucketize = ov::as_type_ptr(builder.create()); @@ -37,7 +37,7 @@ TEST(attributes, bucketize_v3_op_custom_attributes) { bool with_right_bound = false; auto bucketize = make_shared(data, buckets, output_type, with_right_bound); - NodeBuilder builder(bucketize); + NodeBuilder builder(bucketize, {data, buckets}); auto g_bucketize = ov::as_type_ptr(builder.create()); diff --git a/src/core/tests/visitors/op/clamp.cpp b/src/core/tests/visitors/op/clamp.cpp index d13dcb69db658f..3e7434b2aefb25 100644 --- a/src/core/tests/visitors/op/clamp.cpp +++ b/src/core/tests/visitors/op/clamp.cpp @@ -21,7 +21,7 @@ TEST(attributes, clamp_op) { double max = 5.6; const auto clamp = make_shared(data, min, max); - NodeBuilder builder(clamp); + NodeBuilder builder(clamp, {data}); auto g_clamp = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 2; diff --git a/src/core/tests/visitors/op/concat.cpp b/src/core/tests/visitors/op/concat.cpp index 79cb17ef38565e..fa4c431d2b31e1 100644 --- a/src/core/tests/visitors/op/concat.cpp +++ b/src/core/tests/visitors/op/concat.cpp @@ -22,7 +22,7 @@ TEST(attributes, concat_op) { int64_t axis = 2; auto concat = make_shared(ov::NodeVector{input1, input2, input3}, axis); - NodeBuilder builder(concat); + NodeBuilder builder(concat, {input1, input2, input3}); auto g_concat = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_concat->get_axis(), concat->get_axis()); diff --git a/src/core/tests/visitors/op/convert.cpp b/src/core/tests/visitors/op/convert.cpp index 4db6df7f5677cb..366da8fbae2d3a 100644 --- a/src/core/tests/visitors/op/convert.cpp +++ b/src/core/tests/visitors/op/convert.cpp @@ -18,7 +18,7 @@ TEST(attributes, convert_op_v0) { const element::Type destination_type = element::Type_t::i32; const auto convert = std::make_shared(data, destination_type); - NodeBuilder builder(convert); + NodeBuilder builder(convert, {data}); // attribute count const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/convert_color_i420.cpp b/src/core/tests/visitors/op/convert_color_i420.cpp index fa04e29e6bc421..08c05ec1d48906 100644 --- a/src/core/tests/visitors/op/convert_color_i420.cpp +++ b/src/core/tests/visitors/op/convert_color_i420.cpp @@ -17,7 +17,9 @@ TEST(attributes, convert_color_i420_rgb) { NodeBuilder::get_ops().register_factory(); auto data = make_shared(element::u8, Shape{3, 720, 640, 1}); auto convert_color = make_shared(data); - NodeBuilder builder(convert_color); + NodeBuilder builder(convert_color, {data}); + EXPECT_NO_THROW(auto g_concat = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -26,7 +28,9 @@ TEST(attributes, convert_color_i420_bgr) { NodeBuilder::get_ops().register_factory(); auto data = make_shared(element::u8, Shape{3, 720, 640, 1}); auto convert_color = make_shared(data); - NodeBuilder builder(convert_color); + NodeBuilder builder(convert_color, {data}); + EXPECT_NO_THROW(auto g_concat = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -37,7 +41,9 @@ TEST(attributes, convert_color_i420_rgb_3planes) { auto data2 = make_shared(element::u8, Shape{3, 240, 320, 1}); auto data3 = make_shared(element::u8, Shape{3, 240, 320, 1}); auto convert_color = make_shared(data1, data2, data3); - NodeBuilder builder(convert_color); + NodeBuilder builder(convert_color, {data1, data2, data3}); + EXPECT_NO_THROW(auto g_concat = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -48,7 +54,9 @@ TEST(attributes, convert_color_i420_bgr_3planes) { auto data2 = make_shared(element::u8, Shape{3, 240, 320, 1}); auto data3 = make_shared(element::u8, Shape{3, 240, 320, 1}); auto convert_color = make_shared(data1, data2, data3); - NodeBuilder builder(convert_color); + NodeBuilder builder(convert_color, {data1, data2, data3}); + EXPECT_NO_THROW(auto g_concat = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } diff --git a/src/core/tests/visitors/op/convert_color_nv12.cpp b/src/core/tests/visitors/op/convert_color_nv12.cpp index ddb8457132799e..fd15ed787aa055 100644 --- a/src/core/tests/visitors/op/convert_color_nv12.cpp +++ b/src/core/tests/visitors/op/convert_color_nv12.cpp @@ -17,7 +17,9 @@ TEST(attributes, convert_color_nv12_rgb) { NodeBuilder::get_ops().register_factory(); auto data = make_shared(element::u8, Shape{3, 720, 640, 1}); auto convert_color = make_shared(data); - NodeBuilder builder(convert_color); + NodeBuilder builder(convert_color, {data}); + EXPECT_NO_THROW(auto g_concat = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -26,7 +28,9 @@ TEST(attributes, convert_color_nv12_bgr) { NodeBuilder::get_ops().register_factory(); auto data = make_shared(element::u8, Shape{3, 720, 640, 1}); auto convert_color = make_shared(data); - NodeBuilder builder(convert_color); + NodeBuilder builder(convert_color, {data}); + EXPECT_NO_THROW(auto g_concat = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -36,7 +40,9 @@ TEST(attributes, convert_color_nv12_rgb_2planes) { auto data1 = make_shared(element::u8, Shape{3, 480, 640, 1}); auto data2 = make_shared(element::u8, Shape{3, 240, 320, 2}); auto convert_color = make_shared(data1, data2); - NodeBuilder builder(convert_color); + NodeBuilder builder(convert_color, {data1, data2}); + EXPECT_NO_THROW(auto g_concat = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -46,7 +52,9 @@ TEST(attributes, convert_color_nv12_bgr_2planes) { auto data1 = make_shared(element::u8, Shape{3, 480, 640, 1}); auto data2 = make_shared(element::u8, Shape{3, 240, 320, 2}); auto convert_color = make_shared(data1, data2); - NodeBuilder builder(convert_color); + NodeBuilder builder(convert_color, {data1, data2}); + EXPECT_NO_THROW(auto g_concat = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } diff --git a/src/core/tests/visitors/op/convolution.cpp b/src/core/tests/visitors/op/convolution.cpp index 558da4a7807d1d..ff3faede15b379 100644 --- a/src/core/tests/visitors/op/convolution.cpp +++ b/src/core/tests/visitors/op/convolution.cpp @@ -27,7 +27,7 @@ TEST(attributes, convolution) { auto convolution = make_shared(data, filters, strides, pads_begin, pads_end, dilations, op::PadType::VALID); - NodeBuilder builder(convolution); + NodeBuilder builder(convolution, {data, filters}); auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count @@ -51,7 +51,7 @@ TEST(attributes, convolution2) { auto dilations = Strides{1, 1}; auto convolution = make_shared(data, filters, strides, pads_begin, pads_end, dilations, op::PadType::VALID); - NodeBuilder builder(convolution); + NodeBuilder builder(convolution, {data, filters}); auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count diff --git a/src/core/tests/visitors/op/convolution_backprop.cpp b/src/core/tests/visitors/op/convolution_backprop.cpp index 42f06764e4f232..d0f43580946363 100644 --- a/src/core/tests/visitors/op/convolution_backprop.cpp +++ b/src/core/tests/visitors/op/convolution_backprop.cpp @@ -31,7 +31,7 @@ TEST(attributes, convolution_backprop_op) { pads_end, dilations, op::PadType::VALID); - NodeBuilder builder(convolution); + NodeBuilder builder(convolution, {data, filters}); auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count @@ -74,7 +74,7 @@ TEST(attributes, convolution_backprop_output_shape_output_padding) { dilations, padType, output_padding); - NodeBuilder builder(convolution); + NodeBuilder builder(convolution, {data, filter}); const auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count diff --git a/src/core/tests/visitors/op/ctc_greedy_decoder.cpp b/src/core/tests/visitors/op/ctc_greedy_decoder.cpp index 7bcc81764331f3..84971a80713464 100644 --- a/src/core/tests/visitors/op/ctc_greedy_decoder.cpp +++ b/src/core/tests/visitors/op/ctc_greedy_decoder.cpp @@ -19,7 +19,7 @@ TEST(attributes, ctc_greedy_decoder_op) { auto masks = make_shared(element::i32, Shape{3, 1}); auto decoder = make_shared(data, masks, m_ctc_merge_repeated); - NodeBuilder builder(decoder); + NodeBuilder builder(decoder, {data, masks}); auto g_decoder = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_decoder->get_ctc_merge_repeated(), decoder->get_ctc_merge_repeated()); diff --git a/src/core/tests/visitors/op/ctc_greedy_decoder_seq_len.cpp b/src/core/tests/visitors/op/ctc_greedy_decoder_seq_len.cpp index aaf04b2a392707..b6e05305f4f21a 100644 --- a/src/core/tests/visitors/op/ctc_greedy_decoder_seq_len.cpp +++ b/src/core/tests/visitors/op/ctc_greedy_decoder_seq_len.cpp @@ -21,7 +21,7 @@ TEST(attributes, ctc_greedy_decoder_seq_len_op) { auto blank_index = op::Constant::create(element::i32, Shape{}, {2}); auto decoder = make_shared(data, seq_len, blank_index, merge_repeated); - NodeBuilder builder(decoder); + NodeBuilder builder(decoder, {data, seq_len, blank_index}); auto g_decoder = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_decoder->get_merge_repeated(), decoder->get_merge_repeated()); diff --git a/src/core/tests/visitors/op/ctc_loss.cpp b/src/core/tests/visitors/op/ctc_loss.cpp index e496eb4572e449..6a09c4cdc25eff 100644 --- a/src/core/tests/visitors/op/ctc_loss.cpp +++ b/src/core/tests/visitors/op/ctc_loss.cpp @@ -26,7 +26,7 @@ TEST(attributes, ctc_loss) { auto blank_index = make_shared(element::i32, Shape{}); auto ctc_loss = make_shared(logits, logit_length, labels, label_length, blank_index); - NodeBuilder builder(ctc_loss); + NodeBuilder builder(ctc_loss, {logits, logit_length, labels, label_length, blank_index}); auto g_ctc_loss = as_type_ptr(builder.create()); // attribute count diff --git a/src/core/tests/visitors/op/cum_sum.cpp b/src/core/tests/visitors/op/cum_sum.cpp index 296e8bcb8c73ce..9675b87105a385 100644 --- a/src/core/tests/visitors/op/cum_sum.cpp +++ b/src/core/tests/visitors/op/cum_sum.cpp @@ -19,7 +19,7 @@ TEST(attributes, cum_sum_op_default_attributes_no_axis_input) { auto A = make_shared(element::f32, shape); auto cs = make_shared(A); - NodeBuilder builder(cs); + NodeBuilder builder(cs, {A}); auto g_cs = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 2; @@ -37,7 +37,7 @@ TEST(attributes, cum_sum_op_default_attributes) { auto axis = make_shared(element::i32, Shape{1}); auto cs = make_shared(A, axis); - NodeBuilder builder(cs); + NodeBuilder builder(cs, {A, axis}); auto g_cs = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 2; @@ -57,7 +57,7 @@ TEST(attributes, cum_sum_op_custom_attributes) { bool reverse = true; auto cs = make_shared(A, axis, exclusive, reverse); - NodeBuilder builder(cs); + NodeBuilder builder(cs, {A, axis}); auto g_cs = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 2; diff --git a/src/core/tests/visitors/op/deformable_convolution.cpp b/src/core/tests/visitors/op/deformable_convolution.cpp index 8aeefdafece991..03ecb0c0a22866 100644 --- a/src/core/tests/visitors/op/deformable_convolution.cpp +++ b/src/core/tests/visitors/op/deformable_convolution.cpp @@ -26,7 +26,7 @@ TEST(attributes, deformable_convolution_default_attributes) { auto dilations = Strides{1, 1}; auto convolution = make_shared(data, offsets, filters, strides, pads_begin, pads_end, dilations); - NodeBuilder builder(convolution); + NodeBuilder builder(convolution, {data, offsets, filters}); auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count @@ -62,7 +62,7 @@ TEST(attributes, deformable_convolution_attributes) { op::PadType::SAME_LOWER, 2, 2); - NodeBuilder builder(convolution); + NodeBuilder builder(convolution, {data, offsets, filters}); auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count @@ -90,7 +90,7 @@ TEST(attributes, deformable_convolution_v8_default_attributes) { auto dilations = Strides{1, 1}; auto convolution = make_shared(data, offsets, filters, strides, pads_begin, pads_end, dilations); - NodeBuilder builder(convolution); + NodeBuilder builder(convolution, {data, offsets, filters}); auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count @@ -130,7 +130,7 @@ TEST(attributes, deformable_convolution_v8_attributes) { 2, 2, true); - NodeBuilder builder(convolution); + NodeBuilder builder(convolution, {data, offsets, filters, mask}); auto g_convolution = ov::as_type_ptr(builder.create()); // attribute count @@ -145,4 +145,4 @@ TEST(attributes, deformable_convolution_v8_attributes) { EXPECT_EQ(g_convolution->get_group(), convolution->get_group()); EXPECT_EQ(g_convolution->get_deformable_group(), convolution->get_deformable_group()); EXPECT_EQ(g_convolution->get_bilinear_interpolation_pad(), convolution->get_bilinear_interpolation_pad()); -} \ No newline at end of file +} diff --git a/src/core/tests/visitors/op/deformable_psroi_pooling.cpp b/src/core/tests/visitors/op/deformable_psroi_pooling.cpp index 8c30289c9bc875..b9b6189c07bfe8 100644 --- a/src/core/tests/visitors/op/deformable_psroi_pooling.cpp +++ b/src/core/tests/visitors/op/deformable_psroi_pooling.cpp @@ -37,7 +37,7 @@ TEST(attributes, deformable_psroi_pooling_op) { spatial_bins_y, trans_std, part_size); - NodeBuilder builder(op); + NodeBuilder builder(op, {input, coords}); auto g_op = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_op->get_output_dim(), op->get_output_dim()); diff --git a/src/core/tests/visitors/op/depth_to_space.cpp b/src/core/tests/visitors/op/depth_to_space.cpp index 5a020fd674d5be..0f9eaa821f7f05 100644 --- a/src/core/tests/visitors/op/depth_to_space.cpp +++ b/src/core/tests/visitors/op/depth_to_space.cpp @@ -23,7 +23,7 @@ TEST(attributes, depth_to_space) { const auto mode = "blocks_first"; const auto dts = std::make_shared(data, mode, block_size); - NodeBuilder builder(dts); + NodeBuilder builder(dts, {data}); auto g_dts = ov::as_type_ptr(builder.create()); // attribute count diff --git a/src/core/tests/visitors/op/detection_output.cpp b/src/core/tests/visitors/op/detection_output.cpp index 312595778721c1..9d45e68093b1eb 100644 --- a/src/core/tests/visitors/op/detection_output.cpp +++ b/src/core/tests/visitors/op/detection_output.cpp @@ -66,7 +66,7 @@ TEST(attributes, detection_output_op) { auto detection_output = make_shared(box_logits, class_preds, proposals, aux_class_preds, aux_box_pred, attrs); - NodeBuilder builder(detection_output); + NodeBuilder builder(detection_output, {box_logits, class_preds, proposals, aux_class_preds, aux_box_pred}); auto g_detection_output = ov::as_type_ptr(builder.create()); const auto do_attrs = detection_output->get_attrs(); @@ -90,7 +90,7 @@ TEST(attributes, detection_output_v8) { auto detection_output = make_shared(box_logits, class_preds, proposals, aux_class_preds, aux_box_pred, attrs); - NodeBuilder builder(detection_output); + NodeBuilder builder(detection_output, {box_logits, class_preds, proposals, aux_class_preds, aux_box_pred}); auto g_detection_output = ov::as_type_ptr(builder.create()); const auto do_attrs = detection_output->get_attrs(); diff --git a/src/core/tests/visitors/op/dft.cpp b/src/core/tests/visitors/op/dft.cpp index 0df3ab460c5b1e..41de05c460ab6d 100644 --- a/src/core/tests/visitors/op/dft.cpp +++ b/src/core/tests/visitors/op/dft.cpp @@ -17,8 +17,9 @@ TEST(attributes, dft_op) { auto axes = op::v0::Constant::create(element::i64, Shape{1}, {2}); auto dft = make_shared(data, axes); - NodeBuilder builder(dft); + NodeBuilder builder(dft, {data, axes}); const auto expected_attr_count = 0; + EXPECT_NO_THROW(auto g_dft = ov::as_type_ptr(builder.create())); EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -30,8 +31,9 @@ TEST(attributes, dft_op_signal) { auto axes = op::v0::Constant::create(element::i64, Shape{1}, {2}); auto dft = make_shared(data, axes, signal); - NodeBuilder builder(dft); - const auto expected_attr_count = 0; + NodeBuilder builder(dft, {data, axes, signal}); + EXPECT_NO_THROW(auto g_dft = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } \ No newline at end of file diff --git a/src/core/tests/visitors/op/divide.cpp b/src/core/tests/visitors/op/divide.cpp index 3c4b9c3bfec2e0..a81e0b0d90f83f 100644 --- a/src/core/tests/visitors/op/divide.cpp +++ b/src/core/tests/visitors/op/divide.cpp @@ -31,7 +31,7 @@ TEST(attributes, divide) { const op::AutoBroadcastSpec& auto_broadcast = op::AutoBroadcastSpec(op::AutoBroadcastType::NUMPY); const auto divide = make_shared(in1, in2, pythondiv, auto_broadcast); - NodeBuilder builder(divide); + NodeBuilder builder(divide, {in1, in2}); auto g_divide = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 2; diff --git a/src/core/tests/visitors/op/einsum.cpp b/src/core/tests/visitors/op/einsum.cpp index 69ba0b75ffdda1..3ac948183c8b0f 100644 --- a/src/core/tests/visitors/op/einsum.cpp +++ b/src/core/tests/visitors/op/einsum.cpp @@ -19,7 +19,7 @@ TEST(attributes, einsum_v7_op) { auto input2 = make_shared(element::i32, Shape{3, 4}); std::string equation = "ab,bc->ac"; auto einsum = make_shared(OutputVector{input1, input2}, equation); - NodeBuilder builder(einsum); + NodeBuilder builder(einsum, {input1, input2}); auto g_einsum = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_einsum->get_equation(), einsum->get_equation()); } diff --git a/src/core/tests/visitors/op/elu.cpp b/src/core/tests/visitors/op/elu.cpp index 00d6a912b17e82..31b5d5f3df9267 100644 --- a/src/core/tests/visitors/op/elu.cpp +++ b/src/core/tests/visitors/op/elu.cpp @@ -23,7 +23,7 @@ TEST(attributes, elu_op) { double alpha = 0.1; const auto elu = make_shared(data, alpha); - NodeBuilder builder(elu); + NodeBuilder builder(elu, {data}); auto g_elu = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_elu->get_alpha(), elu->get_alpha()); diff --git a/src/core/tests/visitors/op/embedding_segments_sum.cpp b/src/core/tests/visitors/op/embedding_segments_sum.cpp index 5f905ad67b1311..c74a9483418b5f 100644 --- a/src/core/tests/visitors/op/embedding_segments_sum.cpp +++ b/src/core/tests/visitors/op/embedding_segments_sum.cpp @@ -29,7 +29,8 @@ TEST(visitor_without_attribute, embedding_segments_sum_op) { num_segments, default_index, per_sample_weights); - NodeBuilder builder(ess); + 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(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/embeddingbag_offsetssum.cpp b/src/core/tests/visitors/op/embeddingbag_offsetssum.cpp index aea48f5749400d..343717af285d46 100644 --- a/src/core/tests/visitors/op/embeddingbag_offsetssum.cpp +++ b/src/core/tests/visitors/op/embeddingbag_offsetssum.cpp @@ -24,7 +24,8 @@ TEST(visitor_without_attribute, embedding_bag_offsets_sum_op) { auto ebos = make_shared(emb_table, indices, offsets, default_index, per_sample_weights); - NodeBuilder builder(ebos); + NodeBuilder builder(ebos, {emb_table, indices, offsets, default_index, per_sample_weights}); + EXPECT_NO_THROW(auto g_ebos = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/embeddingbag_packedsum.cpp b/src/core/tests/visitors/op/embeddingbag_packedsum.cpp index 9a1fd956d5e4c8..0b1fddb8372ef9 100644 --- a/src/core/tests/visitors/op/embeddingbag_packedsum.cpp +++ b/src/core/tests/visitors/op/embeddingbag_packedsum.cpp @@ -19,8 +19,9 @@ TEST(visitor_without_attribute, embedding_bag_packed_sum_op) { auto indices = make_shared(element::i64, Shape{3, 4}); auto per_sample_weights = make_shared(element::f32, Shape{3, 4}); - auto ebos = make_shared(emb_table, indices, per_sample_weights); - NodeBuilder builder(ebos); + auto ebps = make_shared(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(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/experimental_detectron_detection_output.cpp b/src/core/tests/visitors/op/experimental_detectron_detection_output.cpp index 1150a998c5a7ea..67a7ce3fcedb1d 100644 --- a/src/core/tests/visitors/op/experimental_detectron_detection_output.cpp +++ b/src/core/tests/visitors/op/experimental_detectron_detection_output.cpp @@ -38,7 +38,7 @@ TEST(attributes, detectron_detection_output) { auto detection = std::make_shared(rois, deltas, scores, im_info, attrs); - NodeBuilder builder(detection); + NodeBuilder builder(detection, {rois, deltas, scores, im_info}); auto g_detection = ov::as_type_ptr(builder.create()); diff --git a/src/core/tests/visitors/op/experimental_detectron_generate_proposals.cpp b/src/core/tests/visitors/op/experimental_detectron_generate_proposals.cpp index 1d95c8f1f88d82..5f44dcdaec0b44 100644 --- a/src/core/tests/visitors/op/experimental_detectron_generate_proposals.cpp +++ b/src/core/tests/visitors/op/experimental_detectron_generate_proposals.cpp @@ -34,7 +34,7 @@ TEST(attributes, detectron_proposals) { auto proposals = std::make_shared(im_info, anchors, deltas, scores, attrs); - NodeBuilder builder(proposals); + NodeBuilder builder(proposals, {im_info, anchors, deltas, scores}); auto g_proposals = ov::as_type_ptr(builder.create()); diff --git a/src/core/tests/visitors/op/experimental_detectron_prior_grid_generator.cpp b/src/core/tests/visitors/op/experimental_detectron_prior_grid_generator.cpp index 2ce0ac4d9c639f..38751f34e3bb60 100644 --- a/src/core/tests/visitors/op/experimental_detectron_prior_grid_generator.cpp +++ b/src/core/tests/visitors/op/experimental_detectron_prior_grid_generator.cpp @@ -34,7 +34,7 @@ TEST(attributes, detectron_prior_grid_generator) { auto proposals = std::make_shared(priors, feature_map, im_data, attrs); - NodeBuilder builder(proposals); + NodeBuilder builder(proposals, {priors, feature_map, im_data}); auto g_proposals = ov::as_type_ptr(builder.create()); diff --git a/src/core/tests/visitors/op/experimental_detectron_topkrois.cpp b/src/core/tests/visitors/op/experimental_detectron_topkrois.cpp index 6073bcbe47ef7d..5c362a1617231b 100644 --- a/src/core/tests/visitors/op/experimental_detectron_topkrois.cpp +++ b/src/core/tests/visitors/op/experimental_detectron_topkrois.cpp @@ -20,7 +20,7 @@ TEST(attributes, experimental_detectron_topkrois_op) { auto input_probs = std::make_shared(element::f32, Shape{2}); auto topkrois = std::make_shared(input_rois, input_probs, num_rois); - NodeBuilder builder(topkrois); + NodeBuilder builder(topkrois, {input_rois, input_probs}); auto g_topkrois = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_topkrois->get_max_rois(), topkrois->get_max_rois()); diff --git a/src/core/tests/visitors/op/extractimagepatches.cpp b/src/core/tests/visitors/op/extractimagepatches.cpp index 14b4c9b54111d4..ad447cb439cbd8 100644 --- a/src/core/tests/visitors/op/extractimagepatches.cpp +++ b/src/core/tests/visitors/op/extractimagepatches.cpp @@ -26,7 +26,7 @@ TEST(attributes, extractimagepatches_op) { auto padtype_padding = ngraph::op::PadType::VALID; auto extractimagepatches = make_shared(data, sizes, strides, rates, padtype_padding); - NodeBuilder builder(extractimagepatches); + NodeBuilder builder(extractimagepatches, {data}); auto g_extractimagepatches = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 4; diff --git a/src/core/tests/visitors/op/eye.cpp b/src/core/tests/visitors/op/eye.cpp index dfe7e135fad892..05e14f328740dd 100644 --- a/src/core/tests/visitors/op/eye.cpp +++ b/src/core/tests/visitors/op/eye.cpp @@ -20,7 +20,7 @@ TEST(attributes, eye_op) { auto diagonal_index = make_shared(element::i32, Shape{}, 0); const auto eye = make_shared(num_rows, num_columns, diagonal_index, element::Type_t::u8); - NodeBuilder builder(eye); + NodeBuilder builder(eye, {num_rows, num_columns, diagonal_index}); auto g_eye = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 1; @@ -36,7 +36,7 @@ TEST(attributes, eye_batch_shape_op) { auto batch_shape = make_shared(element::i32, Shape{3}, std::vector{1, 2, 3}); const auto eye = make_shared(num_rows, num_columns, diagonal_index, batch_shape, element::Type_t::i32); - NodeBuilder builder(eye); + NodeBuilder builder(eye, {num_rows, num_columns, diagonal_index, batch_shape}); auto g_eye = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/fake_quantize.cpp b/src/core/tests/visitors/op/fake_quantize.cpp index 248b8b625967ef..9bba16d0cc248d 100644 --- a/src/core/tests/visitors/op/fake_quantize.cpp +++ b/src/core/tests/visitors/op/fake_quantize.cpp @@ -29,7 +29,7 @@ TEST(attributes, fake_quantize_op) { const auto fake_quantize = make_shared(data, input_low, input_high, output_low, output_high, levels, auto_broadcast); - NodeBuilder builder(fake_quantize); + NodeBuilder builder(fake_quantize, {data, input_low, input_high, output_low, output_high}); auto g_fake_quantize = ov::as_type_ptr(builder.create()); // attribute count diff --git a/src/core/tests/visitors/op/gather.cpp b/src/core/tests/visitors/op/gather.cpp index 699d18bd6c54a3..efe4a48a6b7c24 100644 --- a/src/core/tests/visitors/op/gather.cpp +++ b/src/core/tests/visitors/op/gather.cpp @@ -14,6 +14,19 @@ using namespace ngraph; using ngraph::test::NodeBuilder; using ngraph::test::ValueMap; +TEST(attributes, gather_v1_op) { + NodeBuilder::get_ops().register_factory(); + auto data = make_shared(element::i32, Shape{2, 3, 4}); + auto indices = make_shared(element::i32, Shape{2}); + auto axis = make_shared(element::i32, Shape{}, 2); + + auto gather = make_shared(data, indices, axis); + NodeBuilder builder(gather, {data, indices, axis}); + auto g_gather = ov::as_type_ptr(builder.create()); + + EXPECT_EQ(g_gather->get_batch_dims(), gather->get_batch_dims()); +} + TEST(attributes, gather_v7_op) { NodeBuilder::get_ops().register_factory(); auto data = make_shared(element::i32, Shape{2, 3, 4}); @@ -22,7 +35,7 @@ TEST(attributes, gather_v7_op) { int64_t batch_dims = 1; auto gather = make_shared(data, indices, axis, batch_dims); - NodeBuilder builder(gather); + NodeBuilder builder(gather, {data, indices, axis}); auto g_gather = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gather->get_batch_dims(), gather->get_batch_dims()); @@ -36,7 +49,7 @@ TEST(attributes, gather_v8_op) { int64_t batch_dims = 1; auto gather = make_shared(data, indices, axis, batch_dims); - NodeBuilder builder(gather); + NodeBuilder builder(gather, {data, indices, axis}); auto g_gather = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gather->get_batch_dims(), gather->get_batch_dims()); diff --git a/src/core/tests/visitors/op/gather_elements.cpp b/src/core/tests/visitors/op/gather_elements.cpp index 79e16e46dca906..64ef22c9c93a05 100644 --- a/src/core/tests/visitors/op/gather_elements.cpp +++ b/src/core/tests/visitors/op/gather_elements.cpp @@ -20,7 +20,7 @@ TEST(attributes, gather_elements_op) { int64_t axis = 0; auto gather_el = make_shared(arg1, arg2, axis); - NodeBuilder builder(gather_el); + NodeBuilder builder(gather_el, {arg1, arg2}); auto g_gather_el = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gather_el->get_axis(), gather_el->get_axis()); diff --git a/src/core/tests/visitors/op/gather_nd.cpp b/src/core/tests/visitors/op/gather_nd.cpp index 1384d00805022c..a26beb3012927f 100644 --- a/src/core/tests/visitors/op/gather_nd.cpp +++ b/src/core/tests/visitors/op/gather_nd.cpp @@ -21,7 +21,7 @@ TEST(attributes, gather_nd_v5_op) { auto I = make_shared(element::i32, Shape{2, 1}); auto G = make_shared(P, I, batch_dims); - NodeBuilder builder(G); + NodeBuilder builder(G, {P, I}); auto g_G = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_G->get_batch_dims(), G->get_batch_dims()); @@ -34,7 +34,7 @@ TEST(attributes, gather_nd_v8_op) { auto I = make_shared(element::i32, Shape{2, 1}); auto G = make_shared(P, I, batch_dims); - NodeBuilder builder(G); + NodeBuilder builder(G, {P, I}); auto g_G = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_G->get_batch_dims(), G->get_batch_dims()); diff --git a/src/core/tests/visitors/op/gather_tree.cpp b/src/core/tests/visitors/op/gather_tree.cpp index 94b7ee08f23cf9..c3fa5a85e6c51b 100644 --- a/src/core/tests/visitors/op/gather_tree.cpp +++ b/src/core/tests/visitors/op/gather_tree.cpp @@ -21,7 +21,8 @@ TEST(attributes, gather_tree_op) { auto end_token = std::make_shared(element::f32, Shape{}); auto gather_tree = std::make_shared(step_ids, parent_idx, max_seq_len, end_token); - NodeBuilder builder(gather_tree); + NodeBuilder builder(gather_tree, {step_ids, parent_idx, max_seq_len, end_token}); + EXPECT_NO_THROW(auto g_gather_tree = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/gelu.cpp b/src/core/tests/visitors/op/gelu.cpp index 31a52247c3f735..537f4af02606df 100644 --- a/src/core/tests/visitors/op/gelu.cpp +++ b/src/core/tests/visitors/op/gelu.cpp @@ -5,6 +5,7 @@ #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 "util/visitor.hpp" @@ -17,7 +18,7 @@ TEST(attributes, gelu_op_erf) { const auto data_input = make_shared(element::f32, Shape{1, 2, 3}); const auto approximation_mode = op::GeluApproximationMode::ERF; const auto gelu = make_shared(data_input, approximation_mode); - NodeBuilder builder(gelu); + NodeBuilder builder(gelu, {data_input}); auto g_gelu = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gelu->get_approximation_mode(), gelu->get_approximation_mode()); @@ -28,7 +29,7 @@ TEST(attributes, gelu_op_tanh) { const auto data_input = make_shared(element::f32, Shape{1, 2, 3}); const auto approximation_mode = op::GeluApproximationMode::TANH; const auto gelu = make_shared(data_input, approximation_mode); - NodeBuilder builder(gelu); + NodeBuilder builder(gelu, {data_input}); auto g_gelu = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gelu->get_approximation_mode(), gelu->get_approximation_mode()); @@ -38,8 +39,19 @@ TEST(attributes, gelu_op) { NodeBuilder::get_ops().register_factory(); const auto data_input = make_shared(element::f32, Shape{1, 2, 3}); const auto gelu = make_shared(data_input); - NodeBuilder builder(gelu); + NodeBuilder builder(gelu, {data_input}); auto g_gelu = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gelu->get_approximation_mode(), gelu->get_approximation_mode()); } + +TEST(attributes, gelu_v0_op) { + NodeBuilder::get_ops().register_factory(); + const auto data_input = make_shared(element::f32, Shape{1, 2, 3}); + const auto gelu = make_shared(data_input); + NodeBuilder builder(gelu, {data_input}); + const auto expected_attr_count = 0; + EXPECT_NO_THROW(auto g_gelu = ov::as_type_ptr(builder.create())); + + EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); +} diff --git a/src/core/tests/visitors/op/generate_proposals.cpp b/src/core/tests/visitors/op/generate_proposals.cpp index e4c65b9cad0fdf..9ff3f28302c8c9 100644 --- a/src/core/tests/visitors/op/generate_proposals.cpp +++ b/src/core/tests/visitors/op/generate_proposals.cpp @@ -36,7 +36,7 @@ TEST(attributes, generate_proposals) { auto proposals = std::make_shared(im_info, anchors, deltas, scores, attrs); - NodeBuilder builder(proposals); + NodeBuilder builder(proposals, {im_info, anchors, deltas, scores}); auto g_proposals = ov::as_type_ptr(builder.create()); diff --git a/src/core/tests/visitors/op/grid_sample.cpp b/src/core/tests/visitors/op/grid_sample.cpp index ab9576ae27d6e6..c879cccde1d360 100644 --- a/src/core/tests/visitors/op/grid_sample.cpp +++ b/src/core/tests/visitors/op/grid_sample.cpp @@ -18,7 +18,8 @@ TEST(attributes, grid_sample_defaults) { const auto grid = make_shared(element::f32, Shape{1, 5, 5, 2}); const auto op = make_shared(data, grid, opset9::GridSample::Attributes{}); - NodeBuilder builder(op); + NodeBuilder builder(op, {data, grid}); + EXPECT_NO_THROW(auto g_op = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 3; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/grn.cpp b/src/core/tests/visitors/op/grn.cpp index dd384f74a0d743..a9d11e92d1c11a 100644 --- a/src/core/tests/visitors/op/grn.cpp +++ b/src/core/tests/visitors/op/grn.cpp @@ -19,7 +19,7 @@ TEST(attributes, grn_op) { float bias = 1.25f; auto grn = make_shared(data, bias); - NodeBuilder builder(grn); + NodeBuilder builder(grn, {data}); auto g_grn = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/group_conv.cpp b/src/core/tests/visitors/op/group_conv.cpp index 297f82d76b6a63..40461df577ade8 100644 --- a/src/core/tests/visitors/op/group_conv.cpp +++ b/src/core/tests/visitors/op/group_conv.cpp @@ -31,7 +31,7 @@ TEST(attributes, group_conv_op) { pads_end, dilations, op::PadType::VALID); - NodeBuilder builder(group_conv); + NodeBuilder builder(group_conv, {data, filters}); auto g_group_conv = ov::as_type_ptr(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()); @@ -62,7 +62,7 @@ TEST(attributes, group_conv_backprop_data_op) { dilations, auto_pad, output_padding); - NodeBuilder builder(gcbd); + NodeBuilder builder(gcbd, {data, filter}); const auto g_gcbd = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gcbd->get_strides(), gcbd->get_strides()); diff --git a/src/core/tests/visitors/op/gru_cell.cpp b/src/core/tests/visitors/op/gru_cell.cpp index 6beb07edb34fca..f0d12bc1ffafd3 100644 --- a/src/core/tests/visitors/op/gru_cell.cpp +++ b/src/core/tests/visitors/op/gru_cell.cpp @@ -39,7 +39,7 @@ TEST(attributes, gru_cell_op) { activations_beta, clip, false); - NodeBuilder builder(gru_cell); + NodeBuilder builder(gru_cell, {X, initial_hidden_state, W, R}); auto g_gru_cell = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gru_cell->get_hidden_size(), gru_cell->get_hidden_size()); diff --git a/src/core/tests/visitors/op/gru_sequence.cpp b/src/core/tests/visitors/op/gru_sequence.cpp index 96ff5d7c6a05b2..492b636a08a042 100644 --- a/src/core/tests/visitors/op/gru_sequence.cpp +++ b/src/core/tests/visitors/op/gru_sequence.cpp @@ -53,7 +53,7 @@ TEST(attributes, gru_sequence_op) { activations_alpha, activations_beta, clip_threshold); - NodeBuilder builder(gru_sequence); + NodeBuilder builder(gru_sequence, {X, initial_hidden_state, sequence_lengths, W, R, B}); auto g_gru_sequence = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_gru_sequence->get_hidden_size(), gru_sequence->get_hidden_size()); diff --git a/src/core/tests/visitors/op/hard_sigmoid.cpp b/src/core/tests/visitors/op/hard_sigmoid.cpp index 1ec299e7a0117a..4f66ffa6bde4e5 100644 --- a/src/core/tests/visitors/op/hard_sigmoid.cpp +++ b/src/core/tests/visitors/op/hard_sigmoid.cpp @@ -19,7 +19,8 @@ TEST(attributes, hardsigmoid_op) { const auto beta = make_shared(element::f32, Shape{}); const auto hardsigmoid = make_shared(data, alpha, beta); - NodeBuilder builder(hardsigmoid); + NodeBuilder builder(hardsigmoid, {data, alpha, beta}); + EXPECT_NO_THROW(auto g_hardsigmoid = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/idft.cpp b/src/core/tests/visitors/op/idft.cpp index fe336d6cd6a6b6..15f05fb49238ed 100644 --- a/src/core/tests/visitors/op/idft.cpp +++ b/src/core/tests/visitors/op/idft.cpp @@ -17,9 +17,10 @@ TEST(attributes, idft_op) { auto axes = op::Constant::create(element::Type_t::i64, Shape{1}, {2}); auto idft = make_shared(data, axes); - NodeBuilder builder(idft); - const auto expected_attr_count = 0; + NodeBuilder builder(idft, {data, axes}); + EXPECT_NO_THROW(auto g_idft = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -30,8 +31,9 @@ TEST(attributes, idft_op_signal) { auto signal = op::Constant::create(element::Type_t::i64, Shape{1}, {20}); auto idft = make_shared(data, axes, signal); - NodeBuilder builder(idft); - const auto expected_attr_count = 0; + NodeBuilder builder(idft, {data, axes, signal}); + EXPECT_NO_THROW(auto g_idft = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } \ No newline at end of file diff --git a/src/core/tests/visitors/op/interpolate.cpp b/src/core/tests/visitors/op/interpolate.cpp index 8e95d0497dcaaf..266f40c215c585 100644 --- a/src/core/tests/visitors/op/interpolate.cpp +++ b/src/core/tests/visitors/op/interpolate.cpp @@ -30,7 +30,7 @@ TEST(attributes, interpolate_op1) { interp_atrs.pads_end = vector{0, 0}; auto interpolate = make_shared(img, out_shape, interp_atrs); - NodeBuilder builder(interpolate); + NodeBuilder builder(interpolate, {img, out_shape}); auto g_interpolate = ov::as_type_ptr(builder.create()); const auto i_attrs = interpolate->get_attrs(); @@ -61,7 +61,7 @@ TEST(attributes, interpolate_op4) { attrs.cube_coeff = -0.75; auto interpolate = make_shared(img, out_shape, scales, attrs); - NodeBuilder builder(interpolate); + NodeBuilder builder(interpolate, {img, out_shape, scales}); auto g_interpolate = ov::as_type_ptr(builder.create()); const auto i_attrs = interpolate->get_attrs(); diff --git a/src/core/tests/visitors/op/irdft.cpp b/src/core/tests/visitors/op/irdft.cpp index b9f444df9757cf..4ca223ec2459d3 100644 --- a/src/core/tests/visitors/op/irdft.cpp +++ b/src/core/tests/visitors/op/irdft.cpp @@ -17,9 +17,10 @@ TEST(attributes, irdft_op) { auto axes = op::v0::Constant::create(element::i64, Shape{1}, {2}); auto irdft = make_shared(data, axes); - NodeBuilder builder(irdft); - const auto expected_attr_count = 0; + NodeBuilder builder(irdft, {data, axes}); + EXPECT_NO_THROW(auto g_irdft = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -30,8 +31,9 @@ TEST(attributes, irdft_op_signal) { auto axes = op::v0::Constant::create(element::i64, Shape{1}, {2}); auto irdft = make_shared(data, axes, signal); - NodeBuilder builder(irdft); - const auto expected_attr_count = 0; + NodeBuilder builder(irdft, {data, axes, signal}); + EXPECT_NO_THROW(auto g_irdft = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } \ No newline at end of file diff --git a/src/core/tests/visitors/op/log_softmax.cpp b/src/core/tests/visitors/op/log_softmax.cpp index 69d563fedd7853..a5d73e94a8c521 100644 --- a/src/core/tests/visitors/op/log_softmax.cpp +++ b/src/core/tests/visitors/op/log_softmax.cpp @@ -23,7 +23,7 @@ TEST(attributes, logsoftmax_op) { int64_t axis = 2; const auto logsoftmax = make_shared(data, axis); - NodeBuilder builder(logsoftmax); + NodeBuilder builder(logsoftmax, {data}); auto g_logsoftmax = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/lrn.cpp b/src/core/tests/visitors/op/lrn.cpp index ff0d232ae11b88..15a648a0ee62d4 100644 --- a/src/core/tests/visitors/op/lrn.cpp +++ b/src/core/tests/visitors/op/lrn.cpp @@ -27,7 +27,7 @@ TEST(attributes, lrn_op) { const size_t size = 4; const auto lrn = make_shared(arg, axes, alpha, beta, bias, size); - NodeBuilder builder(lrn); + NodeBuilder builder(lrn, {arg, axes}); auto g_lrn = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_lrn->get_alpha(), lrn->get_alpha()); diff --git a/src/core/tests/visitors/op/lstm_cell.cpp b/src/core/tests/visitors/op/lstm_cell.cpp index 9d2b9d00ab8462..c572ac5cb7dc4f 100644 --- a/src/core/tests/visitors/op/lstm_cell.cpp +++ b/src/core/tests/visitors/op/lstm_cell.cpp @@ -16,7 +16,45 @@ using namespace ngraph; using ngraph::test::NodeBuilder; using ngraph::test::ValueMap; -TEST(attributes, lstm_cell_op) { +TEST(attributes, lstm_cell_v0_op) { + NodeBuilder::get_ops().register_factory(); + auto X = make_shared(element::f32, Shape{2, 3}); + auto H = make_shared(element::f32, Shape{2, 3}); + auto W = make_shared(element::f32, Shape{12, 3}); + auto R = make_shared(element::f32, Shape{12, 3}); + const auto initial_hidden_state = make_shared(element::f32, Shape{2, 3}); + const auto initial_cell_state = make_shared(element::f32, Shape{2, 3}); + + const auto hidden_size = 3; + auto weights_format = ov::op::LSTMWeightsFormat::IFCO; + const std::vector activations = {"tanh", "sigmoid", "tanh"}; + auto activations_alpha = std::vector{1.0, 1.5}; + auto activations_beta = std::vector{2.0, 1.0}; + const float clip = 0.5f; + auto input_forget = false; + const auto lstm_cell = make_shared(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(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()); + EXPECT_EQ(g_lstm_cell->get_activations_alpha(), lstm_cell->get_activations_alpha()); + EXPECT_EQ(g_lstm_cell->get_activations_beta(), lstm_cell->get_activations_beta()); + EXPECT_EQ(g_lstm_cell->get_clip(), lstm_cell->get_clip()); +} + +TEST(attributes, lstm_cell_v4_op) { NodeBuilder::get_ops().register_factory(); auto X = make_shared(element::f32, Shape{2, 3}); auto H = make_shared(element::f32, Shape{2, 3}); @@ -40,7 +78,7 @@ TEST(attributes, lstm_cell_op) { activations_alpha, activations_beta, clip); - NodeBuilder builder(lstm_cell); + NodeBuilder builder(lstm_cell, {X, initial_hidden_state, initial_cell_state, W, R}); auto g_lstm_cell = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_lstm_cell->get_hidden_size(), lstm_cell->get_hidden_size()); diff --git a/src/core/tests/visitors/op/lstm_sequence.cpp b/src/core/tests/visitors/op/lstm_sequence.cpp index d445b1a1d80ef4..24bf369280fab5 100644 --- a/src/core/tests/visitors/op/lstm_sequence.cpp +++ b/src/core/tests/visitors/op/lstm_sequence.cpp @@ -54,7 +54,7 @@ TEST(attributes, lstm_sequence_op) { activations_beta, activations, clip_threshold); - NodeBuilder builder(lstm_sequence); + NodeBuilder builder(lstm_sequence, {X, initial_hidden_state, initial_cell_state, sequence_lengths, W, R, B}); auto g_lstm_sequence = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_lstm_sequence->get_hidden_size(), lstm_sequence->get_hidden_size()); @@ -109,7 +109,7 @@ TEST(attributes, lstm_sequence_v1_op) { activations, clip_threshold, input_forget); - NodeBuilder builder(lstm_sequence); + 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(builder.create()); EXPECT_EQ(g_lstm_sequence->get_hidden_size(), lstm_sequence->get_hidden_size()); diff --git a/src/core/tests/visitors/op/matmul.cpp b/src/core/tests/visitors/op/matmul.cpp index f6ff256d1002cd..7e47c06b3a76df 100644 --- a/src/core/tests/visitors/op/matmul.cpp +++ b/src/core/tests/visitors/op/matmul.cpp @@ -25,7 +25,7 @@ TEST(attributes, matmul_op) { bool transpose_b = true; auto matmul = make_shared(A, B, transpose_a, transpose_b); - NodeBuilder builder(matmul); + NodeBuilder builder(matmul, {A, B}); auto g_matmul = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a()); @@ -41,7 +41,7 @@ TEST(attributes, matmul_op2) { bool transpose_b = false; auto matmul = make_shared(A, B, transpose_a, transpose_b); - NodeBuilder builder(matmul); + NodeBuilder builder(matmul, {A, B}); auto g_matmul = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a()); @@ -57,7 +57,7 @@ TEST(attributes, matmul_op3) { bool transpose_b = false; auto matmul = make_shared(A, B, transpose_a, transpose_b); - NodeBuilder builder(matmul); + NodeBuilder builder(matmul, {A, B}); auto g_matmul = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a()); @@ -70,7 +70,7 @@ TEST(attributes, matmul_op4) { auto B = make_shared(element::f32, Shape{3, 2, 2, 1}); auto matmul = make_shared(A, B); - NodeBuilder builder(matmul); + NodeBuilder builder(matmul, {A, B}); auto g_matmul = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a()); @@ -83,7 +83,7 @@ TEST(attributes, matmul_op5) { auto B = make_shared(element::f32, Shape{2, 10}); auto matmul = make_shared(A, B); - NodeBuilder builder(matmul); + NodeBuilder builder(matmul, {A, B}); auto g_matmul = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a()); @@ -96,7 +96,7 @@ TEST(attributes, matmul_op6) { auto B = make_shared(element::f32, Shape{2048, 1000}); auto matmul = make_shared(A, B); - NodeBuilder builder(matmul); + NodeBuilder builder(matmul, {A, B}); auto g_matmul = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_matmul->get_transpose_a(), matmul->get_transpose_a()); diff --git a/src/core/tests/visitors/op/matrix_nms.cpp b/src/core/tests/visitors/op/matrix_nms.cpp index 9455ba048ba143..4aabfb397b037d 100644 --- a/src/core/tests/visitors/op/matrix_nms.cpp +++ b/src/core/tests/visitors/op/matrix_nms.cpp @@ -36,7 +36,7 @@ TEST(attributes, matrix_nms_v8_op_custom_attributes) { attrs.normalized = false; auto nms = make_shared(boxes, scores, attrs); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores}); auto g_nms = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 11; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -75,7 +75,7 @@ TEST(attributes, matrix_nms_v8_op_default_attributes) { auto scores = make_shared(element::f32, Shape{1, 1, 1}); auto nms = make_shared(boxes, scores, opset8::MatrixNms::Attributes()); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores}); auto g_nms = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 11; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/max_pool.cpp b/src/core/tests/visitors/op/max_pool.cpp index d94a59eb66694d..7a32c321013221 100644 --- a/src/core/tests/visitors/op/max_pool.cpp +++ b/src/core/tests/visitors/op/max_pool.cpp @@ -26,7 +26,7 @@ TEST(attributes, max_pool_op) { auto auto_pad = op::PadType::EXPLICIT; auto max_pool = make_shared(data, strides, pads_begin, pads_end, kernel, rounding_mode, auto_pad); - NodeBuilder builder(max_pool); + NodeBuilder builder(max_pool, {data}); auto g_max_pool = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_max_pool->get_strides(), max_pool->get_strides()); @@ -59,7 +59,7 @@ TEST(attributes, max_pool_v8_op) { rounding_mode, auto_pad, index_element_type); - NodeBuilder builder(max_pool); + NodeBuilder builder(max_pool, {data}); auto g_max_pool = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_max_pool->get_strides(), max_pool->get_strides()); diff --git a/src/core/tests/visitors/op/mish.cpp b/src/core/tests/visitors/op/mish.cpp index 3c934a90b28ba4..38026748bdbcd8 100644 --- a/src/core/tests/visitors/op/mish.cpp +++ b/src/core/tests/visitors/op/mish.cpp @@ -17,7 +17,8 @@ TEST(attributes, mish_op) { const auto A = make_shared(element::f32, Shape{5, 2}); const auto mish = make_shared(A); - NodeBuilder builder(mish); + NodeBuilder builder(mish,{A}); + EXPECT_NO_THROW(auto g_mish = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/multiclass_nms.cpp b/src/core/tests/visitors/op/multiclass_nms.cpp index 5e8d7eccfd1771..70d3a21b1efe11 100644 --- a/src/core/tests/visitors/op/multiclass_nms.cpp +++ b/src/core/tests/visitors/op/multiclass_nms.cpp @@ -33,7 +33,7 @@ TEST(attributes, multiclass_nms_v8_op_custom_attributes) { attrs.normalized = false; auto nms = make_shared(boxes, scores, attrs); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores}); auto g_nms = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 10; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -70,7 +70,7 @@ TEST(attributes, multiclass_nms_v8_op_default_attributes) { auto scores = make_shared(element::f32, Shape{1, 1, 1}); auto nms = make_shared(boxes, scores, opset8::MulticlassNms::Attributes()); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores}); auto g_nms = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 10; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -109,7 +109,7 @@ TEST(attributes, multiclass_nms_v9_op_custom_attributes) { attrs.normalized = false; auto nms = make_shared(boxes, scores, roisnum, attrs); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores, roisnum}); auto g_nms = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 10; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -147,7 +147,7 @@ TEST(attributes, multiclass_nms_v9_op_default_attributes) { auto roisnum = make_shared(element::i32, Shape{2}); auto nms = make_shared(boxes, scores, roisnum, opset9::MulticlassNms::Attributes()); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores, roisnum}); auto g_nms = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 10; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/mvn.cpp b/src/core/tests/visitors/op/mvn.cpp index 330441b4616e7a..0ce70af67d7f40 100644 --- a/src/core/tests/visitors/op/mvn.cpp +++ b/src/core/tests/visitors/op/mvn.cpp @@ -25,7 +25,7 @@ TEST(attributes, mvn_v1_op) { const auto op = make_shared(data, true, false, 0.1); op->set_reduction_axes(axes); - NodeBuilder builder(op); + NodeBuilder builder(op, {data}); const auto g_op = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 4; @@ -43,7 +43,7 @@ TEST(attributes, mvn_v6_op) { const auto op = make_shared(data, axes, false, 0.1, op::MVNEpsMode::INSIDE_SQRT); - NodeBuilder builder(op); + NodeBuilder builder(op, {data, axes}); const auto g_op = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 3; diff --git a/src/core/tests/visitors/op/non_max_suppression.cpp b/src/core/tests/visitors/op/non_max_suppression.cpp index c88dba8bc57431..77691def669762 100644 --- a/src/core/tests/visitors/op/non_max_suppression.cpp +++ b/src/core/tests/visitors/op/non_max_suppression.cpp @@ -25,7 +25,7 @@ TEST(attributes, non_max_suppression_op_custom_attributes) { bool sort_result_descending = false; auto nms = make_shared(boxes, scores, box_encoding, sort_result_descending); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores}); auto g_nms = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_nms->get_box_encoding(), nms->get_box_encoding()); @@ -38,7 +38,7 @@ TEST(attributes, non_max_suppression_op_default_attributes) { auto scores = make_shared(element::f32, Shape{1, 1, 1}); auto nms = make_shared(boxes, scores); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores}); auto g_nms = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_nms->get_box_encoding(), nms->get_box_encoding()); @@ -55,7 +55,7 @@ TEST(attributes, non_max_suppression_v3_op_custom_attributes) { element::Type output_type = element::i32; auto nms = make_shared(boxes, scores, box_encoding, sort_result_descending, output_type); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores}); auto g_nms = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_nms->get_box_encoding(), nms->get_box_encoding()); @@ -69,7 +69,7 @@ TEST(attributes, non_max_suppression_v3_op_default_attributes) { auto scores = make_shared(element::f32, Shape{1, 1, 1}); auto nms = make_shared(boxes, scores); - NodeBuilder builder(nms); + NodeBuilder builder(nms, {boxes, scores}); auto g_nms = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_nms->get_box_encoding(), nms->get_box_encoding()); diff --git a/src/core/tests/visitors/op/non_zero.cpp b/src/core/tests/visitors/op/non_zero.cpp index 1f264e560140d6..8f8a5fa2becc07 100644 --- a/src/core/tests/visitors/op/non_zero.cpp +++ b/src/core/tests/visitors/op/non_zero.cpp @@ -18,7 +18,9 @@ TEST(attributes, non_zero_op_default) { const auto data_node = make_shared(element::f32, Shape{1}); const auto non_zero = make_shared(data_node); - NodeBuilder builder(non_zero); + NodeBuilder builder(non_zero, {data_node}); + EXPECT_NO_THROW(auto g_non_zero = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -30,7 +32,8 @@ TEST(attributes, non_zero_op_i32) { const auto data_node = make_shared(element::f32, Shape{1}); const auto non_zero = make_shared(data_node, element::i32); - NodeBuilder builder(non_zero); + NodeBuilder builder(non_zero, {data_node}); + EXPECT_NO_THROW(auto g_non_zero = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -42,7 +45,8 @@ TEST(attributes, non_zero_op_i32_string) { const auto data_node = make_shared(element::f32, Shape{1}); const auto non_zero = make_shared(data_node, "i32"); - NodeBuilder builder(non_zero); + NodeBuilder builder(non_zero, {data_node}); + EXPECT_NO_THROW(auto g_non_zero = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -54,7 +58,8 @@ TEST(attributes, non_zero_op_i64) { const auto data_node = make_shared(element::f32, Shape{1}); const auto non_zero = make_shared(data_node, element::i64); - NodeBuilder builder(non_zero); + NodeBuilder builder(non_zero, {data_node}); + EXPECT_NO_THROW(auto g_non_zero = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -66,7 +71,8 @@ TEST(attributes, non_zero_op_i64_string) { const auto data_node = make_shared(element::f32, Shape{1}); const auto non_zero = make_shared(data_node, "i64"); - NodeBuilder builder(non_zero); + NodeBuilder builder(non_zero, {data_node}); + EXPECT_NO_THROW(auto g_non_zero = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/normalize_l2.cpp b/src/core/tests/visitors/op/normalize_l2.cpp index 239415e00cb480..0b9c6cb9be91db 100644 --- a/src/core/tests/visitors/op/normalize_l2.cpp +++ b/src/core/tests/visitors/op/normalize_l2.cpp @@ -18,7 +18,7 @@ void static test_normalize_l2_attributes(float eps, op::EpsMode eps_mode) { const auto axes = make_shared(element::i32, Shape{}, vector{1}); auto normalize_l2 = make_shared(data, axes, eps, eps_mode); - NodeBuilder builder(normalize_l2); + NodeBuilder builder(normalize_l2, {data, axes}); auto g_normalize_l2 = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 2; diff --git a/src/core/tests/visitors/op/one_hot.cpp b/src/core/tests/visitors/op/one_hot.cpp index 91beec2a7f9389..339245dad8904f 100644 --- a/src/core/tests/visitors/op/one_hot.cpp +++ b/src/core/tests/visitors/op/one_hot.cpp @@ -26,7 +26,7 @@ TEST(attributes, one_hot_op) { int64_t axis = 3; auto one_hot = make_shared(indices, depth, on_value, off_value, axis); - NodeBuilder builder(one_hot); + NodeBuilder builder(one_hot, {indices, depth, on_value, off_value}); auto g_one_hot = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_one_hot->get_axis(), one_hot->get_axis()); diff --git a/src/core/tests/visitors/op/pad.cpp b/src/core/tests/visitors/op/pad.cpp index a96a3e940f26a6..7272dffe98d03c 100644 --- a/src/core/tests/visitors/op/pad.cpp +++ b/src/core/tests/visitors/op/pad.cpp @@ -25,10 +25,12 @@ TEST(attributes, pad_op) { auto pad_mode = op::PadMode::EDGE; auto pad = make_shared(arg, pads_begin, pads_end, pad_mode); - NodeBuilder builder(pad); + NodeBuilder builder(pad, {arg, pads_begin, pads_end}); auto g_pad = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_pad->get_pad_mode(), pad->get_pad_mode()); + EXPECT_EQ(g_pad->get_pads_begin(), pad->get_pads_begin()); + EXPECT_EQ(g_pad->get_pads_end(), pad->get_pads_end()); } TEST(attributes, pad_op2) { @@ -41,8 +43,10 @@ TEST(attributes, pad_op2) { auto pad_mode = op::PadMode::CONSTANT; auto pad = make_shared(arg, pads_begin, pads_end, pad_value, pad_mode); - NodeBuilder builder(pad); + NodeBuilder builder(pad, {arg, pads_begin, pads_end, pad_value}); auto g_pad = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_pad->get_pad_mode(), pad->get_pad_mode()); + EXPECT_EQ(g_pad->get_pads_begin(), pad->get_pads_begin()); + EXPECT_EQ(g_pad->get_pads_end(), pad->get_pads_end()); } diff --git a/src/core/tests/visitors/op/prelu.cpp b/src/core/tests/visitors/op/prelu.cpp index 9f5b03f49108ca..2fd4eb1ccea49a 100644 --- a/src/core/tests/visitors/op/prelu.cpp +++ b/src/core/tests/visitors/op/prelu.cpp @@ -18,7 +18,8 @@ TEST(attributes, prelu_op) { const auto slope = make_shared(element::f32, Shape{5}); const auto prelu = make_shared(data, slope); - NodeBuilder builder(prelu); + NodeBuilder builder(prelu, {data, slope}); + EXPECT_NO_THROW(auto g_prelu = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/prior_box.cpp b/src/core/tests/visitors/op/prior_box.cpp index 9705ba3c06eea7..502309064cea5c 100644 --- a/src/core/tests/visitors/op/prior_box.cpp +++ b/src/core/tests/visitors/op/prior_box.cpp @@ -37,7 +37,7 @@ TEST(attributes, prior_box_op) { attrs.scale_all_sizes = true; auto prior_box = make_shared(layer_shape, image_shape, attrs); - NodeBuilder builder(prior_box); + NodeBuilder builder(prior_box, {layer_shape, image_shape}); auto g_prior_box = ov::as_type_ptr(builder.create()); const auto prior_box_attrs = prior_box->get_attrs(); @@ -57,6 +57,7 @@ TEST(attributes, prior_box_op) { EXPECT_EQ(g_prior_box_attrs.offset, prior_box_attrs.offset); EXPECT_EQ(g_prior_box_attrs.variance, prior_box_attrs.variance); EXPECT_EQ(g_prior_box_attrs.scale_all_sizes, prior_box_attrs.scale_all_sizes); + EXPECT_EQ(g_prior_box->has_evaluate(), prior_box->has_evaluate()); } TEST(attributes, prior_box_op2) { @@ -79,7 +80,7 @@ TEST(attributes, prior_box_op2) { attrs.scale_all_sizes = false; auto prior_box = make_shared(layer_shape, image_shape, attrs); - NodeBuilder builder(prior_box); + NodeBuilder builder(prior_box, {layer_shape, image_shape}); auto g_prior_box = ov::as_type_ptr(builder.create()); const auto prior_box_attrs = prior_box->get_attrs(); @@ -99,6 +100,7 @@ TEST(attributes, prior_box_op2) { EXPECT_EQ(g_prior_box_attrs.offset, prior_box_attrs.offset); EXPECT_EQ(g_prior_box_attrs.variance, prior_box_attrs.variance); EXPECT_EQ(g_prior_box_attrs.scale_all_sizes, prior_box_attrs.scale_all_sizes); + EXPECT_EQ(g_prior_box->has_evaluate(), prior_box->has_evaluate()); } TEST(attributes, prior_box_v8_op) { @@ -122,7 +124,7 @@ TEST(attributes, prior_box_v8_op) { attrs.min_max_aspect_ratios_order = false; auto prior_box = make_shared(layer_shape, image_shape, attrs); - NodeBuilder builder(prior_box); + NodeBuilder builder(prior_box, {layer_shape, image_shape}); auto g_prior_box = ov::as_type_ptr(builder.create()); const auto prior_box_attrs = prior_box->get_attrs(); @@ -143,4 +145,5 @@ TEST(attributes, prior_box_v8_op) { EXPECT_EQ(g_prior_box_attrs.variance, prior_box_attrs.variance); EXPECT_EQ(g_prior_box_attrs.scale_all_sizes, prior_box_attrs.scale_all_sizes); EXPECT_EQ(g_prior_box_attrs.min_max_aspect_ratios_order, prior_box_attrs.min_max_aspect_ratios_order); + EXPECT_EQ(g_prior_box->has_evaluate(), prior_box->has_evaluate()); } diff --git a/src/core/tests/visitors/op/prior_box_clustered.cpp b/src/core/tests/visitors/op/prior_box_clustered.cpp index 0e2ba0a36a435b..de1fe6b8af6095 100644 --- a/src/core/tests/visitors/op/prior_box_clustered.cpp +++ b/src/core/tests/visitors/op/prior_box_clustered.cpp @@ -28,7 +28,7 @@ TEST(attributes, prior_box_clustered_op) { attrs.variances = {0.1f}; auto pbc = make_shared(layer_shape, image_shape, attrs); - NodeBuilder builder(pbc); + NodeBuilder builder(pbc, {layer_shape, image_shape}); auto g_pbc = ov::as_type_ptr(builder.create()); const auto pbc_attrs = pbc->get_attrs(); const auto g_pbc_attrs = g_pbc->get_attrs(); @@ -43,6 +43,7 @@ TEST(attributes, prior_box_clustered_op) { EXPECT_EQ(g_pbc_attrs.step, pbc_attrs.step); EXPECT_EQ(g_pbc_attrs.offset, pbc_attrs.offset); EXPECT_EQ(g_pbc_attrs.variances, pbc_attrs.variances); + EXPECT_EQ(g_pbc->has_evaluate(), pbc->has_evaluate()); } TEST(attributes, prior_box_clustered_op2) { @@ -61,7 +62,7 @@ TEST(attributes, prior_box_clustered_op2) { attrs.variances = {0.1f, 0.1f, 0.2f, 0.2}; auto pbc = make_shared(layer_shape, image_shape, attrs); - NodeBuilder builder(pbc); + NodeBuilder builder(pbc, {layer_shape, image_shape}); auto g_pbc = ov::as_type_ptr(builder.create()); const auto pbc_attrs = pbc->get_attrs(); const auto g_pbc_attrs = g_pbc->get_attrs(); @@ -76,4 +77,5 @@ TEST(attributes, prior_box_clustered_op2) { EXPECT_EQ(g_pbc_attrs.step, pbc_attrs.step); EXPECT_EQ(g_pbc_attrs.offset, pbc_attrs.offset); EXPECT_EQ(g_pbc_attrs.variances, pbc_attrs.variances); + EXPECT_EQ(g_pbc->has_evaluate(), pbc->has_evaluate()); } diff --git a/src/core/tests/visitors/op/proposal.cpp b/src/core/tests/visitors/op/proposal.cpp index b8df5a9083e6a1..affe77429e3337 100644 --- a/src/core/tests/visitors/op/proposal.cpp +++ b/src/core/tests/visitors/op/proposal.cpp @@ -39,7 +39,7 @@ TEST(attributes, proposal_op) { attrs.framework = string{"nGraph"}; auto proposal = make_shared(class_probs, class_logits, image_shape, attrs); - NodeBuilder builder(proposal); + NodeBuilder builder(proposal, {class_probs, class_logits, image_shape}); auto g_proposal = ov::as_type_ptr(builder.create()); const auto proposal_attrs = proposal->get_attrs(); @@ -78,7 +78,7 @@ TEST(attributes, proposal_op2) { attrs.scale = vector{4.0f, 6.0f, 9.0f, 16.0f, 24.0f, 32.0f}; auto proposal = make_shared(class_probs, class_logits, image_shape, attrs); - NodeBuilder builder(proposal); + NodeBuilder builder(proposal, {class_probs, class_logits, image_shape}); auto g_proposal = ov::as_type_ptr(builder.create()); const auto proposal_attrs = proposal->get_attrs(); diff --git a/src/core/tests/visitors/op/psroi_pooling.cpp b/src/core/tests/visitors/op/psroi_pooling.cpp index a668489e19e9c5..f03d8163dccc7d 100644 --- a/src/core/tests/visitors/op/psroi_pooling.cpp +++ b/src/core/tests/visitors/op/psroi_pooling.cpp @@ -36,7 +36,7 @@ TEST(attributes, psroi_pooling_op) { spatial_bins_x, spatial_bins_y, mode); - NodeBuilder builder(psroi_pool); + NodeBuilder builder(psroi_pool, {input, coords}); auto g_psroi_pool = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_psroi_pool->get_output_dim(), psroi_pool->get_output_dim()); diff --git a/src/core/tests/visitors/op/random_uniform.cpp b/src/core/tests/visitors/op/random_uniform.cpp index 2a3a0a20f9c1af..cb20e9a6bb4d41 100644 --- a/src/core/tests/visitors/op/random_uniform.cpp +++ b/src/core/tests/visitors/op/random_uniform.cpp @@ -21,7 +21,7 @@ TEST(attributes, random_uniform_op) { const auto random_uniform = make_shared(out_shape, min_val, max_val, element::Type_t::f32, 150, 10); - NodeBuilder builder(random_uniform); + NodeBuilder builder(random_uniform, {out_shape, min_val, max_val}); auto g_random_uniform = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 3; diff --git a/src/core/tests/visitors/op/range.cpp b/src/core/tests/visitors/op/range.cpp index a73c9f070ccdd9..efd282eba718c2 100644 --- a/src/core/tests/visitors/op/range.cpp +++ b/src/core/tests/visitors/op/range.cpp @@ -22,7 +22,7 @@ TEST(attributes, range_op) { auto output_type = element::f32; auto range = make_shared(start, stop, step, output_type); - NodeBuilder builder(range); + NodeBuilder builder(range, {start, stop, step}); auto g_range = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_range->get_output_type(), range->get_output_type()); diff --git a/src/core/tests/visitors/op/rdft.cpp b/src/core/tests/visitors/op/rdft.cpp index f1f283452cf303..07871935f371cb 100644 --- a/src/core/tests/visitors/op/rdft.cpp +++ b/src/core/tests/visitors/op/rdft.cpp @@ -17,9 +17,10 @@ TEST(attributes, rdft_op) { auto axes = op::v0::Constant::create(element::i64, Shape{1}, {2}); auto rdft = make_shared(data, axes); - NodeBuilder builder(rdft); - const auto expected_attr_count = 0; + NodeBuilder builder(rdft, {data, axes}); + EXPECT_NO_THROW(auto g_rdft = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } @@ -30,8 +31,9 @@ TEST(attributes, rdft_op_signal) { auto axes = op::v0::Constant::create(element::i64, Shape{1}, {2}); auto rdft = make_shared(data, axes, signal); - NodeBuilder builder(rdft); - const auto expected_attr_count = 0; + NodeBuilder builder(rdft, {data, axes, signal}); + EXPECT_NO_THROW(auto g_rdft = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } \ No newline at end of file diff --git a/src/core/tests/visitors/op/read_value.cpp b/src/core/tests/visitors/op/read_value.cpp index ace7a0550bfbb5..4f12e573163b72 100644 --- a/src/core/tests/visitors/op/read_value.cpp +++ b/src/core/tests/visitors/op/read_value.cpp @@ -19,7 +19,8 @@ TEST(attributes, readvalue_v3_op) { const auto in = make_shared(element::f32, Shape{1}); const string variable_id = "v0"; const auto read_value = make_shared(in, variable_id); - NodeBuilder builder(read_value); + NodeBuilder builder(read_value, {in}); + EXPECT_NO_THROW(auto g_read_value = ov::as_type_ptr(builder.create())); // attribute count const auto expected_attr_count = 1; @@ -31,7 +32,8 @@ TEST(attributes, readvalue_v6_op) { const auto in = make_shared(element::f32, Shape{1}); const auto variable = std::make_shared(VariableInfo{PartialShape::dynamic(), element::dynamic, "v0"}); const auto read_value = make_shared(in, variable); - NodeBuilder builder(read_value); + NodeBuilder builder(read_value, {in}); + EXPECT_NO_THROW(auto g_read_value = ov::as_type_ptr(builder.create())); // attribute count const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/reduce_ops.hpp b/src/core/tests/visitors/op/reduce_ops.hpp index 97ef8ab472db94..4249e182b7ea7f 100644 --- a/src/core/tests/visitors/op/reduce_ops.hpp +++ b/src/core/tests/visitors/op/reduce_ops.hpp @@ -59,7 +59,7 @@ TYPED_TEST_P(ReduceOperatorVisitor, keep_dims_3D) const auto reduction_axes = make_shared(axes_et, axes_shape); const auto reduce_op = make_shared(data, reduction_axes, keep_dims); - NodeBuilder builder(reduce_op); + NodeBuilder builder(reduce_op, {data, reduction_axes}); const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); auto g_reduce_op = as_type_ptr(builder.create()); @@ -83,7 +83,7 @@ TYPED_TEST_P(ReduceOperatorVisitor, do_not_keep_dims_3D) const auto reduction_axes = make_shared(axes_et, axes_shape); const auto reduce_op = make_shared(data, reduction_axes, keep_dims); - NodeBuilder builder(reduce_op); + NodeBuilder builder(reduce_op, {data, reduction_axes}); const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); auto g_reduce_op = ov::as_type_ptr(builder.create()); diff --git a/src/core/tests/visitors/op/region_yolo.cpp b/src/core/tests/visitors/op/region_yolo.cpp index 61fbe9927ca11e..0369ff211afd82 100644 --- a/src/core/tests/visitors/op/region_yolo.cpp +++ b/src/core/tests/visitors/op/region_yolo.cpp @@ -38,7 +38,7 @@ TEST(attributes, region_yolo_op) { axis, end_axis, anchors); - NodeBuilder builder(region_yolo); + NodeBuilder builder(region_yolo, {data}); auto g_region_yolo = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_region_yolo->get_num_coords(), region_yolo->get_num_coords()); diff --git a/src/core/tests/visitors/op/reorg_yolo.cpp b/src/core/tests/visitors/op/reorg_yolo.cpp index 9e599a0dd0d72d..3e870872b52635 100644 --- a/src/core/tests/visitors/op/reorg_yolo.cpp +++ b/src/core/tests/visitors/op/reorg_yolo.cpp @@ -21,7 +21,7 @@ TEST(attributes, reorg_yolo_op_stride) { const auto data = make_shared(element::i32, Shape{1, 64, 26, 26}); const auto op = make_shared(data, 2); - NodeBuilder builder(op); + NodeBuilder builder(op, {data}); const auto g_op = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_op->get_strides(), op->get_strides()); @@ -32,7 +32,7 @@ TEST(attributes, reorg_yolo_op_strides) { const auto data = make_shared(element::i32, Shape{1, 64, 26, 26}); const auto op = make_shared(data, Strides{2}); - NodeBuilder builder(op); + NodeBuilder builder(op, {data}); const auto g_op = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_op->get_strides(), op->get_strides()); diff --git a/src/core/tests/visitors/op/reshape.cpp b/src/core/tests/visitors/op/reshape.cpp index 831c091dd438df..b74c967e8e06ad 100644 --- a/src/core/tests/visitors/op/reshape.cpp +++ b/src/core/tests/visitors/op/reshape.cpp @@ -24,7 +24,7 @@ TEST(attributes, reshape_op) { bool special_zero = true; auto reshape = make_shared(data, pattern, special_zero); - NodeBuilder builder(reshape); + NodeBuilder builder(reshape, {data, pattern}); auto g_reshape = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/reverse.cpp b/src/core/tests/visitors/op/reverse.cpp index aebbcdc6f0e930..0ec0935c597d1e 100644 --- a/src/core/tests/visitors/op/reverse.cpp +++ b/src/core/tests/visitors/op/reverse.cpp @@ -22,7 +22,7 @@ TEST(attributes, reverse_op_enum_mode) { auto reversed_axes = make_shared(element::i32, Shape{200}); auto reverse = make_shared(data, reversed_axes, opset1::Reverse::Mode::INDEX); - NodeBuilder builder(reverse); + NodeBuilder builder(reverse, {data, reversed_axes}); auto g_reverse = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_reverse->get_mode(), reverse->get_mode()); @@ -36,7 +36,7 @@ TEST(attributes, reverse_op_string_mode) { std::string mode = "index"; auto reverse = make_shared(data, reversed_axes, mode); - NodeBuilder builder(reverse); + NodeBuilder builder(reverse, {data, reversed_axes}); auto g_reverse = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_reverse->get_mode(), reverse->get_mode()); diff --git a/src/core/tests/visitors/op/reverse_sequence.cpp b/src/core/tests/visitors/op/reverse_sequence.cpp index 1b2bff8c21bc24..f4fa91e83d6bf5 100644 --- a/src/core/tests/visitors/op/reverse_sequence.cpp +++ b/src/core/tests/visitors/op/reverse_sequence.cpp @@ -26,7 +26,7 @@ TEST(attributes, reverse_sequence_op) { auto reverse_sequence = make_shared(data, seq_indices, batch_axis, seq_axis); - NodeBuilder builder(reverse_sequence); + NodeBuilder builder(reverse_sequence, {data, seq_indices}); const auto expected_attr_count = 2; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/rnn_cell.cpp b/src/core/tests/visitors/op/rnn_cell.cpp index d360e6960feab9..1a44fcd9fa0f76 100644 --- a/src/core/tests/visitors/op/rnn_cell.cpp +++ b/src/core/tests/visitors/op/rnn_cell.cpp @@ -32,7 +32,7 @@ TEST(attributes, rnn_cell_op_custom_attributes) { auto rnn_cell = make_shared(X, H, W, R, hidden_size, activations, activations_alpha, activations_beta, clip); - NodeBuilder builder(rnn_cell); + NodeBuilder builder(rnn_cell, {X, H, W, R}); auto g_rnn_cell = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_rnn_cell->get_hidden_size(), rnn_cell->get_hidden_size()); @@ -53,7 +53,7 @@ TEST(attributes, rnn_cell_op_default_attributes) { auto rnn_cell = make_shared(X, H, W, R, hidden_size); - NodeBuilder builder(rnn_cell); + NodeBuilder builder(rnn_cell, {X, H, W, R}); auto g_rnn_cell = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_rnn_cell->get_hidden_size(), rnn_cell->get_hidden_size()); diff --git a/src/core/tests/visitors/op/rnn_sequence.cpp b/src/core/tests/visitors/op/rnn_sequence.cpp index 96f0dfa2ab9997..98b5ee758e30e7 100644 --- a/src/core/tests/visitors/op/rnn_sequence.cpp +++ b/src/core/tests/visitors/op/rnn_sequence.cpp @@ -51,7 +51,7 @@ TEST(attributes, rnn_sequence_op) { activations_alpha, activations_beta, clip_threshold); - NodeBuilder builder(rnn_sequence); + NodeBuilder builder(rnn_sequence, {X, initial_hidden_state, sequence_lengths, W, R, B}); auto g_rnn_sequence = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_rnn_sequence->get_hidden_size(), rnn_sequence->get_hidden_size()); diff --git a/src/core/tests/visitors/op/roi_pooling.cpp b/src/core/tests/visitors/op/roi_pooling.cpp index 8b1f00c43b5fd2..d09163840f53e1 100644 --- a/src/core/tests/visitors/op/roi_pooling.cpp +++ b/src/core/tests/visitors/op/roi_pooling.cpp @@ -22,7 +22,7 @@ TEST(attributes, roi_pooling_op) { const auto coords = make_shared(element::f32, Shape{2, 5}); const auto op = make_shared(data, coords, Shape{5, 5}, 0.123, "bilinear"); - NodeBuilder builder(op); + NodeBuilder builder(op, {data, coords}); const auto g_op = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_op->get_output_size(), op->get_output_size()); diff --git a/src/core/tests/visitors/op/roll.cpp b/src/core/tests/visitors/op/roll.cpp index 6ce11fcaed0d28..0b45b163778f1a 100644 --- a/src/core/tests/visitors/op/roll.cpp +++ b/src/core/tests/visitors/op/roll.cpp @@ -19,7 +19,8 @@ TEST(attributes, roll_op) { const auto C = make_shared(element::i32, Shape{3}); const auto roll = make_shared(A, B, C); - NodeBuilder builder(roll); + NodeBuilder builder(roll, {A, B, C}); + EXPECT_NO_THROW(auto g_roll = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/round.cpp b/src/core/tests/visitors/op/round.cpp index 65a23c14cac413..04292073d0599a 100644 --- a/src/core/tests/visitors/op/round.cpp +++ b/src/core/tests/visitors/op/round.cpp @@ -20,7 +20,7 @@ void static test_mode(opset5::Round::RoundMode mode) { NodeBuilder::get_ops().register_factory(); auto data = make_shared(element::f32, Shape{200}); auto round = make_shared(data, mode); - NodeBuilder builder(round); + NodeBuilder builder(round, {data}); auto g_round = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_round->get_mode(), round->get_mode()); diff --git a/src/core/tests/visitors/op/scatter_elements_update.cpp b/src/core/tests/visitors/op/scatter_elements_update.cpp index 56cc37cc6a3531..f3516b1a5a1db7 100644 --- a/src/core/tests/visitors/op/scatter_elements_update.cpp +++ b/src/core/tests/visitors/op/scatter_elements_update.cpp @@ -21,7 +21,7 @@ TEST(attributes, scatter_elements_update) { auto axis = std::make_shared(element::i16, Shape{}); auto scatter = std::make_shared(data, indices, updates, axis); - NodeBuilder builder(scatter); + NodeBuilder builder(scatter, {data, indices, updates, axis}); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/scatter_update.cpp b/src/core/tests/visitors/op/scatter_update.cpp index 61ea28ac5e1d94..f722bd69c64fe8 100644 --- a/src/core/tests/visitors/op/scatter_update.cpp +++ b/src/core/tests/visitors/op/scatter_update.cpp @@ -29,7 +29,7 @@ TEST(attributes, scatter_update_op) { auto A = op::Constant::create(element::i16, Shape{}, {1}); auto op = make_shared(R, I, U, A); - NodeBuilder builder(op); + NodeBuilder builder(op, {R, I, U, A}); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/select.cpp b/src/core/tests/visitors/op/select.cpp index 5b7fcdad418783..b0ac89e4d32393 100644 --- a/src/core/tests/visitors/op/select.cpp +++ b/src/core/tests/visitors/op/select.cpp @@ -21,7 +21,7 @@ TEST(attributes, select_fp32) { auto auto_broadcast = op::AutoBroadcastType::NUMPY; auto select = std::make_shared(in_cond, in_then, in_else, auto_broadcast); - NodeBuilder builder(select); + NodeBuilder builder(select, {in_cond, in_then, in_else}); const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -39,7 +39,7 @@ TEST(attributes, select_i32) { auto auto_broadcast = op::AutoBroadcastType::NUMPY; auto select = std::make_shared(in_cond, in_then, in_else, auto_broadcast); - NodeBuilder builder(select); + NodeBuilder builder(select, {in_cond, in_then, in_else}); const auto expected_attr_count = 1; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/selu.cpp b/src/core/tests/visitors/op/selu.cpp index e9b82973e1e974..0b7a53f8b356ea 100644 --- a/src/core/tests/visitors/op/selu.cpp +++ b/src/core/tests/visitors/op/selu.cpp @@ -20,8 +20,9 @@ TEST(attributes, selu_op) { const auto op = make_shared(data_input, alpha, lambda); - NodeBuilder builder(op); + NodeBuilder builder(op, {data_input, alpha, lambda}); const auto expected_attr_count = 0; + EXPECT_NO_THROW(auto g_op = ov::as_type_ptr(builder.create())); EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } diff --git a/src/core/tests/visitors/op/shape_of.cpp b/src/core/tests/visitors/op/shape_of.cpp index b147cc9fbc0f26..bdce53c369b5f1 100644 --- a/src/core/tests/visitors/op/shape_of.cpp +++ b/src/core/tests/visitors/op/shape_of.cpp @@ -19,7 +19,7 @@ TEST(attributes, shapeof_op1) { NodeBuilder::get_ops().register_factory(); auto data = make_shared(element::i32, Shape{2, 3, 4}); auto shapeof = make_shared(data); - NodeBuilder builder(shapeof); + NodeBuilder builder(shapeof, {data}); auto g_shapeof = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 0; @@ -30,7 +30,7 @@ TEST(attributes, shapeof_op3) { NodeBuilder::get_ops().register_factory(); auto data = make_shared(element::i32, Shape{2, 3, 4}); auto shapeof = make_shared(data, element::Type_t::i64); - NodeBuilder builder(shapeof); + NodeBuilder builder(shapeof, {data}); auto g_shapeof = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 1; diff --git a/src/core/tests/visitors/op/shuffle_channels.cpp b/src/core/tests/visitors/op/shuffle_channels.cpp index c85a888f950d03..d3b787345acd44 100644 --- a/src/core/tests/visitors/op/shuffle_channels.cpp +++ b/src/core/tests/visitors/op/shuffle_channels.cpp @@ -19,7 +19,7 @@ TEST(attributes, shuffle_channels_op) { auto axis = 1; auto groups = 2; auto shuffle_channels = make_shared(data, axis, groups); - NodeBuilder builder(shuffle_channels); + NodeBuilder builder(shuffle_channels, {data}); auto g_shuffle_channels = ov::as_type_ptr(builder.create()); const auto expected_attr_count = 2; diff --git a/src/core/tests/visitors/op/slice.cpp b/src/core/tests/visitors/op/slice.cpp index 651560b8f1803a..dd667b14c68b35 100644 --- a/src/core/tests/visitors/op/slice.cpp +++ b/src/core/tests/visitors/op/slice.cpp @@ -20,7 +20,7 @@ TEST(attributes, slice_op_no_axes) { const auto step = make_shared(element::i32, Shape{4}); const auto op = make_shared(data, start, stop, step); - NodeBuilder builder(op); + NodeBuilder builder(op, {data, start, stop, step}); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); @@ -35,7 +35,7 @@ TEST(attributes, slice_op_with_axes) { const auto axes = make_shared(element::i32, Shape{4}); const auto op = make_shared(data, start, stop, step, axes); - NodeBuilder builder(op); + NodeBuilder builder(op, {data, start, stop, step, axes}); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/softmax.cpp b/src/core/tests/visitors/op/softmax.cpp index ba2785df0237fb..05e34eefbd2a98 100644 --- a/src/core/tests/visitors/op/softmax.cpp +++ b/src/core/tests/visitors/op/softmax.cpp @@ -21,7 +21,7 @@ TEST(attributes, softmax_op) { auto data = make_shared(element::i32, Shape{200}); auto axis = 0; auto softmax = make_shared(data, axis); - NodeBuilder builder(softmax); + NodeBuilder builder(softmax, {data}); auto g_softmax = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_softmax->get_axis(), softmax->get_axis()); diff --git a/src/core/tests/visitors/op/space_to_batch.cpp b/src/core/tests/visitors/op/space_to_batch.cpp index 3f251059cde94f..7623bd9f4c9b77 100644 --- a/src/core/tests/visitors/op/space_to_batch.cpp +++ b/src/core/tests/visitors/op/space_to_batch.cpp @@ -22,7 +22,8 @@ TEST(attributes, space_to_batch_op) { auto pads_end = make_shared(element::i64, Shape{2}, vector{0, 0}); auto op = make_shared(data, block_shape, pads_begin, pads_end); - NodeBuilder builder(op); + NodeBuilder builder(op, {data, block_shape, pads_begin, pads_end}); + EXPECT_NO_THROW(auto g_op = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/space_to_depth.cpp b/src/core/tests/visitors/op/space_to_depth.cpp index 98912fec3218d5..36d9025972d51f 100644 --- a/src/core/tests/visitors/op/space_to_depth.cpp +++ b/src/core/tests/visitors/op/space_to_depth.cpp @@ -24,7 +24,7 @@ TEST(attributes, space_to_depth_op) { auto mode = opset1::SpaceToDepth::SpaceToDepthMode::BLOCKS_FIRST; auto space_to_depth = make_shared(data, mode, block_size); - NodeBuilder builder(space_to_depth); + NodeBuilder builder(space_to_depth, {data}); auto g_space_to_depth = ov::as_type_ptr(builder.create()); // attribute count diff --git a/src/core/tests/visitors/op/split.cpp b/src/core/tests/visitors/op/split.cpp index ce26573acde49e..989d250de0781a 100644 --- a/src/core/tests/visitors/op/split.cpp +++ b/src/core/tests/visitors/op/split.cpp @@ -19,7 +19,7 @@ TEST(attributes, split_op) { auto axis = make_shared(element::i32, Shape{}); auto num_splits = 2; auto split = make_shared(data, axis, num_splits); - NodeBuilder builder(split); + NodeBuilder builder(split,{data, axis}); auto g_split = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_split->get_num_splits(), split->get_num_splits()); @@ -31,7 +31,7 @@ TEST(attributes, split_op2) { auto axis = make_shared(element::i32, Shape{}); auto num_splits = 3; auto split = make_shared(data, axis, num_splits); - NodeBuilder builder(split); + NodeBuilder builder(split, {data, axis}); auto g_split = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_split->get_num_splits(), split->get_num_splits()); diff --git a/src/core/tests/visitors/op/strided_slice.cpp b/src/core/tests/visitors/op/strided_slice.cpp index f06c1b48a8b84a..774759f1b88ef1 100644 --- a/src/core/tests/visitors/op/strided_slice.cpp +++ b/src/core/tests/visitors/op/strided_slice.cpp @@ -38,7 +38,7 @@ TEST(attributes, strided_slice_op) { new_axis_mask, shrink_axis_mask, ellipsis_mask); - NodeBuilder builder(strided_slice); + NodeBuilder builder(strided_slice, {data, begin, end, stride}); auto g_strided_slice = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_strided_slice->get_begin_mask(), strided_slice->get_begin_mask()); diff --git a/src/core/tests/visitors/op/tile.cpp b/src/core/tests/visitors/op/tile.cpp index 9744f288ac6fe6..462b864acf5652 100644 --- a/src/core/tests/visitors/op/tile.cpp +++ b/src/core/tests/visitors/op/tile.cpp @@ -18,7 +18,8 @@ TEST(attributes, tile_op) { const auto repeats = make_shared(element::i64, Shape{4}); const auto tile = make_shared(data, repeats); - NodeBuilder builder(tile); + NodeBuilder builder(tile, {data, repeats}); + EXPECT_NO_THROW(auto g_tile = ov::as_type_ptr(builder.create())); const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); diff --git a/src/core/tests/visitors/op/topk.cpp b/src/core/tests/visitors/op/topk.cpp index 9ce6a5cffdd2f0..249b4a0a8ee473 100644 --- a/src/core/tests/visitors/op/topk.cpp +++ b/src/core/tests/visitors/op/topk.cpp @@ -26,10 +26,30 @@ TEST(attributes, topk_op) { auto sort_type = opset1::TopK::SortType::SORT_VALUES; auto topk = make_shared(data, k, axis, mode, sort_type); - NodeBuilder builder(topk); + NodeBuilder builder(topk, {data, k}); auto g_topk = ov::as_type_ptr(builder.create()); EXPECT_EQ(g_topk->get_axis(), topk->get_axis()); EXPECT_EQ(g_topk->get_mode(), topk->get_mode()); EXPECT_EQ(g_topk->get_sort_type(), topk->get_sort_type()); + EXPECT_EQ(g_topk->get_index_element_type(), topk->get_index_element_type()); +} + +TEST(attributes, topk_v3_op) { + NodeBuilder::get_ops().register_factory(); + auto data = make_shared(element::i32, Shape{2, 3, 4, 5}); + auto k = make_shared(element::i32, Shape{}); + + auto axis = 0; + auto mode = opset3::TopK::Mode::MAX; + auto sort_type = opset3::TopK::SortType::SORT_VALUES; + + auto topk = make_shared(data, k, axis, mode, sort_type); + NodeBuilder builder(topk, {data, k}); + auto g_topk = ov::as_type_ptr(builder.create()); + + EXPECT_EQ(g_topk->get_axis(), topk->get_axis()); + EXPECT_EQ(g_topk->get_mode(), topk->get_mode()); + EXPECT_EQ(g_topk->get_sort_type(), topk->get_sort_type()); + EXPECT_EQ(g_topk->get_index_element_type(), topk->get_index_element_type()); } diff --git a/src/core/tests/visitors/op/transpose.cpp b/src/core/tests/visitors/op/transpose.cpp index 3f326d42dc8b86..d1b63ce3e3b1d6 100644 --- a/src/core/tests/visitors/op/transpose.cpp +++ b/src/core/tests/visitors/op/transpose.cpp @@ -21,8 +21,9 @@ TEST(attributes, transpose_op) { const auto op = make_shared(data_input, axes_order_input); - NodeBuilder builder(op); - const auto expected_attr_count = 0; + NodeBuilder builder(op, {data_input, axes_order_input}); + EXPECT_NO_THROW(auto g_op = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } diff --git a/src/core/tests/visitors/op/unary_ops.hpp b/src/core/tests/visitors/op/unary_ops.hpp index eda54d1f3de160..d420867c7748b9 100644 --- a/src/core/tests/visitors/op/unary_ops.hpp +++ b/src/core/tests/visitors/op/unary_ops.hpp @@ -37,7 +37,10 @@ TYPED_TEST_P(UnaryOperatorVisitor, No_Attribute_4D) { const auto A = std::make_shared(element_type, ngraph::PartialShape{2, 2, 2, 2}); const auto op_func = std::make_shared(A); - ngraph::test::NodeBuilder builder(op_func); + ngraph::test::NodeBuilder builder(op_func, {A}); + + EXPECT_NO_THROW(auto g_op_func = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } diff --git a/src/core/tests/visitors/op/unsqueeze.cpp b/src/core/tests/visitors/op/unsqueeze.cpp index 3625260f757ca6..2343313f69109c 100644 --- a/src/core/tests/visitors/op/unsqueeze.cpp +++ b/src/core/tests/visitors/op/unsqueeze.cpp @@ -15,12 +15,15 @@ using ngraph::test::NodeBuilder; TEST(attributes, unsqueeze_op) { using namespace opset1; + NodeBuilder::get_ops().register_factory(); + auto param = make_shared(element::f32, Shape{4, 1, 4, 1, 8}); auto axes = make_shared(element::u64, Shape{2}, vector{1, 2}); auto op = make_shared(param, axes); - NodeBuilder builder(op); - const auto expected_attr_count = 0; + NodeBuilder builder(op, {param, axes}); + EXPECT_NO_THROW(auto g_op = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } diff --git a/src/core/tests/visitors/op/variadic_split.cpp b/src/core/tests/visitors/op/variadic_split.cpp index 9e9b4ed41f886a..179e63e5079e0f 100644 --- a/src/core/tests/visitors/op/variadic_split.cpp +++ b/src/core/tests/visitors/op/variadic_split.cpp @@ -22,8 +22,9 @@ TEST(attributes, variadic_split_op) { auto split_lengths = make_shared(element::i32, Shape{1}); auto split = make_shared(data, axis, split_lengths); - NodeBuilder builder(split); - const auto expected_attr_count = 0; + NodeBuilder builder(split, {data, axis, split_lengths}); + EXPECT_NO_THROW(auto g_split = ov::as_type_ptr(builder.create())); + const auto expected_attr_count = 0; EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } diff --git a/src/tests/util/visitor.hpp b/src/tests/util/visitor.hpp index 2ae05bde1e5833..b63da6acc0df24 100644 --- a/src/tests/util/visitor.hpp +++ b/src/tests/util/visitor.hpp @@ -373,11 +373,12 @@ class SerializeAttributeVisitor : public AttributeVisitor { class NodeBuilder : public ValueMap, public DeserializeAttributeVisitor { public: - NodeBuilder() : DeserializeAttributeVisitor(static_cast(*this)), m_serializer(*this) {} + NodeBuilder() : DeserializeAttributeVisitor(static_cast(*this)), m_serializer(*this), m_inputs{} {} - NodeBuilder(const std::shared_ptr& node) + NodeBuilder(const std::shared_ptr& node, ov::OutputVector inputs = {}) : DeserializeAttributeVisitor(static_cast(*this)), - m_serializer(*this) { + m_serializer(*this), + m_inputs(inputs) { save_node(node); } @@ -386,12 +387,18 @@ class NodeBuilder : public ValueMap, public DeserializeAttributeVisitor { node->visit_attributes(m_serializer); } - // Does not validate, since inputs aren't set std::shared_ptr create() { std::shared_ptr node(get_ops().create(m_node_type_info)); node->visit_attributes(*this); - return node; + + if (m_inputs.size()) { + node->set_arguments(m_inputs); + return node->clone_with_new_inputs(m_inputs); + } + else + return node; } + AttributeVisitor& get_node_saver() { return m_serializer; } @@ -412,6 +419,7 @@ class NodeBuilder : public ValueMap, public DeserializeAttributeVisitor { protected: Node::type_info_t m_node_type_info; SerializeAttributeVisitor m_serializer; + ov::OutputVector m_inputs; }; } // namespace test } // namespace ngraph