diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.cpp index 194ddca390c..3ebc977bc41 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.cpp @@ -13,10 +13,6 @@ using namespace InferenceEngine; bool MKLDNNReorgYoloNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { - if (isDynamicNgraphNode(op)) { - errorMessage = "Doesn't support op with dynamic shapes"; - return false; - } const auto reorgYolo = std::dynamic_pointer_cast(op); if (!reorgYolo) { errorMessage = "Only opset2 ReorgYolo operation is supported"; diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.h index d22147c48e0..c3be7362484 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_reorg_yolo_node.h @@ -18,6 +18,10 @@ public: void createPrimitive() override {}; void execute(mkldnn::stream strm) override; bool created() const override; + bool needPrepareParams() const override { return false; } + void executeDynamicImpl(mkldnn::stream strm) override { + execute(strm); + } static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reorg_yolo.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reorg_yolo.cpp new file mode 100644 index 00000000000..f728d590038 --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/reorg_yolo.cpp @@ -0,0 +1,90 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "functional_test_utils/ov_tensor_utils.hpp" +#include "ngraph_functions/builders.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "test_utils/cpu_test_utils.hpp" + +using namespace InferenceEngine; +using namespace CPUTestUtils; +using namespace ngraph::opset3; +using namespace ov::test; + +namespace CPULayerTestsDefinitions { + +using ReorgYoloCPUParamsTuple = typename std::tuple; // Device + +class ReorgYoloLayerCPUTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { +public: + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + InputShape inputShape; + size_t stride; + ElementType netPrecision; + TargetDevice targetDev; + std::tie(inputShape, stride, netPrecision, targetDev) = obj.param; + std::ostringstream result; + result << "IS=" << CommonTestUtils::partialShape2str({inputShape.first}) << "_"; + for (const auto& item : inputShape.second) { + result << CommonTestUtils::vec2str(item) << "_"; + } + result << "stride=" << stride << "_"; + result << "netPRC=" << netPrecision << "_"; + result << "targetDevice=" << targetDev << "_"; + return result.str(); + } + +protected: + void SetUp() override { + InputShape inputShape; + size_t stride; + ElementType netPrecision; + std::tie(inputShape, stride, netPrecision, targetDevice) = this->GetParam(); + + init_input_shapes({inputShape}); + + auto param = std::make_shared(ngraph::element::f32, inputDynamicShapes[0]); + auto reorg_yolo = std::make_shared(param, stride); + function = std::make_shared(std::make_shared(reorg_yolo), + ngraph::ParameterVector{param}, + "ReorgYolo"); + } +}; + +TEST_P(ReorgYoloLayerCPUTest, CompareWithRefs) { + run(); +}; + +const std::vector inShapesDynamic = { + {{{1, 2}, -1, -1, -1}, {{1, 4, 4, 4}, {1, 8, 4, 4}, {2, 8, 4, 4}}}}; + +const std::vector strides = {2, 3}; + +const std::vector inShapesDynamic2 = {{{{1, 2}, -1, -1, -1}, {{1, 9, 3, 3}}}}; + +const auto testCase_stride2_Dynamic = ::testing::Combine(::testing::ValuesIn(inShapesDynamic), + ::testing::Values(strides[0]), + ::testing::Values(ov::element::f32), + ::testing::Values(CommonTestUtils::DEVICE_CPU)); + +const auto testCase_stride3_Dynamic = ::testing::Combine(::testing::ValuesIn(inShapesDynamic2), + ::testing::Values(strides[1]), + ::testing::Values(ov::element::f32), + ::testing::Values(CommonTestUtils::DEVICE_CPU)); + +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride2_DynamicShape, + ReorgYoloLayerCPUTest, + testCase_stride2_Dynamic, + ReorgYoloLayerCPUTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_TestsReorgYolo_stride3_DynamicShape, + ReorgYoloLayerCPUTest, + testCase_stride3_Dynamic, + ReorgYoloLayerCPUTest::getTestCaseName); + +}; // namespace CPULayerTestsDefinitions diff --git a/src/core/src/op/reorg_yolo.cpp b/src/core/src/op/reorg_yolo.cpp index 68788d72ded..56739f3820f 100644 --- a/src/core/src/op/reorg_yolo.cpp +++ b/src/core/src/op/reorg_yolo.cpp @@ -50,7 +50,8 @@ void op::ReorgYolo::validate_and_infer_types() { } set_output_type(0, input_et, output_shape); } else { - set_output_type(0, input_et, ov::PartialShape::dynamic()); + auto input_shape = get_input_partial_shape(0); + set_output_type(0, input_et, ov::PartialShape::dynamic(input_shape.rank())); } }