diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp index 43b8c7c765c..b3a8b9498aa 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp @@ -749,13 +749,13 @@ void MKLDNNGraph::PullOutputData(BlobMap &out) { auto node = outputMap.second; const MKLDNNMemory& intr_blob = node->getParentEdgeAt(0)->getMemory(); - const auto ext_blob = out.find(name); + auto ext_blob = out.find(name); if (ext_blob == out.end()) { IE_THROW(Unexpected) << "The network outputs do not contain mkldnn graph output node name: \"" << name << "\""; } const auto actualDesc = MemoryDescUtils::convertToTensorDesc(intr_blob.getDesc()); - const auto &expectedDesc = ext_blob->second->getTensorDesc(); + auto &expectedDesc = ext_blob->second->getTensorDesc(); // TODO [NM]: need to create universal reorder which will be detect cases when we really need to use it // WA: for cases when output shape after transformation will be 1x1x1x1 but model output is scalar @@ -773,6 +773,12 @@ void MKLDNNGraph::PullOutputData(BlobMap &out) { if (out[name]->getTensorDesc().getDims() != intr_blob.getStaticDims() && !isScalarOutput) { if (!node->isDynamicNode()) IE_THROW() << "Output blob and node dims mismatch for node with name: \"" << name << "\""; + + // WA: because input/output info initially contains non empty dims, order etc. + // and setDims (called inside setShape) can't correct modify blocked desc for desc with blocked layout + if (expectedDesc.getLayout() == Layout::BLOCKED) { + expectedDesc = TensorDesc(expectedDesc.getPrecision(), expectedDesc.getLayout()); + } out[name]->setShape(intr_blob.getStaticDims()); } diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.cpp index 71f9d9d5162..8f4e35471f5 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.cpp @@ -965,6 +965,13 @@ bool MKLDNNEltwiseNode::isSupportedOperation(const std::shared_ptrget_type_name()); return false; } + if (const auto binOp = std::dynamic_pointer_cast(op)) { + if (binOp->get_autob().m_type != ngraph::op::AutoBroadcastType::NONE && + binOp->get_autob().m_type != ngraph::op::AutoBroadcastType::NUMPY) { + errorMessage = "Doesn't support broadcast type: " + ngraph::as_string(binOp->get_autob().m_type); + return false; + } + } } catch (...) { return false; } @@ -1229,6 +1236,14 @@ void MKLDNNEltwiseNode::initSupportedPrimitiveDescriptors() { currentInBlkDims.resize(inputNum); } +std::vector MKLDNNEltwiseNode::shapeInfer() const { + ov::PartialShape outShape = getParentEdgesAtPort(0)[0]->getMemory().GetShape().toPartialShape(); + for (size_t i = 1; i < getParentEdges().size(); i++) { + ov::PartialShape::broadcast_merge_into(outShape, getParentEdgesAtPort(i)[0]->getMemory().GetShape().toPartialShape(), ov::op::AutoBroadcastSpec::NUMPY); + } + return {outShape.get_shape()}; +} + void MKLDNNEltwiseNode::prepareParams() { if (!inputShapesDefined()) { IE_THROW() << "Can't prepare params for eltwise node with name: " << getName(); diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.h b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.h index 39f34048807..b5a8404cd47 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.h +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_eltwise_node.h @@ -91,6 +91,7 @@ public: void createPrimitive() override; + std::vector shapeInfer() const override; bool needPrepareParams() const override; void prepareParams() override; diff --git a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/eltwise.cpp b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/eltwise.cpp index 1afbf63c6eb..ae799afab93 100644 --- a/inference-engine/tests/functional/plugin/cpu/single_layer_tests/eltwise.cpp +++ b/inference-engine/tests/functional/plugin/cpu/single_layer_tests/eltwise.cpp @@ -141,6 +141,17 @@ std::map additional_config; std::vector netPrc = {Precision::BF16, Precision::FP32}; +std::vector cpuParams_4D = { + CPUSpecificParams({nChw16c, nChw16c}, {nChw16c}, {}, {}), + CPUSpecificParams({nhwc, nhwc}, {nhwc}, {}, {}), + CPUSpecificParams({nchw, nchw}, {nchw}, {}, {}) +}; + +std::vector cpuParams_5D = { + CPUSpecificParams({nCdhw16c, nCdhw16c}, {nCdhw16c}, {}, {}), + CPUSpecificParams({ndhwc, ndhwc}, {ndhwc}, {}, {}), + CPUSpecificParams({ncdhw, ncdhw}, {ncdhw}, {}, {}) +}; std::vector, std::vector>>> inShapes_4D = { {{}, {{{2, 4, 4, 1}}}}, @@ -149,12 +160,6 @@ std::vector, std::vector cpuParams_4D = { - CPUSpecificParams({nChw16c, nChw16c}, {nChw16c}, {}, {}), - CPUSpecificParams({nhwc, nhwc}, {nhwc}, {}, {}), - CPUSpecificParams({nchw, nchw}, {nchw}, {}, {}) -}; - const auto params_4D = ::testing::Combine( ::testing::Combine( ::testing::ValuesIn(inShapes_4D), @@ -194,12 +199,6 @@ std::vector, std::vector cpuParams_5D = { - CPUSpecificParams({nCdhw16c, nCdhw16c}, {nCdhw16c}, {}, {}), - CPUSpecificParams({ndhwc, ndhwc}, {ndhwc}, {}, {}), - CPUSpecificParams({ncdhw, ncdhw}, {ncdhw}, {}, {}) -}; - const auto params_5D = ::testing::Combine( ::testing::Combine( ::testing::ValuesIn(inShapes_5D), @@ -391,5 +390,135 @@ const auto params_5D_1D = ::testing::Combine( INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_1D, EltwiseLayerCPUTest, params_5D_1D, EltwiseLayerCPUTest::getTestCaseName); +std::vector eltwiseOpTypesBinDyn = { + ngraph::helpers::EltwiseTypes::ADD, + ngraph::helpers::EltwiseTypes::MULTIPLY, + ngraph::helpers::EltwiseTypes::SUBTRACT, + ngraph::helpers::EltwiseTypes::SQUARED_DIFF, +}; + +// ============================================ 4D ============================================ +std::vector, std::vector>>> inShapes_4D_dyn_const = { + { + // dynamic + {{-1, {2, -1}, -1, -1}}, + // target + { + {{3, 2, 1, 1}}, + {{3, 2, 5, 1}}, + {{3, 2, 1, 6}}, + {{3, 2, 4, 11}}, + } + }, +}; + +const auto params_4D_dyn_const = ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(inShapes_4D_dyn_const), + ::testing::ValuesIn(eltwiseOpTypesBinInp), + ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), + ::testing::ValuesIn(opTypes), + ::testing::ValuesIn(netPrc), + ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::Values(additional_config)), + ::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D))); + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_dyn_const, EltwiseLayerCPUTest, params_4D_dyn_const, EltwiseLayerCPUTest::getTestCaseName); + +std::vector, std::vector>>> inShapes_4D_dyn_param = { + { + // dynamic + {{-1, {2, -1}, -1, -1}, + {-1, {2, -1}, -1, -1}}, + // target + { + {{3, 2, 1, 1}, {1, 2, 5, 1}}, + {{1, 7, 5, 1}, {3, 7, 1, 10}}, + {{3, 3, 4, 11}, {3, 3, 4, 11}}, + } + }, +}; + +const auto params_4D_dyn_param = ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(inShapes_4D_dyn_param), + ::testing::ValuesIn(eltwiseOpTypesBinDyn), + ::testing::Values(ngraph::helpers::InputLayerType::PARAMETER), + ::testing::ValuesIn(opTypes), + ::testing::ValuesIn(netPrc), + ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::Values(additional_config)), + ::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D))); + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_4D_dyn_param, EltwiseLayerCPUTest::getTestCaseName); + + +// ============================================ 5D ============================================ +std::vector, std::vector>>> inShapes_5D_dyn_const = { + { + // dynamic + {{-1, {2, -1}, -1, -1, -1}}, + // target + { + {{3, 2, 1, 1, 1}}, + {{3, 2, 5, 1, 7}}, + {{3, 2, 1, 6, 1}}, + {{3, 2, 4, 11, 2}}, + } + }, +}; + +const auto params_5D_dyn_const = ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(inShapes_5D_dyn_const), + ::testing::ValuesIn(eltwiseOpTypesBinInp), + ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), + ::testing::ValuesIn(opTypes), + ::testing::ValuesIn(netPrc), + ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::Values(additional_config)), + ::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D))); + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_const, EltwiseLayerCPUTest, params_5D_dyn_const, EltwiseLayerCPUTest::getTestCaseName); + +std::vector, std::vector>>> inShapes_5D_dyn_param = { + { + // dynamic + {{-1, {2, -1}, -1, -1, -1}, + {-1, {2, -1}, -1, -1, -1}}, + // target + { + {{3, 2, 1, 1, 1}, {1, 2, 5, 1, 5}}, + {{1, 7, 5, 1, 12}, {3, 7, 1, 10, 1}}, + {{3, 3, 4, 11, 6}, {3, 3, 4, 11, 6}}, + } + }, +}; + +const auto params_5D_dyn_param = ::testing::Combine( + ::testing::Combine( + ::testing::ValuesIn(inShapes_5D_dyn_param), + ::testing::ValuesIn(eltwiseOpTypesBinDyn), + ::testing::Values(ngraph::helpers::InputLayerType::PARAMETER), + ::testing::ValuesIn(opTypes), + ::testing::ValuesIn(netPrc), + ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(InferenceEngine::Precision::FP32), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::Values(additional_config)), + ::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D))); + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_5D_dyn_param, EltwiseLayerCPUTest::getTestCaseName); + } // namespace } // namespace CPULayerTestsDefinitions diff --git a/inference-engine/tests/functional/plugin/cpu/subgraph_tests/src/eltwise_chain.cpp b/inference-engine/tests/functional/plugin/cpu/subgraph_tests/src/eltwise_chain.cpp index fd10413a926..7601c064d59 100644 --- a/inference-engine/tests/functional/plugin/cpu/subgraph_tests/src/eltwise_chain.cpp +++ b/inference-engine/tests/functional/plugin/cpu/subgraph_tests/src/eltwise_chain.cpp @@ -24,27 +24,35 @@ using FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc; namespace CPUSubgraphTestsDefinitions { typedef std::tuple< - std::vector>, // Input shapes - std::vector, // Input precisions - std::vector, // Eltwise operations - bool, // With quantization - std::string // Device name + std::pair, std::vector>>, // Input shapes + ngraph::helpers::InputLayerType, // Secondary input type + std::vector, // Input precisions + std::vector, // Eltwise operations + bool, // With quantization + std::string // Device name > EltwiseChainTuple; class EltwiseChainTest : public testing::WithParamInterface, virtual public LayerTestsUtils::LayerTestsCommon { public: static std::string getTestCaseName(const testing::TestParamInfo &obj) { - std::vector> inputShapes; + std::pair, std::vector>> inputShapes; + ngraph::helpers::InputLayerType secondaryInputType; std::vector inputPrecisions; std::vector eltwiseOpTypes; bool withQuantization; std::string targetName; - std::tie(inputShapes, inputPrecisions, eltwiseOpTypes, withQuantization, targetName) = obj.param; + std::tie(inputShapes, secondaryInputType, inputPrecisions, eltwiseOpTypes, withQuantization, targetName) = obj.param; std::ostringstream results; - for (int i = 0; i < inputShapes.size(); i++) { - results << "IS" << std::to_string(i) << "=" << CommonTestUtils::vec2str(inputShapes[i]) << "_"; + results << "IS=" << CommonTestUtils::partialShape2str(inputShapes.first) << "_"; + results << "TS="; + for (const auto& shape : inputShapes.second) { + results << "("; + for (const auto& item : shape) { + results << CommonTestUtils::vec2str(item) << "_"; + } + results << ")_"; } for (int i = 0; i < inputPrecisions.size(); i++) { results << "InPRC" << std::to_string(i) << "=" << inputPrecisions[i].name() << "_"; @@ -52,30 +60,45 @@ public: for (int i = 0; i < eltwiseOpTypes.size(); i++) { results << "Op" << std::to_string(i) << "=" << eltwiseOpTypes[i] << "_"; } - + results << "secondaryInputType=" << secondaryInputType << "_"; results << "WithQuant=" << withQuantization << "_"; results << "targetDevice=" << targetName; return results.str(); } + InferenceEngine::Blob::Ptr GenerateInput(const InferenceEngine::InputInfo &info) const override { + return FuncTestUtils::createAndFillBlob(info.getTensorDesc(), 10, 1); + } + protected: void SetUp() override { threshold = 0.1f; - std::vector> inputShapes; + std::pair, std::vector>> inputShapes; + ngraph::helpers::InputLayerType secondaryInputType; std::vector inputPrecisions; std::vector eltwiseOpTypes; bool withQuantization; - std::tie(inputShapes, inputPrecisions, eltwiseOpTypes, withQuantization, targetDevice) = this->GetParam(); + std::tie(inputShapes, secondaryInputType, inputPrecisions, eltwiseOpTypes, withQuantization, targetDevice) = this->GetParam(); - auto ngraphParam = ngraph::builder::makeParams(convertIE2nGraphPrc(inputPrecisions[0]), {inputShapes[0]}); + targetStaticShapes = inputShapes.second; + inputDynamicShapes = inputShapes.first; + ngraph::ParameterVector ngraphParam; std::vector> ngraphInputs; - for (int i = 1; i < inputPrecisions.size(); i++) { - std::vector ngraphInput1Data(ngraph::shape_size(ngraph::Shape{inputShapes[i]})); - ngraphInputs.push_back(ngraph::builder::makeConstant(convertIE2nGraphPrc(inputPrecisions[i]), ngraph::Shape{inputShapes[i]}, - ngraphInput1Data, true)); + if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) { + for (size_t i = 0; i < targetStaticShapes[0].size(); i++) { + ngraphParam.push_back(std::make_shared(convertIE2nGraphPrc(inputPrecisions[i]), targetStaticShapes[0][i])); + ngraphInputs.push_back(ngraphParam.back()); + } + } else { + ngraphParam = ngraph::builder::makeParams(convertIE2nGraphPrc(inputPrecisions[0]), {targetStaticShapes[0][0]}); + for (int i = 1; i < inputPrecisions.size(); i++) { + std::vector ngraphInput1Data(ngraph::shape_size(targetStaticShapes[0][i])); + ngraphInputs.push_back(ngraph::builder::makeConstant(convertIE2nGraphPrc(inputPrecisions[i]), targetStaticShapes[0][i], + ngraphInput1Data, true)); + } } if (withQuantization) { @@ -85,8 +108,8 @@ protected: eltwiseOps.push_back(ngraph::builder::makeEltwise(eltwiseOps[eltwiseOps.size() - 1], ngraphInputs[i], eltwiseOpTypes[i])); } - std::vector constShape(inputShapes[0].size(), 1); - constShape[1] = inputShapes[0][1]; + std::vector constShape(targetStaticShapes[0][0].size(), 1); + constShape[1] = targetStaticShapes[0][0][1]; auto fq = ngraph::builder::makeFakeQuantize(eltwiseOps[eltwiseOps.size() - 1], ::ngraph::element::Type(::ngraph::element::Type_t::f32), 256, constShape); @@ -116,18 +139,16 @@ TEST_P(EltwiseChainTest, CompareWithRefs) { namespace { -std::vector>> inputShapes { - { - {{1, 1, 2, 3}, {1, 1, 2, 3}, {1, 1, 2, 3}, {1, 1, 2, 3}}, - {{1, 48, 5, 6}, {1, 48, 1, 1}, {1, 48, 5, 6}, {1, 1, 5, 6}}, - {{1, 72, 28, 28}, {1, 72, 1, 1}, {1, 72, 1, 1}, {1, 72, 1, 1}}, - {{2, 33, 5, 5}, {2, 33, 5, 5}, {2, 33, 1, 5}, {2, 33, 5, 5}}, - {{1, 2, 3}, {3}, {3}, {3}}, - {{1, 12, 5, 5}, {5, 5}, {12, 5, 5}, {1}}, - {{3, 12, 5, 5}, {1, 12, 5, 1}, {3, 1, 1, 1}, {3, 12, 5, 5}}, - {{1, 1, 1, 1}, {1, 12, 5, 1}, {3, 12, 1, 5}, {3, 12, 5, 1}}, - {{1, 1, 1, 1, 6}, {1, 12, 5, 1, 6}, {3, 12, 1, 5, 1}, {3, 12, 5, 1, 1}} - } +std::vector, std::vector>>> inputShapes = { + { {}, {{{1, 1, 2, 3}, {1, 1, 2, 3}, {1, 1, 2, 3}, {1, 1, 2, 3}}}}, + { {}, {{{1, 48, 5, 6}, {1, 48, 1, 1}, {1, 48, 5, 6}, {1, 1, 5, 6}}}}, + { {}, {{{1, 72, 28, 28}, {1, 72, 1, 1}, {1, 72, 1, 1}, {1, 72, 1, 1}}}}, + { {}, {{{2, 33, 5, 5}, {2, 33, 5, 5}, {2, 33, 1, 5}, {2, 33, 5, 5}}}}, + { {}, {{{1, 2, 3}, {3}, {3}, {3}}}}, + { {}, {{{1, 12, 5, 5}, {5, 5}, {12, 5, 5}, {1}}}}, + { {}, {{{3, 12, 5, 5}, {1, 12, 5, 1}, {3, 1, 1, 1}, {3, 12, 5, 5}}}}, + { {}, {{{1, 1, 1, 1}, {1, 12, 5, 1}, {3, 12, 1, 5}, {3, 12, 5, 1}}}}, + { {}, {{{1, 1, 1, 1, 6}, {1, 12, 5, 1, 6}, {3, 12, 1, 5, 1}, {3, 12, 5, 1, 1}}}} }; std::vector> inputPrecisions = { @@ -143,29 +164,28 @@ std::vector> eltwiseOps = { INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChain, EltwiseChainTest, ::testing::Combine( ::testing::ValuesIn(inputShapes), + ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), ::testing::ValuesIn(inputPrecisions), ::testing::ValuesIn(eltwiseOps), ::testing::Values(false), ::testing::Values(CommonTestUtils::DEVICE_CPU)), EltwiseChainTest::getTestCaseName); -std::vector>> inputShapesFQ { - { - {{1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}}, - {{2, 33, 5, 5}, {2, 33, 5, 5}, {2, 33, 1, 5}, {2, 33, 5, 5}}, - {{2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}}, - {{2, 33, 5, 256}, {2, 33, 5, 256}, {2, 33, 5, 256}, {2, 33, 5, 256}}, - {{2, 5, 7, 5}, {2, 5, 1, 5}, {2, 5, 7, 5}, {2, 5, 7, 5}}, - {{2, 17, 7, 5}, {2, 17, 7, 5}, {2, 17, 7, 5}, {2, 17, 7, 5}}, - {{2, 256, 7, 5}, {2, 256, 7, 5}, {2, 256, 1, 5}, {2, 256, 7, 5}}, - {{1, 36, 34, 34}, {1, 36, 34, 34}, {1, 36, 34, 34}, {1, 36, 34, 34}}, - {{1, 12, 1, 1, 6}, {1, 12, 5, 1, 6}, {3, 12, 1, 5, 1}, {3, 12, 5, 1, 1}}, - {{1, 12, 1, 1, 6}, {1, 12, 5, 5, 6}, {3, 12, 1, 5, 1}, {3, 12, 5, 5, 1}}, - {{1, 12, 1, 1, 1}, {1, 12, 5, 1, 7}, {3, 12, 1, 5, 7}, {3, 12, 5, 1, 7}}, - {{1, 7, 1, 1, 12}, {1, 7, 5, 1, 12}, {3, 7, 1, 5, 12}, {3, 7, 5, 1, 12}}, - {{1, 7, 1, 1, 12, 3, 7}, {1, 7, 5, 1, 12, 3, 7}, {3, 7, 1, 5, 12, 3, 7}, {3, 7, 5, 1, 12, 3, 7}}, - {{1, 7, 1, 1, 12, 3, 1}, {1, 7, 5, 1, 12, 3, 7}, {3, 7, 1, 5, 12, 1, 7}, {3, 7, 5, 1, 12, 3, 1}} - } +std::vector, std::vector>>> inputShapesFQ = { + { {}, {{{1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}}}}, + { {}, {{{2, 33, 5, 5}, {2, 33, 5, 5}, {2, 33, 1, 5}, {2, 33, 5, 5}}}}, + { {}, {{{2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}}}}, + { {}, {{{2, 33, 5, 256}, {2, 33, 5, 256}, {2, 33, 5, 256}, {2, 33, 5, 256}}}}, + { {}, {{{2, 5, 7, 5}, {2, 5, 1, 5}, {2, 5, 7, 5}, {2, 5, 7, 5}}}}, + { {}, {{{2, 17, 7, 5}, {2, 17, 7, 5}, {2, 17, 7, 5}, {2, 17, 7, 5}}}}, + { {}, {{{2, 256, 7, 5}, {2, 256, 7, 5}, {2, 256, 1, 5}, {2, 256, 7, 5}}}}, + { {}, {{{1, 36, 34, 34}, {1, 36, 34, 34}, {1, 36, 34, 34}, {1, 36, 34, 34}}}}, + { {}, {{{1, 12, 1, 1, 6}, {1, 12, 5, 1, 6}, {3, 12, 1, 5, 1}, {3, 12, 5, 1, 1}}}}, + { {}, {{{1, 12, 1, 1, 6}, {1, 12, 5, 5, 6}, {3, 12, 1, 5, 1}, {3, 12, 5, 5, 1}}}}, + { {}, {{{1, 12, 1, 1, 1}, {1, 12, 5, 1, 7}, {3, 12, 1, 5, 7}, {3, 12, 5, 1, 7}}}}, + { {}, {{{1, 7, 1, 1, 12}, {1, 7, 5, 1, 12}, {3, 7, 1, 5, 12}, {3, 7, 5, 1, 12}}}}, + { {}, {{{1, 7, 1, 1, 12, 3, 7}, {1, 7, 5, 1, 12, 3, 7}, {3, 7, 1, 5, 12, 3, 7}, {3, 7, 5, 1, 12, 3, 7}}}}, + { {}, {{{1, 7, 1, 1, 12, 3, 1}, {1, 7, 5, 1, 12, 3, 7}, {3, 7, 1, 5, 12, 1, 7}, {3, 7, 5, 1, 12, 3, 1}}}} }; std::vector> inputPrecisionsFQ { @@ -175,11 +195,111 @@ std::vector> inputPrecisionsFQ { INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChainWithFQ, EltwiseChainTest, ::testing::Combine( ::testing::ValuesIn(inputShapesFQ), + ::testing::Values(ngraph::helpers::InputLayerType::CONSTANT), ::testing::ValuesIn(inputPrecisionsFQ), ::testing::ValuesIn(eltwiseOps), ::testing::Values(true), ::testing::Values(CommonTestUtils::DEVICE_CPU)), EltwiseChainTest::getTestCaseName); +// =============================================== dynamic ============================================== +std::vector, std::vector>>> inputShapes_dyn = { + { + // dynamic + { + {-1, -1, -1}, + {-1}, + {-1}, + {-1} + }, + // target + { + {{1, 2, 3}, {3}, {3}, {3}}, + {{5, 2, 7}, {7}, {1}, {1}}, + {{3, 1, 10}, {1}, {1}, {1}}, + } + }, + { + // dynamic + { + {-1, -1, -1, -1}, + {-1, -1}, + {-1, -1, -1}, + {-1} + }, + // target + { + {{1, 12, 5, 5}, {5, 5}, {12, 5, 5}, {1}}, + {{5, 16, 1, 5}, {1, 5}, {1, 5, 1}, {1}}, + {{2, 1, 1, 5}, {5, 1}, {16, 5, 5}, {5}}, + } + }, + { + // dynamic + { + {-1, -1, -1, -1}, + {-1, -1, -1, -1}, + {-1, -1, -1, -1}, + {-1, -1, -1, -1} + }, + // target + { + {{1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}, {1, 2, 2, 3}}, + {{2, 33, 5, 5}, {2, 33, 5, 5}, {2, 33, 1, 5}, {2, 33, 5, 5}}, + {{2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}, {2, 33, 5, 17}}, + {{2, 33, 5, 256}, {2, 33, 5, 256}, {2, 33, 5, 256}, {2, 33, 5, 256}}, + {{2, 5, 7, 5}, {2, 5, 1, 5}, {2, 5, 7, 5}, {2, 5, 7, 5}}, + {{2, 17, 7, 5}, {2, 17, 7, 5}, {2, 17, 7, 5}, {2, 17, 7, 5}}, + {{2, 256, 7, 5}, {2, 256, 7, 5}, {2, 256, 1, 5}, {2, 256, 7, 5}}, + {{1, 36, 34, 34}, {1, 36, 34, 34}, {1, 36, 34, 34}, {1, 36, 34, 34}} + } + }, + { + // dynamic + { + {-1, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1} + }, + // target + { + {{1, 12, 1, 1, 6}, {1, 12, 5, 1, 6}, {3, 12, 1, 5, 1}, {3, 12, 5, 1, 1}}, + {{1, 12, 1, 1, 6}, {1, 12, 5, 5, 6}, {3, 12, 1, 5, 1}, {3, 12, 5, 5, 1}}, + {{1, 12, 1, 1, 1}, {1, 12, 5, 1, 7}, {3, 12, 1, 5, 7}, {3, 12, 5, 1, 7}}, + {{1, 7, 1, 1, 12}, {1, 7, 5, 1, 12}, {3, 7, 1, 5, 12}, {3, 7, 5, 1, 12}} + } + }, + { + // dynamic + { + {-1, -1, -1, -1, -1, + -1, -1}, + {-1, -1, -1, -1, -1, + -1, -1}, + {-1, -1, -1, -1, -1, + -1, -1}, + {-1, -1, -1, -1, -1, + -1, -1} + }, + // target + { + {{1, 7, 1, 1, 12, 3, 7}, {1, 7, 5, 1, 12, 3, 7}, {3, 7, 1, 5, 12, 3, 7}, {3, 7, 5, 1, 12, 3, 7}}, + {{1, 7, 1, 1, 12, 3, 1}, {1, 7, 5, 1, 12, 3, 7}, {3, 7, 1, 5, 12, 1, 7}, {3, 7, 5, 1, 12, 3, 1}}, + {{5, 7, 1, 2, 12, 1, 8}, {1, 7, 5, 1, 12, 3, 8}, {5, 1, 1, 2, 12, 1, 8}, {1, 7, 5, 1, 12, 3, 1}} + } + } +}; + +INSTANTIATE_TEST_SUITE_P(smoke_EltwiseChain_dyn, EltwiseChainTest, + ::testing::Combine( + ::testing::ValuesIn(inputShapes_dyn), + ::testing::Values(ngraph::helpers::InputLayerType::PARAMETER), + ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(eltwiseOps), + ::testing::Values(false), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + EltwiseChainTest::getTestCaseName); + } // namespace } // namespace CPUSubgraphTestsDefinitions