From 2711af22ed9650d399dc13dc1096158c07efc68a Mon Sep 17 00:00:00 2001 From: Evgeny Kotov Date: Mon, 19 Jun 2023 15:07:31 +0200 Subject: [PATCH] remove backward_compatibility.cpp test --- .../backward_compatibility.cpp | 229 ------------------ 1 file changed, 229 deletions(-) delete mode 100644 src/plugins/intel_gna/tests/functional/Import_export_tests/backward_compatibility/backward_compatibility.cpp diff --git a/src/plugins/intel_gna/tests/functional/Import_export_tests/backward_compatibility/backward_compatibility.cpp b/src/plugins/intel_gna/tests/functional/Import_export_tests/backward_compatibility/backward_compatibility.cpp deleted file mode 100644 index 34f9a04088e..00000000000 --- a/src/plugins/intel_gna/tests/functional/Import_export_tests/backward_compatibility/backward_compatibility.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// -#include - -#include -#include -#include - -#include "helpers/test_model_repo.hpp" -#include "ngraph_functions/builders.hpp" -#include "openvino/core/model.hpp" -#include "openvino/core/shape.hpp" -#include "openvino/core/type.hpp" -#include "openvino/opsets/opset9.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" - -using namespace ov::opset9; - -typedef std::tuple, // Export Configuration - std::map // Import Configuration - > - exportImportNetworkParams; - -class BackwardCompatibility : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon { -public: - static std::string getTestCaseName(testing::TestParamInfo obj) { - ov::element::Type input_prc; - std::string targetDevice; - std::map exportConfiguration; - std::map importConfiguration; - std::string nameExportModel; - std::tie(input_prc, targetDevice, nameExportModel, exportConfiguration, importConfiguration) = obj.param; - - std::ostringstream result; - result << "netPRC=" << input_prc << "_"; - result << "targetDevice=" << targetDevice << "_"; - result << "nameExportModel=" << nameExportModel << "_"; - for (auto const& configItem : exportConfiguration) { - result << "_exportConfigItem=" << configItem.first << "_" << configItem.second; - } - for (auto const& configItem : importConfiguration) { - result << "_importConfigItem=" << configItem.first << "_" << configItem.second; - } - return result.str(); - } - - void Run() override { - SKIP_IF_CURRENT_TEST_IS_DISABLED() - functionRefs = ngraph::clone_function(*function); - // load export configuration and save outputs - configuration.insert(exportConfiguration.begin(), exportConfiguration.end()); - LoadNetwork(); - GenerateInputs(); - Infer(); - auto actualOutputs = GetOutputs(); - - auto referenceOutputs = CalculateRefs(); - Compare(referenceOutputs, actualOutputs); - - for (auto const& configItem : importConfiguration) { - configuration[configItem.first] = configItem.second; - } - - const auto compiledExecNetwork = executableNetwork; - auto model = TestDataHelpers::get_data_path() + "/gna/" + m_export_model_name; - - const auto importedExecNetwork = core->ImportNetwork(model, targetDevice, configuration); - - GenerateInputs(); - Infer(); - - ASSERT_EQ(importedExecNetwork.GetInputsInfo().size(), compiledExecNetwork.GetInputsInfo().size()); - ASSERT_EQ(importedExecNetwork.GetOutputsInfo().size(), compiledExecNetwork.GetOutputsInfo().size()); - - for (const auto& next_output : importedExecNetwork.GetOutputsInfo()) { - ASSERT_NO_THROW(compiledExecNetwork.GetOutputsInfo()[next_output.first]); - } - auto importedOutputs = GetOutputs(); - - ASSERT_EQ(actualOutputs.size(), importedOutputs.size()); - - for (size_t i = 0; i < actualOutputs.size(); i++) { - Compare(actualOutputs[i], importedOutputs[i]); - } - } - -protected: - void SetUp() override { - ov::element::Type prc = ov::element::undefined; - std::tie(prc, targetDevice, m_export_model_name, exportConfiguration, importConfiguration) = this->GetParam(); - ov::Shape input_shape{1, 80}; - ov::Shape conv_shape{1, 2, 1, 40}; - ov::Shape split_shape = {input_shape[0], 2 * input_shape[1]}; - ov::ParameterVector inputs = {std::make_shared(prc, split_shape), - std::make_shared(prc, input_shape)}; - - // split layer to split inputs and transpose the part connected to convolution only - auto axis_const = std::make_shared(ov::element::i32, ov::Shape{}, std::vector{1}); - auto split = std::make_shared(inputs[0], axis_const, 2); - - std::vector reshape_pattern{1, 2, 1, -1}; - auto reshape_const = - std::make_shared(ov::element::i32, ov::Shape{reshape_pattern.size()}, reshape_pattern); - - auto split_0_reshape = std::make_shared(split->output(0), reshape_const, true); - auto split_1_reshape = std::make_shared(split->output(1), reshape_const, true); - auto input_1_reshape = std::make_shared(inputs[1], reshape_const, true); - - auto add = std::make_shared(split_0_reshape, input_1_reshape); - auto relu_1 = std::make_shared(add); - - // Convolution to test nchw->nhwc - size_t num_out_channels = 8; - size_t kernel_size = 8; - std::vector filter_weights = - CommonTestUtils::generate_float_numbers(num_out_channels * reshape_pattern[1] * kernel_size, -0.1f, 0.1f); - auto conv = ngraph::builder::makeConvolution(relu_1, - prc, - {1, kernel_size}, - {1, 1}, - {0, 0}, - {0, 0}, - {1, 1}, - ngraph::op::PadType::VALID, - num_out_channels, - true, - filter_weights); - - auto relu_2 = std::make_shared(conv); - - // Memory layers - ov::op::util::VariableInfo vi{}; - vi.data_shape = ov::PartialShape(conv_shape); - vi.variable_id = "test_variable"; - vi.data_type = prc; - const auto var = std::make_shared(vi); - std::vector initial_state = - CommonTestUtils::generate_float_numbers(ov::shape_size(conv_shape), -3.f, 3.f); - auto initial_state_node = std::make_shared(prc, conv_shape, initial_state); - auto read = std::make_shared(initial_state_node, var); - auto mul = std::make_shared(split_1_reshape, read); - auto assign = std::make_shared(mul, var); - auto relu_3 = std::make_shared(mul); - - ov::SinkVector sinks = {assign}; - ov::ResultVector results; - results.emplace_back(std::make_shared(relu_2)); - results.emplace_back(std::make_shared(relu_3)); - - function = std::make_shared(results, sinks, inputs, "universal_export_model"); - } - - std::map exportConfiguration; - std::map importConfiguration; - std::string m_export_model_name; -}; - -class BackwardCompatibilityLegacy : public BackwardCompatibility { -protected: - void SetUp() override { - ov::element::Type prc = ov::element::undefined; - std::tie(prc, targetDevice, m_export_model_name, exportConfiguration, importConfiguration) = this->GetParam(); - ov::Shape input_shape{1, 336}; - - auto param = std::make_shared(prc, input_shape); - auto const_eltwise = std::make_shared(prc, input_shape, std::vector{-1}); - auto mul = std::make_shared(param, const_eltwise); - - ov::ResultVector results{std::make_shared(mul)}; - - function = std::make_shared(results, ov::ParameterVector{param}, "ExportBackwordCompatibility"); - } -}; - -TEST_P(BackwardCompatibility, smoke_BackwardCompatibility) { - Run(); -} - -TEST_P(BackwardCompatibilityLegacy, smoke_BackwardCompatibility) { - Run(); -} - -const std::vector input_precisions = {ov::element::f32, ov::element::f16}; - -const std::vector> export_configs_legacy = { - {{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_SCALE_FACTOR_0", "327.67"}}}; - -const std::vector> import_configs_legacy = { - {{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_SCALE_FACTOR_0", "327.67"}}, -}; - -const std::vector> export_configs = { - {{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_SCALE_FACTOR_0", "327.67"}, {"GNA_SCALE_FACTOR_1", "327.67"}}}; - -const std::vector> import_configs = { - {{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_SCALE_FACTOR_0", "327.67"}, {"GNA_SCALE_FACTOR_1", "327.67"}}}; - -const std::vector export_models_legacy = {"export2dot1.blob", - "export2dot2.blob", - "export2dot3.blob", - "export2dot4.blob", - "export2dot5.blob"}; -const std::vector export_models = {"export2dot6.blob", - "export2dot7.blob", - "export2dot8.blob", - "export2dot9.blob"}; - -INSTANTIATE_TEST_SUITE_P(smoke_OldVersion, - BackwardCompatibilityLegacy, - ::testing::Combine(::testing::ValuesIn(input_precisions), - ::testing::Values(CommonTestUtils::DEVICE_GNA), - ::testing::ValuesIn(export_models_legacy), - ::testing::ValuesIn(export_configs_legacy), - ::testing::ValuesIn(import_configs_legacy)), - BackwardCompatibilityLegacy::getTestCaseName); - -INSTANTIATE_TEST_SUITE_P(smoke_OldVersion, - BackwardCompatibility, - ::testing::Combine(::testing::ValuesIn(input_precisions), - ::testing::Values(CommonTestUtils::DEVICE_GNA), - ::testing::ValuesIn(export_models), - ::testing::ValuesIn(export_configs), - ::testing::ValuesIn(import_configs)), - BackwardCompatibility::getTestCaseName);