From ff72398593a0ee81aaeb38def8100bd4089f0228 Mon Sep 17 00:00:00 2001 From: myshevts Date: Wed, 24 Nov 2021 11:47:24 +0300 Subject: [PATCH] fixed the DO test --- .../single_layer_tests/detection_output.hpp | 3 +++ .../src/single_layer/detection_output.cpp | 23 +++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/detection_output.hpp b/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/detection_output.hpp index fa5f0f8214c..ccc7f2e806d 100644 --- a/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/detection_output.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/single_layer_tests/detection_output.hpp @@ -12,4 +12,7 @@ TEST_P(DetectionOutputLayerTest, CompareWithRefs) { Run(); }; +TEST_P(DetectionOutputLayerTestWithAutoBatching, CompareWithRefs) { + Run(); +}; } // namespace LayerTestsDefinitions diff --git a/inference-engine/tests/functional/shared_test_classes/src/single_layer/detection_output.cpp b/inference-engine/tests/functional/shared_test_classes/src/single_layer/detection_output.cpp index 1d95dfaa8b6..c11a0fb262a 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/single_layer/detection_output.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/single_layer/detection_output.cpp @@ -27,6 +27,10 @@ std::string DetectionOutputLayerTest::getTestCaseName(const testing::TestParamIn inShapes.resize(3); } + for (size_t i = 0; i < inShapes.size(); i++) { + inShapes[i][0] = batch; + } + std::ostringstream result; result << "IS = { "; result << "LOC=" << CommonTestUtils::vec2str(inShapes[0]) << "_"; @@ -144,7 +148,6 @@ void DetectionOutputLayerTest::SetUp() { auto params = ngraph::builder::makeParams(ngraph::element::f32, inShapes); auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(params)); - auto detOut = ngraph::builder::makeDetectionOutput(paramOuts, attrs); ngraph::ResultVector results{std::make_shared(detOut)}; function = std::make_shared(results, params, "DetectionOutput"); @@ -158,10 +161,9 @@ void DetectionOutputLayerTestWithAutoBatching::SetUp() { DetectionOutputAttributes commonAttrs; ParamsWhichSizeDepends specificAttrs; size_t batch; - std::string device; std::tie(commonAttrs, specificAttrs, batch, attrs.objectness_score, targetDevice) = this->GetParam(); //creating the Auto-batching device with the specific batch size - targetDevice = std::string(CommonTestUtils::DEVICE_BATCH) + ":" + device + "(" + std::to_string(batch) + ")"; + targetDevice = std::string(CommonTestUtils::DEVICE_BATCH) + ":" + targetDevice + "(" + std::to_string(batch) + ")"; std::tie(attrs.num_classes, attrs.background_label_id, attrs.top_k, attrs.keep_top_k, attrs.code_type, attrs.nms_threshold, attrs.confidence_threshold, attrs.clip_after_nms, attrs.clip_before_nms, attrs.decrease_label_id) = commonAttrs; @@ -174,18 +176,19 @@ void DetectionOutputLayerTestWithAutoBatching::SetUp() { inShapes.resize(3); } + for (size_t i = 0; i < inShapes.size(); i++) { + inShapes[i][0] = 1; //auto-batching will do the batching transparently + } + + // adding Eltwise so that we can tests Auto-Batching's HETERO code-path that splits the DetectionOutput and the rest of the network auto params = ngraph::builder::makeParams(ngraph::element::f32, inShapes); auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(params)); - - // no-op with Eltwise that adds zeros - // (so that we can tests Auto-Batching's HETERO code-path that splits the DetectionOutput and the rest of the network) ngraph::OutputVector outs; for (int i = 0; i < inShapes.size(); i++) { auto shape = inShapes[i]; - auto memory_constant = ngraph::builder::makeConstant(ngraph::element::f32, shape, - std::vector(0, ngraph::shape_size(shape))); - auto values = std::make_shared(memory_constant, "memory"); - auto add = ngraph::builder::makeEltwise(paramOuts[i], values, ngraph::helpers::EltwiseTypes::ADD); + auto p = std::make_shared(ngraph::element::f32, ngraph::Shape{shape}); + auto add = ngraph::builder::makeEltwise(paramOuts[i], p , ngraph::helpers::EltwiseTypes::ADD); + params.push_back(p); outs.push_back(add->output(0)); } auto detOut = ngraph::builder::makeDetectionOutput(outs, attrs);