diff --git a/src/core/tests/CMakeLists.txt b/src/core/tests/CMakeLists.txt index 93d5fb8400f92f..48223a21d6187f 100644 --- a/src/core/tests/CMakeLists.txt +++ b/src/core/tests/CMakeLists.txt @@ -425,6 +425,7 @@ set(SRC visitors/op/tan.cpp visitors/op/tanh.cpp visitors/op/tensor_iterator.cpp + visitors/op/tile.cpp visitors/op/topk.cpp visitors/op/transpose.cpp visitors/op/unsqueeze.cpp diff --git a/src/core/tests/visitors/op/proposal.cpp b/src/core/tests/visitors/op/proposal.cpp index 12e9eafaa10b29..b8df5a9083e6a1 100644 --- a/src/core/tests/visitors/op/proposal.cpp +++ b/src/core/tests/visitors/op/proposal.cpp @@ -60,3 +60,42 @@ TEST(attributes, proposal_op) { EXPECT_EQ(g_proposal_attrs.box_coordinate_scale, proposal_attrs.box_coordinate_scale); EXPECT_EQ(g_proposal_attrs.framework, proposal_attrs.framework); } + +TEST(attributes, proposal_op2) { + NodeBuilder::get_ops().register_factory(); + const auto class_probs = make_shared(element::f32, Shape{1, 12, 34, 62}); + const auto class_logits = make_shared(element::f32, Shape{1, 24, 34, 62}); + const auto image_shape = make_shared(element::f32, Shape{3}); + + op::ProposalAttrs attrs; + attrs.base_size = 16; + attrs.pre_nms_topn = 6000; + attrs.post_nms_topn = 200; + attrs.nms_thresh = 0.6f; + attrs.feat_stride = 16; + attrs.min_size = 16; + attrs.ratio = vector{2.669f}; + 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); + auto g_proposal = ov::as_type_ptr(builder.create()); + + const auto proposal_attrs = proposal->get_attrs(); + const auto g_proposal_attrs = g_proposal->get_attrs(); + + EXPECT_EQ(g_proposal_attrs.base_size, proposal_attrs.base_size); + EXPECT_EQ(g_proposal_attrs.pre_nms_topn, proposal_attrs.pre_nms_topn); + EXPECT_EQ(g_proposal_attrs.post_nms_topn, proposal_attrs.post_nms_topn); + EXPECT_EQ(g_proposal_attrs.nms_thresh, proposal_attrs.nms_thresh); + EXPECT_EQ(g_proposal_attrs.feat_stride, proposal_attrs.feat_stride); + EXPECT_EQ(g_proposal_attrs.min_size, proposal_attrs.min_size); + EXPECT_EQ(g_proposal_attrs.ratio, proposal_attrs.ratio); + EXPECT_EQ(g_proposal_attrs.scale, proposal_attrs.scale); + EXPECT_EQ(g_proposal_attrs.clip_before_nms, proposal_attrs.clip_before_nms); + EXPECT_EQ(g_proposal_attrs.clip_after_nms, proposal_attrs.clip_after_nms); + EXPECT_EQ(g_proposal_attrs.normalize, proposal_attrs.normalize); + EXPECT_EQ(g_proposal_attrs.box_size_scale, proposal_attrs.box_size_scale); + EXPECT_EQ(g_proposal_attrs.box_coordinate_scale, proposal_attrs.box_coordinate_scale); + EXPECT_EQ(g_proposal_attrs.framework, proposal_attrs.framework); +} diff --git a/src/core/tests/visitors/op/tile.cpp b/src/core/tests/visitors/op/tile.cpp new file mode 100644 index 00000000000000..9744f288ac6fe6 --- /dev/null +++ b/src/core/tests/visitors/op/tile.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2018-2022 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "gtest/gtest.h" +#include "ngraph/ngraph.hpp" +#include "ngraph/op/util/attr_types.hpp" +#include "ngraph/opsets/opset1.hpp" +#include "util/visitor.hpp" + +using namespace std; +using namespace ngraph; +using ngraph::test::NodeBuilder; + +TEST(attributes, tile_op) { + NodeBuilder::get_ops().register_factory(); + const auto data = make_shared(element::f32, Shape{1, 2, 3, 4}); + const auto repeats = make_shared(element::i64, Shape{4}); + + const auto tile = make_shared(data, repeats); + NodeBuilder builder(tile); + + const auto expected_attr_count = 0; + EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); +} diff --git a/src/frontends/ir/tests/frontend_test_basic.cpp b/src/frontends/ir/tests/frontend_test_basic.cpp index ea7679187c8fc4..453b5e0f61f049 100644 --- a/src/frontends/ir/tests/frontend_test_basic.cpp +++ b/src/frontends/ir/tests/frontend_test_basic.cpp @@ -5,6 +5,7 @@ #include "frontend_test.hpp" #include "openvino/opsets/opset1.hpp" #include "openvino/opsets/opset3.hpp" +#include "openvino/opsets/opset6.hpp" class IRFrontendTests : public ::testing::Test, public IRFrontendTestsImpl { protected: @@ -957,3 +958,107 @@ TEST_F(IRFrontendTests, wrong_opset) { ASSERT_THROW(model = core.read_model(testModel, ov::Tensor()), ov::Exception); ASSERT_FALSE(!!model); } + +TEST_F(IRFrontendTests, read_extension_proposal_network) { + // the Proposal with 2 inputs was initially marked as "extension" operation but later was added to opset + // the test checks that IR reader properly instantiate the "extension" Proposal as "opset6" Proposal + std::string xmlModel = R"V0G0N( + + + + + + + 1 + 12 + 34 + 62 + + + + + + + + 1 + 24 + 34 + 62 + + + + + + + + 3 + + + + + + + + 1 + 12 + 34 + 62 + + + 1 + 24 + 34 + 62 + + + 3 + + + + + 1000 + 5 + + + 1000 + + + + + + + 200 + 5 + + + + + + + + + + + + )V0G0N"; + + std::vector buffer(12, 0); + float* floatBuffer = reinterpret_cast(buffer.data()); + floatBuffer[0] = 0; + floatBuffer[1] = 0; + floatBuffer[2] = 0; + + createTemporalModelFile(xmlModel, buffer); + std::shared_ptr model; + + ASSERT_NO_THROW(model = core.read_model(xmlFileName, binFileName)); + ASSERT_TRUE(!!model); + + for (auto op : model->get_ordered_ops()) { + if (op->get_friendly_name() == "proposal" && + op->get_type_info() == ov::opset6::Proposal::get_type_info_static()) { + return; + } + } + FAIL() << "Custom proposal layer is not an opset6 operation."; +} \ No newline at end of file diff --git a/src/frontends/ir/tests/tensor_iterator_deserialization.cpp b/src/frontends/ir/tests/tensor_iterator_deserialization.cpp index db26b73850e04b..735b86ffb30339 100644 --- a/src/frontends/ir/tests/tensor_iterator_deserialization.cpp +++ b/src/frontends/ir/tests/tensor_iterator_deserialization.cpp @@ -250,3 +250,1198 @@ TEST_F(IRFrontendTestsTensorIterator, tensor_iterator_slised_input) { const auto res = fc.compare(model, modelRef); EXPECT_TRUE(res.valid) << res.message; } + +TEST_F(IRFrontendTestsTensorIterator, loop1) { + std::string xmlModel = R"V0G0N( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + 1 + + + + + 1 + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + + + + + + + + + + + + + + +)V0G0N"; + + std::vector buffer(8, 0); + int64_t* int64Buffer = reinterpret_cast(buffer.data()); + int64Buffer[0] = 0; + + createTemporalModelFile(xmlModel, buffer); + std::shared_ptr model; + + ASSERT_NO_THROW(model = core.read_model(xmlFileName, binFileName)); + ASSERT_TRUE(!!model); +} + +TEST_F(IRFrontendTestsTensorIterator, loop2) { + std::string xmlModel = R"V0G0N( + + + + + + + 1 + + + + + + + + + + + + + + 1 + 2 + + + + + + + 1 + + + + 1 + 2 + + + + + 1 + 2 + + + 3 + 1 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + + + + + + + + 1 + 2 + + + + + + + 1 + 2 + + + 1 + 2 + + + + + 1 + 2 + + + + + + + 1 + 2 + + + + + + + + 1 + + + + + + + 1 + 2 + + + 1 + + + + + 3 + 1 + 2 + + + + + + + 3 + 1 + 2 + + + + + + + + + + + + + + + + + + + 1 + 2 + + + + + + + 3 + 1 + 2 + + + + + + + + + + + + +)V0G0N"; + + std::vector buffer(8, 0); + float* floatBuffer = reinterpret_cast(buffer.data()); + floatBuffer[0] = 0; + floatBuffer[1] = 0; + + createTemporalModelFile(xmlModel, buffer); + std::shared_ptr model; + + ASSERT_NO_THROW(model = core.read_model(xmlFileName, binFileName)); + ASSERT_TRUE(!!model); +} + +TEST_F(IRFrontendTestsTensorIterator, loop_external_port1_is_not_connected) { + std::string xmlModel = R"V0G0N( + + + + + + + 1 + + + + + + + + + + + + + + 1 + 2 + + + + + + + 1 + + + + 1 + 2 + + + + + 1 + 2 + + + 3 + 1 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + + + + + + + + 1 + 2 + + + + + + + 1 + 2 + + + 1 + 2 + + + + + 1 + 2 + + + + + + + 1 + 2 + + + + + + + + 1 + + + + + + + 1 + 2 + + + 1 + + + + + 3 + 1 + 2 + + + + + + + 3 + 1 + 2 + + + + + + + + + + + + + + + + + + + 1 + 2 + + + + + + + 3 + 1 + 2 + + + + + + + + + + + + +)V0G0N"; + + std::vector buffer(8, 0); + float* floatBuffer = reinterpret_cast(buffer.data()); + floatBuffer[0] = 0; + floatBuffer[1] = 0; + + createTemporalModelFile(xmlModel, buffer); + std::shared_ptr model; + + ASSERT_NO_THROW(model = core.read_model(xmlFileName, binFileName)); + ASSERT_TRUE(!!model); +} + + +TEST_F(IRFrontendTestsTensorIterator, tensor_iterator_resnet_opset4) { + std::string xmlModel = R"V0G0N( + + + + + + + 16 + 1 + 512 + + + + + + + + 1 + 512 + + + + + + + + 1 + 512 + + + + + + + 16 + 1 + 512 + + + 1 + 512 + + + 1 + 512 + + + + + 16 + 1 + 512 + + + 1 + 512 + + + 1 + 512 + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 512 + + + + + + + + 2 + + + + + + + + 1 + 1 + 512 + + + 2 + + + + + 1 + 512 + + + + + + + + 1 + 512 + + + + + + + + 1 + 512 + + + + + + + + 2048 + 512 + + + + + + + + 2048 + 512 + + + + + + + + 2048 + + + + + + + + 1 + 512 + + + 1 + 512 + + + 1 + 512 + + + 2048 + 512 + + + 2048 + 512 + + + 2048 + + + + + 1 + 512 + + + 1 + 512 + + + + + + + 1 + 512 + + + + + + + 1 + 512 + + + + + + + + 3 + + + + + + + + 1 + 512 + + + 3 + + + + + 1 + 1 + 512 + + + + + + + 1 + 1 + 512 + + + + + + + + + + + + + + + + + + + + + + + + + 16 + 1 + 512 + + + + + + + 1 + 512 + + + + + + + 1 + 512 + + + + + + + + + + + + + + )V0G0N"; + + std::vector buffer(8396840, 0); + int64_t* int64Buffer = reinterpret_cast(buffer.data()); + int64Buffer[0] = 1; + int64Buffer[1] = 512; + + int64Buffer[1049602] = 1; + int64Buffer[1049603] = 1; + int64Buffer[1049604] = 512; + + createTemporalModelFile(xmlModel, buffer); + std::shared_ptr model; + + ASSERT_NO_THROW(model = core.read_model(xmlFileName, binFileName)); + ASSERT_TRUE(!!model); +} + +TEST_F(IRFrontendTestsTensorIterator, tensor_iterator_negative_stride_opset4) { + std::string xmlModel = R"V0G0N( + + + + + + + 1 + 25 + 512 + + + + + + + + 1 + 256 + + + + + + + + 1 + 256 + + + + + + + 1 + 25 + 512 + + + 1 + 256 + + + 1 + 256 + + + + + 1 + 25 + 256 + + + + + + + + + + + + + + + + + + + 1 + 1 + 512 + + + + + + + + 2 + + + + + + + + 1 + 1 + 512 + + + 2 + + + + + 1 + 512 + + + + + + + + 1 + 256 + + + + + + + + 1 + 256 + + + + + + + + 1024 + 512 + + + + + + + + 1024 + 256 + + + + + + + + 1024 + + + + + + + + 1 + 512 + + + 1 + 256 + + + 1 + 256 + + + 1024 + 512 + + + 1024 + 256 + + + 1024 + + + + + 1 + 256 + + + 1 + 256 + + + + + + + 1 + 256 + + + + + + + 1 + 256 + + + + + + + + 3 + + + + + + + + 1 + 256 + + + 3 + + + + + 1 + 1 + 256 + + + + + + + 1 + 1 + 256 + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 25 + 256 + + + + + + + + + + + + )V0G0N"; + + std::vector buffer(3149864, 0); + int64_t* int64Buffer = reinterpret_cast(buffer.data()); + int64Buffer[0] = 1; + int64Buffer[1] = 512; + + int64Buffer[393730] = 1; + int64Buffer[393731] = 1; + int64Buffer[393732] = 256; + + createTemporalModelFile(xmlModel, buffer); + std::shared_ptr model; + + ASSERT_NO_THROW(model = core.read_model(xmlFileName, binFileName)); + ASSERT_TRUE(!!model); +} diff --git a/src/tests/functional/inference_engine/ngraph_reader/loop.cpp b/src/tests/functional/inference_engine/ngraph_reader/loop.cpp deleted file mode 100644 index de0ad0044890b2..00000000000000 --- a/src/tests/functional/inference_engine/ngraph_reader/loop.cpp +++ /dev/null @@ -1,587 +0,0 @@ -// Copyright (C) 2018-2022 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include -#include "ngraph_reader_tests.hpp" -#include "common_test_utils/data_utils.hpp" - -TEST_F(NGraphReaderTests, ReadLoopNetwork) { - std::string model = R"V0G0N( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - 1 - - - - - 1 - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 1 - 1 - - - - - - - - - - - - - - -)V0G0N"; - - Core reader; - Blob::Ptr weights; - weights = make_shared_blob(TensorDesc(Precision::U8, {8}, Layout::C)); - weights->allocate(); - weights->buffer().as()[0] = 0; - EXPECT_NO_THROW(reader.ReadNetwork(model, weights)); -} - -TEST_F(NGraphReaderTests, ReadLoopNetwork_2) { - std::string model = R"V0G0N( - - - - - - - - 1 - - - - - - - - - - - - - - 1 - 2 - - - - - - - 1 - - - - 1 - 2 - - - - - 1 - 2 - - - 3 - 1 - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 2 - - - - - - - - 1 - 2 - - - - - - - 1 - 2 - - - 1 - 2 - - - - - 1 - 2 - - - - - - - 1 - 2 - - - - - - - - 1 - - - - - - - 1 - 2 - - - 1 - - - - - 3 - 1 - 2 - - - - - - - 3 - 1 - 2 - - - - - - - - - - - - - - - - - - - 1 - 2 - - - - - - - 3 - 1 - 2 - - - - - - - - - - - - - -)V0G0N"; - - Core reader; - Blob::Ptr weights; - weights = make_shared_blob(TensorDesc(Precision::U8, {8}, Layout::C)); - weights->allocate(); - weights->buffer().as()[0] = 0; - weights->buffer().as()[1] = 0; - EXPECT_NO_THROW(reader.ReadNetwork(model, weights)); -} - -TEST_F(NGraphReaderTests, ReadLoopNetwork_ExternalPort1IsNotConnected) { - std::string model = R"V0G0N( - - - - - - - - 1 - - - - - - - - - - - - - - 1 - 2 - - - - - - - 1 - - - - 1 - 2 - - - - - 1 - 2 - - - 3 - 1 - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 2 - - - - - - - - 1 - 2 - - - - - - - 1 - 2 - - - 1 - 2 - - - - - 1 - 2 - - - - - - - 1 - 2 - - - - - - - - 1 - - - - - - - 1 - 2 - - - 1 - - - - - 3 - 1 - 2 - - - - - - - 3 - 1 - 2 - - - - - - - - - - - - - - - - - - - 1 - 2 - - - - - - - 3 - 1 - 2 - - - - - - - - - - - - - -)V0G0N"; - - Core reader; - Blob::Ptr weights; - weights = make_shared_blob(TensorDesc(Precision::U8, {8}, Layout::C)); - weights->allocate(); - weights->buffer().as()[0] = 0; - weights->buffer().as()[1] = 0; - EXPECT_NO_THROW(reader.ReadNetwork(model, weights)); -} - diff --git a/src/tests/functional/inference_engine/ngraph_reader/proposal_tests.cpp b/src/tests/functional/inference_engine/ngraph_reader/proposal_tests.cpp deleted file mode 100644 index f7f0fa0206eb30..00000000000000 --- a/src/tests/functional/inference_engine/ngraph_reader/proposal_tests.cpp +++ /dev/null @@ -1,408 +0,0 @@ -// Copyright (C) 2018-2022 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include -#include "ngraph/opsets/opset6.hpp" -#include "ngraph_reader_tests.hpp" -TEST_F(NGraphReaderTests, ReadProposalNetwork) { - std::string model_v10 = R"V0G0N( - - - - - - - 1 - 12 - 34 - 62 - - - - - - - - 1 - 24 - 34 - 62 - - - - - - - - 3 - - - - - - - - 1 - 12 - 34 - 62 - - - 1 - 24 - 34 - 62 - - - 3 - - - - - 200 - 5 - - - - - - - 200 - 5 - - - - - - - - - - - - )V0G0N"; - std::string model_v6 = R"V0G0N( - - - - - - 1 - 3 - - - - - - - - - - 1 - 24 - 34 - 62 - - - - - - - 1 - 12 - 34 - 62 - - - - - - - - 1 - 12 - 34 - 62 - - - 1 - 24 - 34 - 62 - - - 1 - 3 - - - - - 200 - 5 - - - - - - - - - - - -)V0G0N"; - - compareIRs(model_v10, model_v6, 24); -} - -TEST_F(NGraphReaderTests, ReadProposalNetwork_2) { - std::string model_v10 = R"V0G0N( - - - - - - - 1 - 12 - 34 - 62 - - - - - - - - 1 - 24 - 34 - 62 - - - - - - - - 4 - - - - - - - - 1 - 12 - 34 - 62 - - - 1 - 24 - 34 - 62 - - - 4 - - - - - 200 - 5 - - - - - - - 200 - 5 - - - - - - - - - - - - )V0G0N"; - std::string model_v6 = R"V0G0N( - - - - - - 1 - 4 - - - - - - - - - - 1 - 24 - 34 - 62 - - - - - - - 1 - 12 - 34 - 62 - - - - - - - - 1 - 12 - 34 - 62 - - - 1 - 24 - 34 - 62 - - - 1 - 4 - - - - - 200 - 5 - - - - - - - - - - - -)V0G0N"; - - compareIRs(model_v10, model_v6, 32); -} - -TEST_F(NGraphReaderTests, ReadExtensionProposalNetwork) { - // the Proposal with 2 inputs was initially marked as "extension" operation but later was added to opset - // the test checks that IR reader properly instantiate the "extension" Proposal as "opset6" Proposal - std::string model_v10 = R"V0G0N( - - - - - - - 1 - 12 - 34 - 62 - - - - - - - - 1 - 24 - 34 - 62 - - - - - - - - 3 - - - - - - - - 1 - 12 - 34 - 62 - - - 1 - 24 - 34 - 62 - - - 3 - - - - - 1000 - 5 - - - 1000 - - - - - - - 200 - 5 - - - - - - - - - - - - )V0G0N"; - - Core ie; - Blob::Ptr weights; - - weights = make_shared_blob(TensorDesc(Precision::U8, {12}, Layout::C)); - weights->allocate(); - CommonTestUtils::fill_data(weights->buffer().as(), weights->size() / sizeof(float)); - - auto func = ie.ReadNetwork(model_v10, weights).getFunction(); - for (auto op : func->get_ordered_ops()) { - if (op->get_friendly_name() == "proposal" && - op->get_type_info() == ngraph::opset6::Proposal::get_type_info_static()) { - return; - } - } - FAIL() << "Custom proposal layer is not an opset6 operation."; -} diff --git a/src/tests/functional/inference_engine/ngraph_reader/strided_slice_tests.cpp b/src/tests/functional/inference_engine/ngraph_reader/strided_slice_tests.cpp deleted file mode 100644 index 68efeab1a5a24d..00000000000000 --- a/src/tests/functional/inference_engine/ngraph_reader/strided_slice_tests.cpp +++ /dev/null @@ -1,667 +0,0 @@ -// Copyright (C) 2018-2022 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include -#include "ngraph_reader_tests.hpp" -// Crop supports only 2d, 4d and 5d blobs -// This test should pass after deleting -// "input_shape.size() != 2 && input_shape.size() != 4 && input_shape.size() != 5" condition in -// strided_slice_to_crop transformation -TEST_F(NGraphReaderTests, ConvertStridedSliceToCrop) { - std::string model_version10 = R"V0G0N( - - - - - - - 300 - 90 - 1 - 4 - - - - - - - - 4 - - - - - - - - 4 - - - - - - - - 4 - - - - - - - - 300 - 90 - 1 - 4 - - - 4 - - - 4 - - - 4 - - - - - 300 - 1 - 1 - 4 - - - - - - - 300 - 1 - 1 - 4 - - - - - - - - - - - - - )V0G0N"; - std::string model_version6 = R"V0G0N( - - - - - - 300 - 90 - 1 - 4 - - - - - - - - 300 - 90 - 1 - 4 - - - - - 300 - 1 - 1 - 4 - - - - - - - - - -)V0G0N"; - - compareIRs(model_version10, model_version6, 96, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - - // According to begin (0,1,0,0) and end masks (0,1,0,0) - // and input and result shapes (300, 90, 1, 4) -> (300, 1, 1, 4) - // begin - data[0] = 0; - data[1] = 1; - data[2] = 0; - data[3] = 0; - - // end - data[4] = 0; - data[5] = 2; - data[6] = 0; - data[7] = 0; - // Set "1" into each stride to apply "StrideSliceToCrop" transformation - for (int stride_node_idx = 8; stride_node_idx < 12; ++stride_node_idx) { - data[stride_node_idx] = 1; - } - }); -} - -// Crop supports only 2d, 4d and 5d blobs -// This test should pass after deleting -// "input_shape.size() != 2 && input_shape.size() != 4 && input_shape.size() != 5" condition in -// strided_slice_to_crop transformation -TEST_F(NGraphReaderTests, DISABLED_ConvertStridedSliceToCropMultipleMasks) { - // c = np.zeros((9, 9, 9, 9, 9, 9, 9)) - // const_use_axis_mask = tf.constant(c) - // strided_slice_with_mask = tf.strided_slice(const_use_axis_mask, - // name="OurStridedSlice", - // begin=[0, 0, 0, 0, 0, 0], end=[ 2, 2, 2, 2, 2, 2], - // new_axis_mask = 9, - // ellipsis_mask= 2, - // shrink_axis_mask=4) - // # (1, 9, 9, 9, 9, 2, 1, 2, 2) without shrink - // # (1, 9, 9, 9, 9, 1, 2, 2) with shrink - std::string model_version10 = R"V0G0N( - - - - - - - 9 - 9 - 9 - 9 - 9 - 9 - 9 - - - - - - - - 6 - - - - - - - - 6 - - - - - - - - 6 - - - - - - - - 9 - 9 - 9 - 9 - 9 - 9 - 9 - - - 6 - - - 6 - - - 6 - - - - - 1 - 9 - 9 - 9 - 9 - 1 - 2 - 2 - - - - - - - 1 - 9 - 9 - 9 - 9 - 1 - 2 - 2 - - - - - - - - - - - - -)V0G0N"; - std::string model_version6 = R"V0G0N( - - - - - - 9 - 9 - 9 - 9 - 9 - 9 - 9 - - - - - - - 8 - - - - - - - - - - 9 - - - - - - - - - - - 9 - 9 - 9 - 9 - 9 - 9 - 9 - - - 9 - - - - - 1 - 9 - 9 - 9 - 9 - 1 - 1 - 9 - 9 - - - - - - - - 1 - 9 - 9 - 9 - 9 - 1 - 1 - 9 - 9 - - - - - 1 - 9 - 9 - 9 - 9 - 1 - 1 - 2 - 2 - - - - - - - - 1 - 9 - 9 - 9 - 9 - 1 - 1 - 2 - 2 - - - 8 - - - - - 1 - 9 - 9 - 9 - 9 - 1 - 2 - 2 - - - - - - - - - - - - - -)V0G0N"; - - - compareIRs(model_version10, model_version6, 144, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - - for (int begin_node = 0; begin_node < 6; ++begin_node) - data[begin_node] = 0; - for (int end_node = 6; end_node < 12; ++end_node) - data[end_node] = 2; - - // Set "1" into each stride to apply "StrideSliceToCrop" transformation - for (int stride_node_idx = 12; stride_node_idx < 18; ++stride_node_idx) { - data[stride_node_idx] = 1; - } - }); -} - -// TODO delete this check in ngraph "Check 'static_cast(data_rank) == mask_size' -TEST_F(NGraphReaderTests, DISABLED_ConvertStridedSliceToCropMultipleMasks_2) { - std::string model_version10 = R"V0G0N( - - - - - - - 9 - 9 - 9 - 9 - 9 - 9 - 9 - - - - - - - - 8 - - - - - - - - 8 - - - - - - - - 8 - - - - - - - - 9 - 9 - 9 - 9 - 9 - 9 - 9 - - - 8 - - - 8 - - - 8 - - - - - 1 - 1 - 1 - 9 - 9 - 9 - 9 - 2 - 1 - 2 - 1 - - - - - - - 1 - 1 - 1 - 9 - 9 - 9 - 9 - 2 - 1 - 2 - 1 - - - - - - - - - - - - -)V0G0N"; - std::string model_version6 = R"V0G0N( - - - - - - 9 - 9 - 9 - 9 - 9 - 9 - 9 - - - - - - - 11 - - - - - - - - - - - 9 - 9 - 9 - 9 - 9 - 9 - 9 - - - 11 - - - - - 1 - 9 - 1 - 9 - 9 - 9 - 9 - 9 - 1 - 9 - 1 - - - - - - - - 1 - 9 - 1 - 9 - 9 - 9 - 9 - 9 - 1 - 9 - 1 - - - - - 1 - 1 - 1 - 9 - 9 - 9 - 9 - 2 - 1 - 2 - 1 - - - - - - - - - - - -)V0G0N"; - - compareIRs(model_version10, model_version6, 192, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - - // begin node - data[0] = 0; - data[1] = 2; - data[2] = 0; - data[3] = 0; - data[4] = 2; - data[5] = 0; - data[6] = 2; - data[7] = 0; - - // end node - data[8] = 0; - data[9] = 3; - data[10] = 0; - data[11] = 0; - data[12] = 4; - data[13] = 0; - data[14] = 4; - data[15] = 0; - - // Set "1" into each stride to apply "StrideSliceToCrop" transformation - for (int stride_node_idx = 16; stride_node_idx < 24; ++stride_node_idx){ - data[stride_node_idx] = 1; - } - }); -} diff --git a/src/tests/functional/inference_engine/ngraph_reader/ti.cpp b/src/tests/functional/inference_engine/ngraph_reader/ti.cpp deleted file mode 100644 index 22f19dbcc93125..00000000000000 --- a/src/tests/functional/inference_engine/ngraph_reader/ti.cpp +++ /dev/null @@ -1,2799 +0,0 @@ -// Copyright (C) 2018-2022 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include -#include "ngraph_reader_tests.hpp" -TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset1) { - std::string model_v10 = R"V0G0N( - - - - - - - 1 - 25 - 512 - - - - - - - - 1 - 256 - - - - - - - - 1 - 256 - - - - - - - 1 - 25 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 25 - 256 - - - - - - - - - - - - - - - - - - - 1 - 1 - 512 - - - - - - - - 2 - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 256 - - - - - - - - 1 - 256 - - - - - - - - 1024 - 512 - - - - - - - - 1024 - 256 - - - - - - - - 1024 - - - - - - - - 1 - 512 - - - 1 - 256 - - - 1 - 256 - - - 1024 - 512 - - - 1024 - 256 - - - 1024 - - - - - 1 - 256 - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - - 3 - - - - - - - - 1 - 256 - - - 3 - - - - - 1 - 1 - 256 - - - - - - - 1 - 1 - 256 - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 25 - 256 - - - - - - - - - - - - )V0G0N"; - std::string model_v6 = R"VOGON( - - - - - - 1 - 25 - 512 - - - - - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - 1 - 25 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 25 - 256 - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 256 - - - 1 - 256 - - - - - - - - - - - 3 - - - - - - - - - - 1 - 256 - - - 3 - - - - - 1 - 1 - 256 - - - - - - - - - - - - - - - - - - - - )VOGON"; - - compareIRs(model_v10, model_v6, 3149864, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - data[0] = 1; - data[1] = 512; - - data[393730] = 1; - data[393731] = 1; - data[393732] = 256; - }); -} - -TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset1) { - std::string model_v10 = R"V0G0N( - - - - - - - 16 - 1 - 512 - - - - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - - - - - 16 - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - 16 - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 512 - - - - - - - - 2 - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - - - - - - 2048 - 512 - - - - - - - - 2048 - 512 - - - - - - - - 2048 - - - - - - - - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - 2048 - 512 - - - 2048 - 512 - - - 2048 - - - - - 1 - 512 - - - 1 - 512 - - - - - - - 1 - 512 - - - - - - - 1 - 512 - - - - - - - - 3 - - - - - - - - 1 - 512 - - - 3 - - - - - 1 - 1 - 512 - - - - - - - 1 - 1 - 512 - - - - - - - - - - - - - - - - - - - - - - - - - 16 - 1 - 512 - - - - - - - 1 - 512 - - - - - - - 1 - 512 - - - - - - - - - - - - - - )V0G0N"; - std::string model_v6 = R"V0G0N( - - - - - - 16 - 1 - 512 - - - - - - - 1 - 512 - - - - - - - 1 - 512 - - - - - - - 16 - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - 16 - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - 1 - 512 - - - 1 - 512 - - - - - - - - - - - 3 - - - - - - - - - - 1 - 512 - - - 3 - - - - - 1 - 1 - 512 - - - - - - - - - - - - - - - - - - - - )V0G0N"; - - compareIRs(model_v10, model_v6, 8396840, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - data[0] = 1; - data[1] = 512; - - data[1049602] = 1; - data[1049603] = 1; - data[1049604] = 512; - }); -} - -TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset1) { - std::string model_v10 = R"V0G0N( - - - - - - - 1 - 25 - 512 - - - - - - - - 1 - 256 - - - - - - - - 1 - 256 - - - - - - - 1 - 25 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 25 - 256 - - - - - - - - - - - - - - - - - - - 1 - 1 - 512 - - - - - - - - 2 - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 256 - - - - - - - - 1 - 256 - - - - - - - - 1024 - 512 - - - - - - - - 1024 - 256 - - - - - - - - 1024 - - - - - - - - 1 - 512 - - - 1 - 256 - - - 1 - 256 - - - 1024 - 512 - - - 1024 - 256 - - - 1024 - - - - - 1 - 256 - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - - 3 - - - - - - - - 1 - 256 - - - 3 - - - - - 1 - 1 - 256 - - - - - - - 1 - 1 - 256 - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 25 - 256 - - - - - - - - - - - - )V0G0N"; - std::string model_v6 = R"VOGON( - - - - - - 1 - 25 - 512 - - - - - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - 1 - 25 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 25 - 256 - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 256 - - - 1 - 256 - - - - - - - - - - - 3 - - - - - - - - - - 1 - 256 - - - 3 - - - - - 1 - 1 - 256 - - - - - - - - - - - - - - - - - - - - )VOGON"; - - compareIRs(model_v10, model_v6, 3149864, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - data[0] = 1; - data[1] = 512; - - data[393730] = 1; - data[393731] = 1; - data[393732] = 256; - }); -} - -TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_opset4) { - std::string model_v10 = R"V0G0N( - - - - - - - 1 - 25 - 512 - - - - - - - - 1 - 256 - - - - - - - - 1 - 256 - - - - - - - 1 - 25 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 25 - 256 - - - - - - - - - - - - - - - - - - - 1 - 1 - 512 - - - - - - - - 2 - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 256 - - - - - - - - 1 - 256 - - - - - - - - 1024 - 512 - - - - - - - - 1024 - 256 - - - - - - - - 1024 - - - - - - - - 1 - 512 - - - 1 - 256 - - - 1 - 256 - - - 1024 - 512 - - - 1024 - 256 - - - 1024 - - - - - 1 - 256 - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - - 3 - - - - - - - - 1 - 256 - - - 3 - - - - - 1 - 1 - 256 - - - - - - - 1 - 1 - 256 - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 25 - 256 - - - - - - - - - - - - )V0G0N"; - std::string model_v6 = R"VOGON( - - - - - - 1 - 25 - 512 - - - - - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - 1 - 25 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 25 - 256 - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 256 - - - 1 - 256 - - - - - - - - - - - 3 - - - - - - - - - - 1 - 256 - - - 3 - - - - - 1 - 1 - 256 - - - - - - - - - - - - - - - - - - - - )VOGON"; - - compareIRs(model_v10, model_v6, 3149864, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - data[0] = 1; - data[1] = 512; - - data[393730] = 1; - data[393731] = 1; - data[393732] = 256; - }); -} - -TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_resnet_opset4) { - std::string model_v10 = R"V0G0N( - - - - - - - 16 - 1 - 512 - - - - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - - - - - 16 - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - 16 - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 512 - - - - - - - - 2 - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - - - - - - 2048 - 512 - - - - - - - - 2048 - 512 - - - - - - - - 2048 - - - - - - - - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - 2048 - 512 - - - 2048 - 512 - - - 2048 - - - - - 1 - 512 - - - 1 - 512 - - - - - - - 1 - 512 - - - - - - - 1 - 512 - - - - - - - - 3 - - - - - - - - 1 - 512 - - - 3 - - - - - 1 - 1 - 512 - - - - - - - 1 - 1 - 512 - - - - - - - - - - - - - - - - - - - - - - - - - 16 - 1 - 512 - - - - - - - 1 - 512 - - - - - - - 1 - 512 - - - - - - - - - - - - - - )V0G0N"; - std::string model_v6 = R"V0G0N( - - - - - - 16 - 1 - 512 - - - - - - - 1 - 512 - - - - - - - 1 - 512 - - - - - - - 16 - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - 16 - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - 1 - 512 - - - 1 - 512 - - - - - 1 - 512 - - - 1 - 512 - - - - - - - - - - - 3 - - - - - - - - - - 1 - 512 - - - 3 - - - - - 1 - 1 - 512 - - - - - - - - - - - - - - - - - - - - )V0G0N"; - - compareIRs(model_v10, model_v6, 8396840, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - data[0] = 1; - data[1] = 512; - - data[1049602] = 1; - data[1049603] = 1; - data[1049604] = 512; - }); -} - -TEST_F(NGraphReaderTests, ReadTensorIteratorNetwork_negative_stride_opset4) { - std::string model_v10 = R"V0G0N( - - - - - - - 1 - 25 - 512 - - - - - - - - 1 - 256 - - - - - - - - 1 - 256 - - - - - - - 1 - 25 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 25 - 256 - - - - - - - - - - - - - - - - - - - 1 - 1 - 512 - - - - - - - - 2 - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 256 - - - - - - - - 1 - 256 - - - - - - - - 1024 - 512 - - - - - - - - 1024 - 256 - - - - - - - - 1024 - - - - - - - - 1 - 512 - - - 1 - 256 - - - 1 - 256 - - - 1024 - 512 - - - 1024 - 256 - - - 1024 - - - - - 1 - 256 - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - - 3 - - - - - - - - 1 - 256 - - - 3 - - - - - 1 - 1 - 256 - - - - - - - 1 - 1 - 256 - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 25 - 256 - - - - - - - - - - - - )V0G0N"; - std::string model_v6 = R"VOGON( - - - - - - 1 - 25 - 512 - - - - - - - 1 - 256 - - - - - - - 1 - 256 - - - - - - - 1 - 25 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 25 - 256 - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - 1 - 1 - 512 - - - 2 - - - - - 1 - 512 - - - - - - - - 1 - 512 - - - 1 - 256 - - - 1 - 256 - - - - - 1 - 256 - - - 1 - 256 - - - - - - - - - - - 3 - - - - - - - - - - 1 - 256 - - - 3 - - - - - 1 - 1 - 256 - - - - - - - - - - - - - - - - - - - - )VOGON"; - - compareIRs(model_v10, model_v6, 3149864, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - data[0] = 1; - data[1] = 512; - - data[393730] = 1; - data[393731] = 1; - data[393732] = 256; - }); -} diff --git a/src/tests/functional/inference_engine/ngraph_reader/tile_tests.cpp b/src/tests/functional/inference_engine/ngraph_reader/tile_tests.cpp deleted file mode 100644 index 14301f0aaeff03..00000000000000 --- a/src/tests/functional/inference_engine/ngraph_reader/tile_tests.cpp +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (C) 2018-2022 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include -#include "ngraph_reader_tests.hpp" -TEST_F(NGraphReaderTests, ReadTileNetwork) { - std::string model = R"V0G0N( - - - - - - - 1 - 2 - 3 - 4 - - - - - - - - 4 - - - - - - - 1 - 2 - 3 - 4 - - - 4 - - - - - 1 - 4 - 3 - 4 - - - - - - - 1 - 4 - 3 - 4 - - - - - - - - - - -)V0G0N"; - std::string modelV5 = R"V0G0N( - - - - - - 1 - 2 - 3 - 4 - - - - - - - - 1 - 2 - 3 - 4 - - - - - 1 - 4 - 3 - 4 - - - - - - - - -)V0G0N"; - - compareIRs(model, modelV5, 32, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - data[0] = 1; - data[1] = 2; - data[2] = 1; - data[3] = 1; - }); -} - -TEST_F(NGraphReaderTests, ReadTileNetwork2) { - std::string model = R"V0G0N( - - - - - - - 1 - 64 - 10 - 10 - - - - - - - - 4 - - - - - - - 1 - 64 - 10 - 10 - - - 4 - - - - - 2 - 64 - 30 - 40 - - - - - - - 2 - 64 - 30 - 40 - - - - - - - - - - -)V0G0N"; - std::string modelV5 = R"V0G0N( - - - - - - 1 - 64 - 10 - 10 - - - - - - - - 1 - 64 - 10 - 10 - - - - - 1 - 64 - 10 - 40 - - - - - - - - 1 - 64 - 10 - 40 - - - - - 1 - 64 - 30 - 40 - - - - - - - - 1 - 64 - 30 - 40 - - - - - 2 - 64 - 30 - 40 - - - - - - - - - - -)V0G0N"; - - compareIRs(model, modelV5, 32, [](Blob::Ptr& weights) { - auto *data = weights->buffer().as(); - data[0] = 2; - data[1] = 1; - data[2] = 3; - data[3] = 4; - }); -}