From eda9498b794cf1cfeeebe924c2eee8cea889ffe7 Mon Sep 17 00:00:00 2001 From: Aleksandr Korolev Date: Fri, 25 Sep 2020 14:24:12 +0300 Subject: [PATCH] [IE][VPU]: Reduce tests execution time (#2378) * [IE][VPU]: Reduce tests execution time * [IE TESTS] Remove 'ConfigurePlugin()' from 'memory_LSTMCell.hpp' * [IE VPU TESTS] Myriad conv layer tests was changed Co-authored-by: Maksim Doronin Co-authored-by: kora6 --- .../plugin/gna/import_export_network.cpp | 1 - .../shared/src/behavior/stress_tests.cpp | 4 +- .../shared/src/subgraph_tests/basic_lstm.cpp | 1 - .../src/subgraph_tests/memory_LSTMCell.cpp | 1 - ...shape_permute_conv_permute_reshape_act.cpp | 1 - .../layer_test_utils.cpp | 15 +-- .../layer_test_utils.hpp | 3 - .../layers/myriad_layers_convolution_test.cpp | 95 +++++++++----- .../layers/myriad_layers_convolution_test.hpp | 124 ++++++++++-------- 9 files changed, 134 insertions(+), 111 deletions(-) diff --git a/inference-engine/tests/functional/plugin/gna/import_export_network.cpp b/inference-engine/tests/functional/plugin/gna/import_export_network.cpp index 6b444d82c47..663113c8381 100644 --- a/inference-engine/tests/functional/plugin/gna/import_export_network.cpp +++ b/inference-engine/tests/functional/plugin/gna/import_export_network.cpp @@ -49,7 +49,6 @@ class ImportNetworkTest : public testing::WithParamInterfaceLoadNetwork(cnnNet, targetDevice); + ie->LoadNetwork(cnnNet, targetDevice, configuration); } std::cout << "\nCheck inference.\n"; diff --git a/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/basic_lstm.cpp b/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/basic_lstm.cpp index f2e03f7c3c0..0d30b7ec84c 100644 --- a/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/basic_lstm.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/basic_lstm.cpp @@ -103,7 +103,6 @@ void Basic_LSTM_S::SetUp() { void Basic_LSTM_S::Run() { SKIP_IF_CURRENT_TEST_IS_DISABLED() - ConfigurePlugin(); LoadNetwork(); Infer(); diff --git a/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/memory_LSTMCell.cpp b/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/memory_LSTMCell.cpp index ee4e92a9219..b9d97613903 100644 --- a/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/memory_LSTMCell.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/memory_LSTMCell.cpp @@ -197,7 +197,6 @@ namespace SubgraphTestsDefinitions { void MemoryLSTMCellTest::Run() { SKIP_IF_CURRENT_TEST_IS_DISABLED() - ConfigurePlugin(); LoadNetwork(); auto states = executableNetwork.QueryState(); for (auto& state : states) { diff --git a/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/reshape_permute_conv_permute_reshape_act.cpp b/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/reshape_permute_conv_permute_reshape_act.cpp index 96c86458781..e1951c88755 100644 --- a/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/reshape_permute_conv_permute_reshape_act.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/subgraph_tests/reshape_permute_conv_permute_reshape_act.cpp @@ -87,7 +87,6 @@ namespace LayerTestsDefinitions { void ConvReshapeAct::Run() { SKIP_IF_CURRENT_TEST_IS_DISABLED() - ConfigurePlugin(); LoadNetwork(); inferRequest = executableNetwork.CreateInferRequest(); diff --git a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_test_utils.cpp b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_test_utils.cpp index 06152180953..740996504b9 100644 --- a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_test_utils.cpp +++ b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_test_utils.cpp @@ -16,18 +16,11 @@ LayerTestsCommon::LayerTestsCommon() : threshold(1e-2f) { void LayerTestsCommon::Run() { SKIP_IF_CURRENT_TEST_IS_DISABLED() - ConfigurePlugin(); LoadNetwork(); Infer(); Validate(); } -LayerTestsCommon::~LayerTestsCommon() { - if (!configuration.empty()) { - PluginCache::get().reset(); - } -} - InferenceEngine::Blob::Ptr LayerTestsCommon::GenerateInput(const InferenceEngine::InputInfo &info) const { return FuncTestUtils::createAndFillBlob(info.getTensorDesc()); } @@ -83,12 +76,6 @@ void LayerTestsCommon::Compare(const InferenceEngine::Blob::Ptr &expected, const } } -void LayerTestsCommon::ConfigurePlugin() { - if (!configuration.empty()) { - core->SetConfig(configuration, targetDevice); - } -} - void LayerTestsCommon::ConfigureNetwork() const { for (const auto &in : cnnNetwork.getInputsInfo()) { if (inLayout != InferenceEngine::Layout::ANY) { @@ -112,7 +99,7 @@ void LayerTestsCommon::ConfigureNetwork() const { void LayerTestsCommon::LoadNetwork() { cnnNetwork = InferenceEngine::CNNNetwork{function}; ConfigureNetwork(); - executableNetwork = core->LoadNetwork(cnnNetwork, targetDevice); + executableNetwork = core->LoadNetwork(cnnNetwork, targetDevice, configuration); } void LayerTestsCommon::Infer() { diff --git a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_test_utils.hpp b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_test_utils.hpp index 7fdbc75f469..0962d0e8ebf 100644 --- a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_test_utils.hpp +++ b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_test_utils.hpp @@ -63,7 +63,6 @@ public: protected: LayerTestsCommon(); - ~LayerTestsCommon() override; template void Compare(const T *expected, const T *actual, std::size_t size, T threshold) { @@ -92,8 +91,6 @@ protected: return core; } - void ConfigurePlugin(); - void ConfigureNetwork() const; void LoadNetwork(); diff --git a/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_convolution_test.cpp b/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_convolution_test.cpp index e5816b57379..0304147b8e8 100644 --- a/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_convolution_test.cpp +++ b/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_convolution_test.cpp @@ -8,9 +8,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_chw_dilation, myriadLayerConvolution_smoke, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 37, 43, 43) , MAKE_STRUCT(tensor_test_params, 1, 37, 19, 19)) - , ::testing::Values( - MAKE_STRUCT(param_size, 3, 3) - ) + , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) , ::testing::Values(MAKE_STRUCT(param_size, 1, 1) , MAKE_STRUCT(param_size, 2, 2) , MAKE_STRUCT(param_size, 3, 3) @@ -251,7 +249,7 @@ INSTANTIATE_TEST_CASE_P(accuracy, myriadLayers_3X3X3_ConstInput_smoke, ) ); -INSTANTIATE_TEST_CASE_P(accuracy_crossroad_spatialConv, myriadLayerConvolutionTensorFlow_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_crossroad_spatialConv, myriadLayerConvolutionTensorFlow, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 3, 1024, 1024)) , ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 3, 512, 512)) @@ -264,7 +262,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_crossroad_spatialConv, myriadLayerConvolutionTe ) ); -INSTANTIATE_TEST_CASE_P(accuracy_inception_v2, myriadLayerConvolutionTensorFlow_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_inception_v2, myriadLayerConvolutionTensorFlow, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 16, 28, 28)) , ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 64, 14, 14)) @@ -277,7 +275,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_inception_v2, myriadLayerConvolutionTensorFlow_ ) ); -INSTANTIATE_TEST_CASE_P(accuracy_inception_v1, myriadLayerConvolutionTensorFlow_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_inception_v1, myriadLayerConvolutionTensorFlow, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 3, 224, 224), MAKE_STRUCT(tensor_test_params, 1, 32, 224, 224) @@ -292,7 +290,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_inception_v1, myriadLayerConvolutionTensorFlow_ ) ); -INSTANTIATE_TEST_CASE_P(test_3x3_SSD_dilation, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(test_3x3_SSD_dilation, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 512, 19, 19)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -317,7 +315,7 @@ INSTANTIATE_TEST_CASE_P(test_TF_Resnet_50, myriadLayers_IR3_ConvTests_smoke, ) ); -INSTANTIATE_TEST_CASE_P(test_3x3_icvnet_dilation, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(test_3x3_icvnet_dilation, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 24, 20, 20)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -332,7 +330,7 @@ INSTANTIATE_TEST_CASE_P(test_3x3_icvnet_dilation, myriadLayerConvolution_smoke, ) ); -INSTANTIATE_TEST_CASE_P(test_5x5_with_dilation, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(test_5x5_with_dilation, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 32, 64, 77)) , ::testing::Values(MAKE_STRUCT(param_size, 5, 5)) @@ -348,7 +346,7 @@ INSTANTIATE_TEST_CASE_P(test_5x5_with_dilation, myriadLayerConvolution_smoke, ) ); -INSTANTIATE_TEST_CASE_P(test_7x7_with_dilation, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(test_7x7_with_dilation, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 32, 64, 77)) , ::testing::Values(MAKE_STRUCT(param_size, 7, 7)) @@ -365,7 +363,7 @@ INSTANTIATE_TEST_CASE_P(test_7x7_with_dilation, myriadLayerConvolution_smoke, ); -INSTANTIATE_TEST_CASE_P(test_conv1x1, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(test_conv1x1, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 10, 13, 13)) , ::testing::Values(MAKE_STRUCT(param_size, 1, 1)) @@ -379,7 +377,7 @@ INSTANTIATE_TEST_CASE_P(test_conv1x1, myriadLayerConvolution_smoke, ) ); -INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_3x3_convolution, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_3x3_convolution, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 512, 13, 13)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -392,7 +390,7 @@ INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_3x3_convolution, myriadLa ) ); -INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_1x1_convolution, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_1x1_convolution, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 4608, 13, 13)) , ::testing::Values(MAKE_STRUCT(param_size, 1, 1)) @@ -405,7 +403,7 @@ INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_1x1_convolution, myriadLa ) ); -INSTANTIATE_TEST_CASE_P(accuracy_group, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_group, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 32, 64, 77) , MAKE_STRUCT(tensor_test_params, 1, 32, 112, 96)) @@ -424,7 +422,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_group, myriadLayerConvolution_smoke, ) ); -INSTANTIATE_TEST_CASE_P(accuracy_group_large_input, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_group_large_input, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 32, 192, 336)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -451,12 +449,27 @@ INSTANTIATE_TEST_CASE_P(accuracy_any_group, myriadLayerConvolution_smoke, , ::testing::Values(32) , ::testing::Values(2, 4, 16) , ::testing::Values(MAKE_STRUCT(param_size, 1, 2), MAKE_STRUCT(param_size, 2, 3), MAKE_STRUCT(param_size, 3, 4)), - ::testing::Values(vpu::LayoutPreference::ChannelMinor, - vpu::LayoutPreference::ChannelMajor) + ::testing::Values(vpu::LayoutPreference::ChannelMajor) ) ); -INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3_with_group, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_any_group, myriadLayerConvolution, + ::testing::Combine( + ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 32, 64, 77)) + , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) + , ::testing::Values(MAKE_STRUCT(param_size, 1, 1) + , MAKE_STRUCT(param_size, 2, 2)) + , ::testing::Values(MAKE_STRUCT(param_size, 1, 1) + , MAKE_STRUCT(param_size, 0, 0) + , MAKE_STRUCT(param_size, 2, 2)) + , ::testing::Values(32) + , ::testing::Values(2, 4, 16) + , ::testing::Values(MAKE_STRUCT(param_size, 1, 2), MAKE_STRUCT(param_size, 2, 3), MAKE_STRUCT(param_size, 3, 4)), + ::testing::Values(vpu::LayoutPreference::ChannelMinor) + ) +); + +INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3_with_group, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 24, 80, 80) , MAKE_STRUCT(tensor_test_params, 1, 36, 80, 80)) @@ -471,7 +484,7 @@ INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3_with_group, myriadLayerConvolut ) ); -INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3s1, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3s1, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 24, 80, 80)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -484,7 +497,7 @@ INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3s1, myriadLayerConvolution_smoke ) ); -INSTANTIATE_TEST_CASE_P(accuracy_1x1, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_1x1, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 16, 64, 64) , MAKE_STRUCT(tensor_test_params, 1, 32, 1, 1)) @@ -501,7 +514,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_1x1, myriadLayerConvolution_smoke, ) ); -INSTANTIATE_TEST_CASE_P(accuracy_3x3, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_3x3, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 8, 16, 16) , MAKE_STRUCT(tensor_test_params, 1, 8, 59, 73)) @@ -517,7 +530,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_3x3, myriadLayerConvolution_smoke, ) ); -INSTANTIATE_TEST_CASE_P(accuracy_1x3, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_1x3, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 8, 59, 73)) , ::testing::Values(MAKE_STRUCT(param_size, 1, 3), MAKE_STRUCT(param_size, 3, 1)) @@ -544,12 +557,28 @@ INSTANTIATE_TEST_CASE_P(accuracy_5x5, myriadLayerConvolution_smoke, , ::testing::Values(16, 32) , ::testing::Values(1) , ::testing::Values(MAKE_STRUCT(param_size, 1, 2)), - ::testing::Values(vpu::LayoutPreference::ChannelMinor, - vpu::LayoutPreference::ChannelMajor) + ::testing::Values(vpu::LayoutPreference::ChannelMajor) ) ); -INSTANTIATE_TEST_CASE_P(accuracy_7x7, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_5x5, myriadLayerConvolution, + ::testing::Combine( + ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 16, 32, 32) + /*, MAKE_STRUCT(tensor_test_params, 1, 8, 511, 399) failed*/) + , ::testing::Values(MAKE_STRUCT(param_size, 5, 5)) + , ::testing::Values(MAKE_STRUCT(param_size, 1, 1) + , MAKE_STRUCT(param_size, 2, 2)) + , ::testing::Values(MAKE_STRUCT(param_size, 0, 0) + /*, MAKE_STRUCT(param_size, 1, 1) failed*/ + , MAKE_STRUCT(param_size, 2, 2)) + , ::testing::Values(16, 32) + , ::testing::Values(1) + , ::testing::Values(MAKE_STRUCT(param_size, 1, 2)), + ::testing::Values(vpu::LayoutPreference::ChannelMinor) + ) +); + +INSTANTIATE_TEST_CASE_P(accuracy_7x7, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 8, 32, 32) /*, MAKE_STRUCT(tensor_test_params, 1, 8, 511, 399) failed*/) @@ -566,7 +595,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_7x7, myriadLayerConvolution_smoke, ) ); -INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_1, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_1, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 3, 720, 1280)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -579,7 +608,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_1, myriadLayerConvolution_smoke ) ); -INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_2, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_2, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 24, 357, 637)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -593,7 +622,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_2, myriadLayerConvolution_smoke ); -INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_3, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_3, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 16, 359, 639)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -606,7 +635,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_3, myriadLayerConvolution_smoke ) ); -INSTANTIATE_TEST_CASE_P(accuracy_1x1_large_input, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_1x1_large_input, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 24, 355, 635)) , ::testing::Values(MAKE_STRUCT(param_size, 1, 1)) @@ -619,7 +648,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_1x1_large_input, myriadLayerConvolution_smoke, ) ); -INSTANTIATE_TEST_CASE_P(accuracy_small_input_0, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_small_input_0, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 128, 38, 38)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -631,7 +660,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_small_input_0, myriadLayerConvolution_smoke, , ::testing::Values(vpu::LayoutPreference::ChannelMinor) ) ); -INSTANTIATE_TEST_CASE_P(accuracy_small_input_1, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_small_input_1, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 256, 2, 3)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -643,7 +672,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_small_input_1, myriadLayerConvolution_smoke, , ::testing::Values(vpu::LayoutPreference::ChannelMinor) ) ); -INSTANTIATE_TEST_CASE_P(accuracy_small_input_2, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_small_input_2, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 256, 2, 2)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) @@ -655,7 +684,7 @@ INSTANTIATE_TEST_CASE_P(accuracy_small_input_2, myriadLayerConvolution_smoke, , ::testing::Values(vpu::LayoutPreference::ChannelMinor) ) ); -INSTANTIATE_TEST_CASE_P(accuracy_small_input_3, myriadLayerConvolution_smoke, +INSTANTIATE_TEST_CASE_P(accuracy_small_input_3, myriadLayerConvolution, ::testing::Combine( ::testing::Values(MAKE_STRUCT(tensor_test_params, 1, 256, 1, 1)) , ::testing::Values(MAKE_STRUCT(param_size, 3, 3)) diff --git a/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_convolution_test.hpp b/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_convolution_test.hpp index 31c18024e32..1397a97c467 100644 --- a/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_convolution_test.hpp +++ b/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_convolution_test.hpp @@ -21,75 +21,91 @@ PRETTY_PARAM(group, int); PRETTY_PARAM(dilation_factor, param_size); PRETTY_PARAM(layoutPreference, vpu::LayoutPreference); -typedef myriadLayerTestBaseWithParam> myriadLayerConvolution_smoke; +class myriadLayerConvolutionBase : public myriadLayerTestBaseWithParam< + tuple> +{ +public: + void testConvolution() { + tensor_test_params input_dims = get<0>(GetParam()); + param_size kernel = get<1>(GetParam()); + param_size stride = get<2>(GetParam()); + param_size pad = get<3>(GetParam()); + size_t out_channels = get<4>(GetParam()); + size_t group = get<5>(GetParam()); + param_size dilation_factor = get<6>(GetParam()); + vpu::LayoutPreference layoutPreference = get<7>(GetParam()); -typedef myriadLayerTestBaseWithParam> myriadLayerConvolutionTensorFlow_smoke; + size_t out_w = (input_dims.w + 2 * pad.x - dilation_factor.x * (kernel.x - 1) - 1 + stride.x) / stride.x; + size_t out_h = (input_dims.h + 2 * pad.y - dilation_factor.y * (kernel.y - 1) - 1 + stride.y) / stride.y; -TEST_P(myriadLayerConvolution_smoke, Convolution) { - tensor_test_params input_dims = get<0>(GetParam()); - param_size kernel = get<1>(GetParam()); - param_size stride = get<2>(GetParam()); - param_size pad = get<3>(GetParam()); - size_t out_channels = get<4>(GetParam()); - size_t group = get<5>(GetParam()); - param_size dilation_factor = get<6>(GetParam()); - vpu::LayoutPreference layoutPreference = get<7>(GetParam()); + tensor_test_params output_dims = {1, out_channels, out_h, out_w}; - size_t out_w = (input_dims.w + 2 * pad.x - dilation_factor.x * (kernel.x - 1) - 1 + stride.x) / stride.x; - size_t out_h = (input_dims.h + 2 * pad.y - dilation_factor.y * (kernel.y - 1) - 1 + stride.y) / stride.y; + SetInputTensor(input_dims); + SetOutputTensor(output_dims); - tensor_test_params output_dims = {1, out_channels, out_h, out_w}; + size_t num_weights = kernel.x * kernel.y * (input_dims.c / group) * output_dims.c; + size_t num_bias = output_dims.c; - SetInputTensor(input_dims); - SetOutputTensor(output_dims); + InferenceEngine::TBlob::Ptr weights_ptr = + InferenceEngine::TBlob::Ptr(GenWeights(num_weights + num_bias)); + ie_fp16* weights = weights_ptr->data().as(); + ie_fp16* bias = weights + num_weights; - size_t num_weights = kernel.x * kernel.y * (input_dims.c / group) * output_dims.c; - size_t num_bias = output_dims.c; + std::map layer_params = { + {"kernel-x", std::to_string(kernel.x)} + , {"kernel-y", std::to_string(kernel.y)} + , {"stride-x", std::to_string(stride.x)} + , {"stride-y", std::to_string(stride.y)} + , {"pad-x", std::to_string(pad.x)} + , {"pad-y", std::to_string(pad.y)} + , {"output", std::to_string(out_channels)} + , {"group", std::to_string(group)} + , {"dilation-x", std::to_string(dilation_factor.x)} + , {"dilation-y", std::to_string(dilation_factor.y)} + }; + ASSERT_NO_FATAL_FAILURE(makeSingleLayerNetwork(LayerInitParams("Convolution") + .params(layer_params) + .weights(num_weights) + .biases(num_bias), + {}, + weights_ptr)); + SetFirstInputToRange(-0.9f, 0.9f); - InferenceEngine::TBlob::Ptr weights_ptr = - InferenceEngine::TBlob::Ptr(GenWeights(num_weights + num_bias)); - ie_fp16* weights = weights_ptr->data().as(); - ie_fp16* bias = weights + num_weights; + ASSERT_TRUE(Infer()); + auto inputBlob = _inputMap.begin()->second; + auto outputBlob = _outputMap.begin()->second; - std::map layer_params = { - {"kernel-x", std::to_string(kernel.x)} - , {"kernel-y", std::to_string(kernel.y)} - , {"stride-x", std::to_string(stride.x)} - , {"stride-y", std::to_string(stride.y)} - , {"pad-x", std::to_string(pad.x)} - , {"pad-y", std::to_string(pad.y)} - , {"output", std::to_string(out_channels)} - , {"group", std::to_string(group)} - , {"dilation-x", std::to_string(dilation_factor.x)} - , {"dilation-y", std::to_string(dilation_factor.y)} - }; - ASSERT_NO_FATAL_FAILURE(makeSingleLayerNetwork(LayerInitParams("Convolution") - .params(layer_params) - .weights(num_weights) - .biases(num_bias), - {}, - weights_ptr)); - SetFirstInputToRange(-0.9f, 0.9f); + ref_convolution(inputBlob, _refBlob, weights, bias, kernel, stride, pad, group, dilation_factor); - ASSERT_TRUE(Infer()); - auto inputBlob = _inputMap.begin()->second; - auto outputBlob = _outputMap.begin()->second; + float maxerr = 0; - ref_convolution(inputBlob, _refBlob, weights, bias, kernel, stride, pad, group, dilation_factor); + if (group == 1) + maxerr = 0.00055 * input_dims.c * kernel.x * kernel.y; + else // TODO: currently dephConv is slightly less accurate + maxerr = 0.00066 * (input_dims.c / group) * kernel.x * kernel.y; - float maxerr = 0; + CompareCommonAbsolute(outputBlob, _refBlob, maxerr); + } +}; - if (group == 1) - maxerr = 0.00055 * input_dims.c * kernel.x * kernel.y; - else // TODO: currently dephConv is slightly less accurate - maxerr = 0.00066 * (input_dims.c / group) * kernel.x * kernel.y; +class myriadLayerConvolution : public myriadLayerConvolutionBase {}; - CompareCommonAbsolute(outputBlob, _refBlob, maxerr); +TEST_P(myriadLayerConvolution, Convolution) { + testConvolution(); } -TEST_P(myriadLayerConvolutionTensorFlow_smoke, Convolution) { +class myriadLayerConvolution_smoke : public myriadLayerConvolutionBase {}; + +TEST_P(myriadLayerConvolution_smoke, Convolution) { + testConvolution(); +} + + +class myriadLayerConvolutionTensorFlow : + public myriadLayerTestBaseWithParam> {}; + +TEST_P(myriadLayerConvolutionTensorFlow, Convolution) { tensor_test_params input_dims = get<0>(GetParam()); tensor_test_params output_dims = get<1>(GetParam()); param_size kernel = get<2>(GetParam());