[CPU] Eltwise node update and tests (#7892)

* [CPU] Eltwise node update and tests

* comments applied

* WA for setShape for TensorDesc with blocked layout
This commit is contained in:
Maxim Andronov 2021-10-19 13:33:15 +03:00 committed by GitHub
parent bfb092a6d6
commit 7ee322be90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 333 additions and 62 deletions

View File

@ -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());
}

View File

@ -965,6 +965,13 @@ bool MKLDNNEltwiseNode::isSupportedOperation(const std::shared_ptr<const ngraph:
errorMessage = "Doesn't support Eltwise algorithm: " + std::string(op->get_type_name());
return false;
}
if (const auto binOp = std::dynamic_pointer_cast<const ov::op::util::BinaryElementwiseArithmetic>(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<VectorDims> 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();

View File

@ -91,6 +91,7 @@ public:
void createPrimitive() override;
std::vector<VectorDims> shapeInfer() const override;
bool needPrepareParams() const override;
void prepareParams() override;

View File

@ -141,6 +141,17 @@ std::map<std::string, std::string> additional_config;
std::vector<Precision> netPrc = {Precision::BF16, Precision::FP32};
std::vector<CPUSpecificParams> cpuParams_4D = {
CPUSpecificParams({nChw16c, nChw16c}, {nChw16c}, {}, {}),
CPUSpecificParams({nhwc, nhwc}, {nhwc}, {}, {}),
CPUSpecificParams({nchw, nchw}, {nchw}, {}, {})
};
std::vector<CPUSpecificParams> cpuParams_5D = {
CPUSpecificParams({nCdhw16c, nCdhw16c}, {nCdhw16c}, {}, {}),
CPUSpecificParams({ndhwc, ndhwc}, {ndhwc}, {}, {}),
CPUSpecificParams({ncdhw, ncdhw}, {ncdhw}, {}, {})
};
std::vector<std::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>> inShapes_4D = {
{{}, {{{2, 4, 4, 1}}}},
@ -149,12 +160,6 @@ std::vector<std::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector
{{}, {{{2, 17, 5, 1}, {1, 17, 1, 4}}}},
};
std::vector<CPUSpecificParams> 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::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector
{{}, {{{2, 17, 6, 5, 1}, {1, 17, 1, 1, 4}}}},
};
std::vector<CPUSpecificParams> 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<ngraph::helpers::EltwiseTypes> eltwiseOpTypesBinDyn = {
ngraph::helpers::EltwiseTypes::ADD,
ngraph::helpers::EltwiseTypes::MULTIPLY,
ngraph::helpers::EltwiseTypes::SUBTRACT,
ngraph::helpers::EltwiseTypes::SQUARED_DIFF,
};
// ============================================ 4D ============================================
std::vector<std::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>> 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::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>> 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::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>> 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::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>> 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

View File

@ -24,27 +24,35 @@ using FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc;
namespace CPUSubgraphTestsDefinitions {
typedef std::tuple<
std::vector<std::vector<size_t>>, // Input shapes
std::vector<InferenceEngine::Precision>, // Input precisions
std::vector<EltwiseTypes>, // Eltwise operations
bool, // With quantization
std::string // Device name
std::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>, // Input shapes
ngraph::helpers::InputLayerType, // Secondary input type
std::vector<InferenceEngine::Precision>, // Input precisions
std::vector<EltwiseTypes>, // Eltwise operations
bool, // With quantization
std::string // Device name
> EltwiseChainTuple;
class EltwiseChainTest : public testing::WithParamInterface<EltwiseChainTuple>,
virtual public LayerTestsUtils::LayerTestsCommon {
public:
static std::string getTestCaseName(const testing::TestParamInfo<EltwiseChainTuple> &obj) {
std::vector<std::vector<size_t>> inputShapes;
std::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>> inputShapes;
ngraph::helpers::InputLayerType secondaryInputType;
std::vector<InferenceEngine::Precision> inputPrecisions;
std::vector<EltwiseTypes> 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<std::vector<size_t>> inputShapes;
std::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>> inputShapes;
ngraph::helpers::InputLayerType secondaryInputType;
std::vector<InferenceEngine::Precision> inputPrecisions;
std::vector<EltwiseTypes> 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<std::shared_ptr<ngraph::Node>> ngraphInputs;
for (int i = 1; i < inputPrecisions.size(); i++) {
std::vector<float> 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<ngraph::opset1::Parameter>(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<float> 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<size_t> constShape(inputShapes[0].size(), 1);
constShape[1] = inputShapes[0][1];
std::vector<size_t> 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<std::vector<std::vector<size_t>>> 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::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>> 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<InferenceEngine::Precision>> inputPrecisions = {
@ -143,29 +164,28 @@ std::vector<std::vector<EltwiseTypes>> 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<std::vector<std::vector<size_t>>> 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::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>> 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<InferenceEngine::Precision>> inputPrecisionsFQ {
@ -175,11 +195,111 @@ std::vector<std::vector<InferenceEngine::Precision>> 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::pair<std::vector<ngraph::PartialShape>, std::vector<std::vector<ngraph::Shape>>>> 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