From 561bf6d478321673db0d3dad27899a10aa75a1a0 Mon Sep 17 00:00:00 2001 From: Ryszard Jezierski Date: Wed, 26 Apr 2023 21:51:53 +0200 Subject: [PATCH] Removed deprecated parser tests (#17151) --- .../input_tests/parser_tests.cpp | 35 ---- .../shared_tests/input_tests/parser_tests.hpp | 174 ------------------ 2 files changed, 209 deletions(-) delete mode 100644 src/plugins/intel_gna/tests/deprecated/functional/gna/shared_tests_instance/input_tests/parser_tests.cpp delete mode 100644 src/plugins/intel_gna/tests/deprecated/functional/shared_tests/input_tests/parser_tests.hpp diff --git a/src/plugins/intel_gna/tests/deprecated/functional/gna/shared_tests_instance/input_tests/parser_tests.cpp b/src/plugins/intel_gna/tests/deprecated/functional/gna/shared_tests_instance/input_tests/parser_tests.cpp deleted file mode 100644 index 804672509ec..00000000000 --- a/src/plugins/intel_gna/tests/deprecated/functional/gna/shared_tests_instance/input_tests/parser_tests.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "parser_tests.hpp" - -ir_test_params ir_test_cases[] = { - ir_test_params("GNA", "FP32", negative_conv_kernel_x_case), - ir_test_params("GNA", "FP32", negative_conv_kernel_y_case), - ir_test_params("GNA", "FP32", negative_conv_stride_x_case), - ir_test_params("GNA", "FP32", negative_conv_weights_case), - ir_test_params("GNA", "FP32", negative_conv_biases_case), - - ir_test_params("GNA", "FP32", negative_fc_out_size_case), - ir_test_params("GNA", "FP32", negative_fc_weights_case), - ir_test_params("GNA", "FP32", negative_fc_biases_case), - - ir_test_params("GNA", "FP32", negative_deconv_kernel_x_case), - ir_test_params("GNA", "FP32", negative_deconv_kernel_y_case), - ir_test_params("GNA", "FP32", negative_deconv_stride_x_case), - ir_test_params("GNA", "FP32", negative_deconv_weights_case), - ir_test_params("GNA", "FP32", negative_deconv_biases_case), - - ir_test_params("GNA", "FP32", negative_pool_kernel_x_case), - ir_test_params("GNA", "FP32", negative_pool_kernel_y_case), - ir_test_params("GNA", "FP32", negative_pool_stride_x_case), - ir_test_params("GNA", "FP32", incorrect_pool_type_case), - - ir_test_params("GNA", "FP32", negative_norm_local_size_case), - ir_test_params("GNA", "FP32", negative_norm_k_case) -}; - -INSTANTIATE_TEST_SUITE_P(FunctionalTest_smoke, IncorrectIRTests, - ::testing::ValuesIn(ir_test_cases), - getTestName); diff --git a/src/plugins/intel_gna/tests/deprecated/functional/shared_tests/input_tests/parser_tests.hpp b/src/plugins/intel_gna/tests/deprecated/functional/shared_tests/input_tests/parser_tests.hpp deleted file mode 100644 index f6fa441a110..00000000000 --- a/src/plugins/intel_gna/tests/deprecated/functional/shared_tests/input_tests/parser_tests.hpp +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include -#include -#include -#include -#include -#include "xml_net_builder.hpp" - -struct layer_params { - layer_params(std::string type, std::vector in, std::vector out, - int weights, int biases, std::map params) - : type(std::move(type)), in(std::move(in)), out(std::move(out)), params(std::move(params)), - weights(weights), biases(biases) {} - - std::string type; - std::vector in; - std::vector out; - int weights; - int biases; - std::map params; -}; - -struct ir_test_params : layer_params { - ir_test_params(std::string name, std::string precision, layer_params param) - : layer_params(param), device_name(name), precision(std::move(precision)) {} - - std::string device_name; - std::string precision; -}; - -std::map> smokeTests{}; - -std::string getTestName(testing::TestParamInfo obj) { - std::string name = obj.param.device_name + "__" + obj.param.precision + "__" + obj.param.type + "__"; - - bool isSmoke{ false }; - if (smokeTests.find(obj.param.device_name) == smokeTests.end()) { - smokeTests.insert(std::make_pair(obj.param.device_name, std::vector{ obj.param.type })); - isSmoke = true; - } - else { - auto& typeVector = smokeTests.at(obj.param.device_name); - bool flag = (std::find(typeVector.begin(), typeVector.end(), obj.param.type) == typeVector.end()); - if (flag) { - typeVector.push_back(obj.param.type); - isSmoke = true; - } - } - - if (isSmoke) - name = obj.param.device_name + "__" + obj.param.precision + "__" + obj.param.type + "__"; - - for (size_t i = 0; i < obj.param.in.size(); i++) { - if (i) - name += "_"; - name += std::to_string(obj.param.in[i]); - } - name += "__"; - for (size_t i = 0; i < obj.param.out.size(); i++) { - if (i) - name += "_"; - name += std::to_string(obj.param.out[i]); - } - name += "__"; - if (obj.param.weights < 0) - name += "n"; - name += std::to_string(abs(obj.param.weights)); - name += "__"; - if (obj.param.biases < 0) - name += "n"; - name += std::to_string(abs(obj.param.biases)); - name += "__"; - - std::string param; - for (const auto& it : obj.param.params) { - if (!param.empty()) - name += "__"; - std::string key = it.first; - std::string value = it.second; - for (char &i : key) { - if (!isalnum(i)) - i = '_'; - } - for (char &i : value) { - if (!isalnum(i)) - i = '_'; - } - name += key + "___" + value; - } - name += param; - return name; -} - -class IncorrectIRTests: public TestsCommon, - public testing::WithParamInterface { -protected: - InferenceEngine::TBlob::Ptr GetNetworkWeights(const layer_params &p) { - size_t weigtsSize = (abs(p.weights) + abs(p.biases))*sizeof(float); - if (weigtsSize == 0) - return nullptr; - InferenceEngine::TBlob *weights = new InferenceEngine::TBlob({ - InferenceEngine::Precision::U8, { weigtsSize }, InferenceEngine::Layout::C}); - weights->allocate(); - fill_data(weights->buffer().as(), - weights->size() / sizeof(float)); - InferenceEngine::TBlob::Ptr weights_ptr = InferenceEngine::TBlob::Ptr(weights); - - return weights_ptr; - } -}; - -TEST_F(IncorrectIRTests, smoke_loadIRWithIncorrectInput) { - std::map params = {{"negative_slope", "0"}}; - - std::string model = CommonTestUtils::V2NetBuilder::buildNetworkWithOneInput("ReLU_WithInput_Only", {1, 3, 4, 4}, "FP32") - .addLayer("ReLU", "FP32", ¶ms, {{{1, 3, 2, 2}}, {{1, 3, 4, 4}}}) - .finish(false); - - InferenceEngine::Core ie; - ASSERT_THROW(ie.ReadNetwork(model, InferenceEngine::Blob::CPtr()), - InferenceEngine::Exception); -} - -TEST_P(IncorrectIRTests, loadIncorrectLayer) { - auto param = GetParam(); - - std::string model = CommonTestUtils::V2NetBuilder::buildNetworkWithOneInput(param.type + "_Only", param.in, param.precision) - .addLayer(param.type, param.precision, ¶m.params, {{param.in}, {param.out}}, param.weights, param.biases) - .finish(false); - - try { - InferenceEngine::Core ie; - auto network = ie.ReadNetwork(model, GetNetworkWeights(param)); - auto exec = ie.LoadNetwork(network, param.device_name); - } catch(...) { - return; - } - FAIL() << "Topology was loaded successfully."; -} - -// Convolution -#define negative_conv_kernel_x_case layer_params("Convolution", {1, 3, 224, 224}, {1, 64, 112, 112}, 64*3*7*7, 64, {{"kernel-x", "-7"}, {"kernel-y", "7"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) -#define negative_conv_kernel_y_case layer_params("Convolution", {1, 3, 224, 224}, {1, 64, 112, 112}, 64*3*7*7, 64, {{"kernel-x", "7"}, {"kernel-y", "-7"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) -#define negative_conv_stride_x_case layer_params("Convolution", {1, 3, 224, 224}, {1, 64, 112, 112}, 64*3*7*7, 64, {{"kernel-x", "7"}, {"kernel-y", "7"}, {"stride-x", "-2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) -#define negative_conv_weights_case layer_params("Convolution", {1, 3, 224, 224}, {1, 64, 112, 112}, -64*3*7*7, 64, {{"kernel-x", "7"}, {"kernel-y", "7"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) -#define negative_conv_biases_case layer_params("Convolution", {1, 3, 224, 224}, {1, 64, 112, 112}, 64*3*7*7, -64, {{"kernel-x", "7"}, {"kernel-y", "7"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) - -// Fully connected -#define negative_fc_out_size_case layer_params("InnerProduct", {1, 3, 224, 224}, {1, 64, 112, 112}, 224*224*3*1000, 1000, {{"out-size", "-1000"}}) -#define negative_fc_weights_case layer_params("InnerProduct", {1, 3, 224, 224}, {1, 64, 112, 112}, -224*224*3*1000, 1000, {{"out-size", "1000"}}) -#define negative_fc_biases_case layer_params("InnerProduct", {1, 3, 224, 224}, {1, 64, 112, 112}, 224*224*3*1000, -1000, {{"out-size", "1000"}}) - -// Deconvolution -#define negative_deconv_kernel_x_case layer_params("Deconvolution", {1, 64, 224, 224}, {1, 3, 112, 112}, 64*3*7*7, 64, {{"kernel-x", "-7"}, {"kernel-y", "7"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) -#define negative_deconv_kernel_y_case layer_params("Deconvolution", {1, 64, 224, 224}, {1, 3, 112, 112}, 64*3*7*7, 64, {{"kernel-x", "7"}, {"kernel-y", "-7"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) -#define negative_deconv_stride_x_case layer_params("Deconvolution", {1, 64, 224, 224}, {1, 3, 112, 112}, 64*3*7*7, 64, {{"kernel-x", "7"}, {"kernel-y", "7"}, {"stride-x", "-2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) -#define negative_deconv_weights_case layer_params("Deconvolution", {1, 64, 224, 224}, {1, 3, 112, 112}, -64*3*7*7, 64, {{"kernel-x", "7"}, {"kernel-y", "7"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) -#define negative_deconv_biases_case layer_params("Deconvolution", {1, 64, 224, 224}, {1, 3, 112, 112}, 64*3*7*7, -64, {{"kernel-x", "7"}, {"kernel-y", "7"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "2"}, {"pad-y", "2"}, {"dilation-x", "0"}, {"dilation-y", "0"}, {"output", "64"}, {"group", "1"}}) - -// Pooling -#define negative_pool_kernel_x_case layer_params("Pooling", {1, 3, 224, 224}, {1, 3, 112, 112}, 0, 0, {{"kernel-x", "-2"}, {"kernel-y", "2"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "0"}, {"pad-y", "0"}, {"rounding-type", "ceil"}, {"pool-method", "max"}}) -#define negative_pool_kernel_y_case layer_params("Pooling", {1, 3, 224, 224}, {1, 3, 112, 112}, 0, 0, {{"kernel-x", "2"}, {"kernel-y", "-2"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "0"}, {"pad-y", "0"}, {"rounding-type", "ceil"}, {"pool-method", "max"}}) -#define negative_pool_stride_x_case layer_params("Pooling", {1, 3, 224, 224}, {1, 3, 112, 112}, 0, 0, {{"kernel-x", "2"}, {"kernel-y", "2"}, {"stride-x", "-2"}, {"stride-y", "2"}, {"pad-x", "0"}, {"pad-y", "0"}, {"rounding-type", "ceil"}, {"pool-method", "max"}}) -#define incorrect_pool_type_case layer_params("Pooling", {1, 3, 224, 224}, {1, 3, 112, 112}, 0, 0, {{"kernel-x", "2"}, {"kernel-y", "2"}, {"stride-x", "2"}, {"stride-y", "2"}, {"pad-x", "0"}, {"pad-y", "0"}, {"rounding-type", "ceil"}, {"pool-method", "unknown"}}) - -// Norm -#define negative_norm_local_size_case layer_params("Norm", {1, 3, 224, 224}, {1, 3, 224, 224}, 0, 0, {{"alpha", "9.9999997e-05"}, {"beta", "0.75"}, {"local_size", "-5"}, {"region", "across"}, {"k", "1"}}) -#define negative_norm_k_case layer_params("Norm", {1, 3, 224, 224}, {1, 3, 224, 224}, 0, 0, {{"alpha", "9.9999997e-05"}, {"beta", "0.75"}, {"local_size", "5"}, {"region", "across"}, {"k", "-2"}}) - - -// TODO: Add Concat and split tests