[CPU] Enable SLT Eltwise tests on ARM (#17713)

This commit is contained in:
Aleksandr Voron 2023-06-05 10:58:12 +02:00 committed by GitHub
parent 3d8a620ac3
commit 0944295d61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1264 additions and 778 deletions

View File

@ -48,7 +48,7 @@ bool AclEltwiseExecutorBuilder::isSupported(const EltwiseAttrs& eltwiseAttrs,
case Algorithm::EltwiseElu:
case Algorithm::EltwiseTanh:
case Algorithm::EltwiseSigmoid:
// case Algorithm::EltwisePowerDynamic: // TODO: ACL version doesn't work https://github.com/ARM-software/ComputeLibrary/issues/1047
// case Algorithm::EltwisePowerDynamic: // TODO: CVS-111880
case Algorithm::EltwiseSoftRelu:
case Algorithm::EltwiseClamp:
case Algorithm::EltwiseSwish: // TODO: CVS-109354: efficientdet-d0 accuracy drops if ACL Swish is used

View File

@ -0,0 +1,416 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "eltwise.hpp"
#include "gtest/gtest.h"
#include "test_utils/cpu_test_utils.hpp"
using namespace InferenceEngine;
using namespace CPUTestUtils;
using namespace ngraph::helpers;
using namespace ov::test;
namespace CPULayerTestsDefinitions {
std::string EltwiseLayerCPUTest::getTestCaseName(testing::TestParamInfo<EltwiseLayerCPUTestParamsSet> obj) {
subgraph::EltwiseTestParams basicParamsSet;
CPUSpecificParams cpuParams;
fusingSpecificParams fusingParams;
std::tie(basicParamsSet, cpuParams, fusingParams) = obj.param;
std::ostringstream result;
result << subgraph::EltwiseLayerTest::getTestCaseName(testing::TestParamInfo<subgraph::EltwiseTestParams>(
basicParamsSet, 0));
result << CPUTestsBase::getTestCaseName(cpuParams);
result << CpuTestWithFusing::getTestCaseName(fusingParams);
return result.str();
}
ov::Tensor EltwiseLayerCPUTest::generate_eltwise_input(const ov::element::Type& type, const ngraph::Shape& shape) {
struct gen_params {
uint32_t range;
int32_t start_from;
int32_t resolution;
gen_params(uint32_t range = 10, int32_t start_from = 0, int32_t resolution = 1)
: range(range), start_from(start_from), resolution(resolution) {}
};
gen_params params = gen_params();
if (type.is_real()) {
switch (eltwiseType) {
case ngraph::helpers::EltwiseTypes::POWER:
case ngraph::helpers::EltwiseTypes::MOD:
case ngraph::helpers::EltwiseTypes::FLOOR_MOD:
params = gen_params(2, 2, 8);
break;
case ngraph::helpers::EltwiseTypes::DIVIDE:
params = gen_params(2, 2, 8);
break;
case ngraph::helpers::EltwiseTypes::ERF:
params = gen_params(6, -3);
break;
default:
params = gen_params(80, 0, 8);
break;
}
} else {
params = gen_params(INT32_MAX, INT32_MIN);
}
return ov::test::utils::create_and_fill_tensor(type, shape, params.range, params.start_from, params.resolution);
}
void EltwiseLayerCPUTest::generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) {
inputs.clear();
const auto& funcInputs = function->inputs();
for (size_t i = 0; i < funcInputs.size(); ++i) {
const auto& funcInput = funcInputs[i];
inputs.insert({funcInput.get_node_shared_ptr(), generate_eltwise_input(funcInput.get_element_type(), targetInputStaticShapes[i])});
}
}
void EltwiseLayerCPUTest::SetUp() {
subgraph::EltwiseTestParams basicParamsSet;
CPUSpecificParams cpuParams;
fusingSpecificParams fusingParams;
std::tie(basicParamsSet, cpuParams, fusingParams) = this->GetParam();
std::vector<InputShape> shapes;
ElementType netType;
ngraph::helpers::InputLayerType secondaryInputType;
CommonTestUtils::OpType opType;
Config additional_config;
std::tie(shapes, eltwiseType, secondaryInputType, opType, netType, inType, outType, targetDevice, configuration) = basicParamsSet;
if (ElementType::bf16 == netType) {
rel_threshold = 2e-2f;
} else if (ElementType::i32 == netType) {
abs_threshold = 0;
}
std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
std::tie(postOpMgrPtr, fusedOps) = fusingParams;
selectedType = makeSelectedTypeStr(getPrimitiveType(), netType);
shapes.resize(2);
switch (opType) {
case CommonTestUtils::OpType::SCALAR: {
std::vector<ngraph::Shape> identityShapes(shapes[0].second.size(), {1});
shapes[1] = {{}, identityShapes};
break;
}
case CommonTestUtils::OpType::VECTOR:
if (shapes[1].second.empty()) {
shapes[1] = shapes[0];
}
break;
default:
FAIL() << "Unsupported Secondary operation type";
}
init_input_shapes(shapes);
configuration.insert(additional_config.begin(), additional_config.end());
auto parameters = ngraph::builder::makeDynamicParams(netType, {inputDynamicShapes.front()});
std::shared_ptr<ngraph::Node> secondaryInput;
if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) {
secondaryInput = ngraph::builder::makeDynamicParams(netType, {inputDynamicShapes.back()}).front();
parameters.push_back(std::dynamic_pointer_cast<ngraph::opset3::Parameter>(secondaryInput));
} else {
auto pShape = inputDynamicShapes.back();
ngraph::Shape shape;
if (pShape.is_static()) {
shape = pShape.get_shape();
} else {
ASSERT_TRUE(pShape.rank().is_static());
shape = std::vector<size_t>(pShape.rank().get_length(), 1);
for (size_t i = 0; i < pShape.size(); ++i) {
if (pShape[i].is_static()) {
shape[i] = pShape[i].get_length();
}
}
}
if (netType == ElementType::i32) {
auto data_tensor = generate_eltwise_input(ElementType::i32, shape);
auto data_ptr = reinterpret_cast<int32_t*>(data_tensor.data());
std::vector<int32_t> data(data_ptr, data_ptr + ngraph::shape_size(shape));
secondaryInput = ngraph::builder::makeConstant(netType, shape, data);
} else {
auto data_tensor = generate_eltwise_input(ElementType::f32, shape);
auto data_ptr = reinterpret_cast<float*>(data_tensor.data());
std::vector<float> data(data_ptr, data_ptr + ngraph::shape_size(shape));
secondaryInput = ngraph::builder::makeConstant(netType, shape, data);
}
}
auto eltwise = ngraph::builder::makeEltwise(parameters[0], secondaryInput, eltwiseType);
function = makeNgraphFunction(netType, parameters, eltwise, "Eltwise");
}
TEST_P(EltwiseLayerCPUTest, CompareWithRefs) {
run();
CheckPluginRelatedResults(compiledModel, std::set<std::string>{"Eltwise", "Subgraph"});
}
namespace Eltwise {
const ov::AnyMap& additional_config() {
static const ov::AnyMap additional_config;
return additional_config;
}
const std::vector<ElementType>& netType() {
static const std::vector<ElementType> netType = {
ElementType::f32};
return netType;
}
const std::vector<CommonTestUtils::OpType>& opTypes() {
static const std::vector<CommonTestUtils::OpType> opTypes = {
CommonTestUtils::OpType::VECTOR,
};
return opTypes;
}
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesBinInp() {
static const std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesBinInp = {
ngraph::helpers::EltwiseTypes::ADD,
ngraph::helpers::EltwiseTypes::MULTIPLY,
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
ngraph::helpers::EltwiseTypes::SUBTRACT, // TODO: Fix CVS-105430
ngraph::helpers::EltwiseTypes::DIVIDE, // TODO: Fix CVS-105430
ngraph::helpers::EltwiseTypes::FLOOR_MOD, // TODO: Fix CVS-111875
#endif
ngraph::helpers::EltwiseTypes::SQUARED_DIFF,
};
return eltwiseOpTypesBinInp;
}
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesDiffInp() {
static const std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesDiffInp = { // Different number of input nodes depending on optimizations
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
ngraph::helpers::EltwiseTypes::POWER, //TODO: Fix CVS-111880
#endif
// ngraph::helpers::EltwiseTypes::MOD // Does not execute because of transformations
};
return eltwiseOpTypesDiffInp;
}
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesBinDyn() {
static const std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesBinDyn = {
ngraph::helpers::EltwiseTypes::ADD,
ngraph::helpers::EltwiseTypes::MULTIPLY,
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64) // TODO: Fix CVS-105430
ngraph::helpers::EltwiseTypes::SUBTRACT,
#endif
ngraph::helpers::EltwiseTypes::SQUARED_DIFF,
};
return eltwiseOpTypesBinDyn;
}
const std::vector<CPUSpecificParams>& cpuParams_4D() {
static const std::vector<CPUSpecificParams> cpuParams_4D = {
CPUSpecificParams({nhwc, nhwc}, {nhwc}, {}, {}),
CPUSpecificParams({nchw, nchw}, {nchw}, {}, {})
};
return cpuParams_4D;
}
const std::vector<CPUSpecificParams>& cpuParams_5D() {
static const std::vector<CPUSpecificParams> cpuParams_5D = {
CPUSpecificParams({ndhwc, ndhwc}, {ndhwc}, {}, {}),
CPUSpecificParams({ncdhw, ncdhw}, {ncdhw}, {}, {})
};
return cpuParams_5D;
}
const std::vector<std::vector<ov::Shape>>& inShapes_4D() {
static const std::vector<std::vector<ov::Shape>> inShapes_4D = {
{{2, 4, 4, 1}},
{{2, 17, 5, 4}},
{{2, 17, 5, 4}, {1, 17, 1, 1}},
{{2, 17, 5, 1}, {1, 17, 1, 4}},
};
return inShapes_4D;
}
const std::vector<std::vector<ov::Shape>>& inShapes_5D() {
static const std::vector<std::vector<ov::Shape>> inShapes_5D = {
{{2, 4, 3, 4, 1}},
{{2, 17, 7, 5, 4}},
{{2, 17, 6, 5, 4}, {1, 17, 6, 1, 1}},
{{2, 17, 6, 5, 1}, {1, 17, 1, 1, 4}},
};
return inShapes_5D;
}
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesI32() {
static const std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesI32 = {
ngraph::helpers::EltwiseTypes::ADD,
ngraph::helpers::EltwiseTypes::MULTIPLY,
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64) // TODO: Fix CVS-105430
ngraph::helpers::EltwiseTypes::SUBTRACT,
ngraph::helpers::EltwiseTypes::DIVIDE,
#endif
ngraph::helpers::EltwiseTypes::SQUARED_DIFF,
};
return eltwiseOpTypesI32;
}
const std::vector<ngraph::helpers::InputLayerType>& secondaryInputTypes() {
static const std::vector<ngraph::helpers::InputLayerType> secondaryInputTypes = {
ngraph::helpers::InputLayerType::CONSTANT,
ngraph::helpers::InputLayerType::PARAMETER,
};
return secondaryInputTypes;
}
const std::vector<std::vector<ngraph::Shape>>& inShapes_4D_1D() {
static const std::vector<std::vector<ngraph::Shape>> inShapes_4D_1D = {
{{2, 17, 5, 4}, {4}},
{{1, 3, 3, 3}, {3}},
};
return inShapes_4D_1D;
}
const std::vector<CPUSpecificParams> & cpuParams_4D_1D_Constant_mode() {
static const std::vector<CPUSpecificParams> cpuParams_4D_1D_Constant_mode = {
CPUSpecificParams({nhwc, nhwc}, {nhwc}, {}, {}),
CPUSpecificParams({nchw, nchw}, {nchw}, {}, {})
};
return cpuParams_4D_1D_Constant_mode;
}
const std::vector<CPUSpecificParams>& cpuParams_4D_1D_Parameter_mode() {
static const std::vector<CPUSpecificParams> cpuParams_4D_1D_Parameter_mode = {
CPUSpecificParams({nchw, x}, {nchw}, {}, {})
};
return cpuParams_4D_1D_Parameter_mode;
}
const std::vector<std::vector<ngraph::Shape>>& inShapes_5D_1D() {
static const std::vector<std::vector<ngraph::Shape>> inShapes_5D_1D = {
{{2, 17, 5, 4, 10}, {10}},
{{1, 3, 3, 3, 3}, {3}},
};
return inShapes_5D_1D;
}
const std::vector<CPUSpecificParams>& cpuParams_5D_1D_parameter() {
static const std::vector<CPUSpecificParams> cpuParams_5D_1D_parameter = {
CPUSpecificParams({ncdhw, x}, {ncdhw}, {}, {})
};
return cpuParams_5D_1D_parameter;
}
const std::vector<InputShape>& inShapes_4D_dyn_param() {
static const std::vector<InputShape> inShapes_4D_dyn_param = {
{
// dynamic
{-1, {2, 15}, -1, -1},
// target
{
{3, 2, 1, 1},
{1, 7, 5, 1},
{3, 3, 4, 11},
}
},
{
// dynamic
{-1, {2, 25}, -1, -1},
// target
{
{1, 2, 5, 1},
{3, 7, 1, 10},
{3, 3, 4, 11}
}
}
};
return inShapes_4D_dyn_param;
}
const std::vector<InputShape>& inShapes_5D_dyn_param() {
static const std::vector<InputShape> inShapes_5D_dyn_param = {
{
// dynamic
{-1, {2, 15}, -1, -1, -1},
// target
{
{3, 2, 1, 1, 1},
{1, 7, 5, 1, 12},
{3, 3, 4, 11, 6},
}
},
{
// dynamic
{-1, {2, 25}, -1, -1, -1},
// target
{
{1, 2, 5, 1, 5},
{3, 7, 1, 10, 1},
{3, 3, 4, 11, 6}
}
}
};
return inShapes_5D_dyn_param;
}
const std::vector<InputShape>& inShapes_5D_dyn_const() {
static const std::vector<InputShape> inShapes_5D_dyn_const = {
{
// dynamic
{3, 2, -1, -1, -1},
// target
{
{3, 2, 1, 1, 1},
{3, 2, 5, 1, 7},
{3, 2, 1, 6, 1},
{3, 2, 4, 11, 2},
}
},
};
return inShapes_5D_dyn_const;
}
const std::vector<std::vector<InputShape>>& inShapes_4D_dyn_const() {
static const std::vector<std::vector<InputShape>> inShapes_4D_dyn_const = {
{
{
// dynamic
{3, 2, -1, -1},
// target
{
{3, 2, 1, 1},
{3, 2, 5, 1},
{3, 2, 1, 6},
{3, 2, 4, 11},
}
}
},
{
{
// dynamic
{{1, 10}, 2, 5, 6},
// target
{
{3, 2, 5, 6},
{1, 2, 5, 6},
{2, 2, 5, 6},
}
}
},
};
return inShapes_4D_dyn_const;
}
const std::vector<CPUSpecificParams>& cpuParams_5D_1D_constant() {
static const std::vector<CPUSpecificParams> cpuParams_5D_1D_constant = {
CPUSpecificParams({ndhwc, ndhwc}, {ndhwc}, {}, {}),
CPUSpecificParams({ncdhw, ncdhw}, {ncdhw}, {}, {})
};
return cpuParams_5D_1D_constant;
}
} // namespace Eltwise
} // namespace CPULayerTestsDefinitions

View File

@ -0,0 +1,71 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include "shared_test_classes/single_layer/eltwise.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
#include <common_test_utils/ov_tensor_utils.hpp>
#include "test_utils/fusing_test_utils.hpp"
#include "test_utils/cpu_test_utils.hpp"
#include "gtest/gtest.h"
using namespace CPUTestUtils;
using namespace ov::test;
namespace CPULayerTestsDefinitions {
typedef std::tuple<
subgraph::EltwiseTestParams,
CPUSpecificParams,
fusingSpecificParams> EltwiseLayerCPUTestParamsSet;
class EltwiseLayerCPUTest : public testing::WithParamInterface<EltwiseLayerCPUTestParamsSet>,
virtual public SubgraphBaseTest, public CPUTestUtils::CpuTestWithFusing {
public:
static std::string getTestCaseName(testing::TestParamInfo<EltwiseLayerCPUTestParamsSet> obj);
protected:
ov::Tensor generate_eltwise_input(const ov::element::Type& type, const ngraph::Shape& shape);
void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) override;
void SetUp() override;
private:
ngraph::helpers::EltwiseTypes eltwiseType;
};
namespace Eltwise {
const ov::AnyMap& additional_config();
const std::vector<ElementType>& netType();
const std::vector<CommonTestUtils::OpType>& opTypes();
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesBinInp();
const std::vector<ngraph::helpers::InputLayerType>& secondaryInputTypes();
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesBinInp();
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesDiffInp();
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesBinDyn();
const std::vector<CPUSpecificParams>& cpuParams_4D();
const std::vector<std::vector<ov::Shape>>& inShapes_4D();
const std::vector<std::vector<InputShape>>& inShapes_4D_dyn_const();
const std::vector<InputShape>& inShapes_4D_dyn_param();
const std::vector<std::vector<ngraph::Shape>>& inShapes_4D_1D();
const std::vector<CPUSpecificParams> & cpuParams_4D_1D_Constant_mode();
const std::vector<CPUSpecificParams>& cpuParams_4D_1D_Parameter_mode();
const std::vector<CPUSpecificParams>& cpuParams_5D();
const std::vector<std::vector<ov::Shape>>& inShapes_5D();
const std::vector<std::vector<ngraph::Shape>>& inShapes_5D_1D();
const std::vector<InputShape>& inShapes_5D_dyn_const();
const std::vector<InputShape>& inShapes_5D_dyn_param();
const std::vector<CPUSpecificParams>& cpuParams_5D_1D_constant();
const std::vector<CPUSpecificParams>& cpuParams_5D_1D_parameter();
const std::vector<ngraph::helpers::EltwiseTypes>& eltwiseOpTypesI32();
} // namespace Eltwise
} // namespace CPULayerTestsDefinitions

View File

@ -1,776 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <shared_test_classes/single_layer/eltwise.hpp>
#include <ngraph_functions/builders.hpp>
#include <common_test_utils/ov_tensor_utils.hpp>
#include "test_utils/fusing_test_utils.hpp"
using namespace InferenceEngine;
using namespace CPUTestUtils;
using namespace ov::test;
namespace CPULayerTestsDefinitions {
typedef std::tuple<
subgraph::EltwiseTestParams,
CPUSpecificParams,
fusingSpecificParams> EltwiseLayerCPUTestParamsSet;
class EltwiseLayerCPUTest : public testing::WithParamInterface<EltwiseLayerCPUTestParamsSet>,
virtual public SubgraphBaseTest, public CpuTestWithFusing {
public:
static std::string getTestCaseName(testing::TestParamInfo<EltwiseLayerCPUTestParamsSet> obj) {
subgraph::EltwiseTestParams basicParamsSet;
CPUSpecificParams cpuParams;
fusingSpecificParams fusingParams;
std::tie(basicParamsSet, cpuParams, fusingParams) = obj.param;
std::ostringstream result;
result << subgraph::EltwiseLayerTest::getTestCaseName(testing::TestParamInfo<subgraph::EltwiseTestParams>(
basicParamsSet, 0));
result << CPUTestsBase::getTestCaseName(cpuParams);
result << CpuTestWithFusing::getTestCaseName(fusingParams);
return result.str();
}
protected:
ov::Tensor generate_eltwise_input(const ov::element::Type& type, const ngraph::Shape& shape) {
struct gen_params {
uint32_t range;
int32_t start_from;
int32_t resolution;
gen_params(uint32_t range = 10, int32_t start_from = 0, int32_t resolution = 1)
: range(range), start_from(start_from), resolution(resolution) {}
};
gen_params params = gen_params();
if (type.is_real()) {
switch (eltwiseType) {
case ngraph::helpers::EltwiseTypes::POWER:
case ngraph::helpers::EltwiseTypes::MOD:
case ngraph::helpers::EltwiseTypes::FLOOR_MOD:
params = gen_params(2, 2, 8);
break;
case ngraph::helpers::EltwiseTypes::DIVIDE:
params = gen_params(2, 2, 8);
break;
case ngraph::helpers::EltwiseTypes::ERF:
params = gen_params(6, -3);
break;
default:
params = gen_params(80, 0, 8);
break;
}
} else {
params = gen_params(INT32_MAX, INT32_MIN);
}
return ov::test::utils::create_and_fill_tensor(type, shape, params.range, params.start_from, params.resolution);
}
void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) override {
inputs.clear();
const auto& funcInputs = function->inputs();
for (size_t i = 0; i < funcInputs.size(); ++i) {
const auto& funcInput = funcInputs[i];
inputs.insert({funcInput.get_node_shared_ptr(), generate_eltwise_input(funcInput.get_element_type(), targetInputStaticShapes[i])});
}
}
void SetUp() override {
subgraph::EltwiseTestParams basicParamsSet;
CPUSpecificParams cpuParams;
fusingSpecificParams fusingParams;
std::tie(basicParamsSet, cpuParams, fusingParams) = this->GetParam();
std::vector<InputShape> shapes;
ElementType netType;
ngraph::helpers::InputLayerType secondaryInputType;
CommonTestUtils::OpType opType;
Config additional_config;
std::tie(shapes, eltwiseType, secondaryInputType, opType, netType, inType, outType, targetDevice, configuration) = basicParamsSet;
if (ElementType::bf16 == netType) {
rel_threshold = 2e-2f;
} else if (ElementType::i32 == netType) {
abs_threshold = 0;
}
std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
std::tie(postOpMgrPtr, fusedOps) = fusingParams;
selectedType = makeSelectedTypeStr(getPrimitiveType(), netType);
shapes.resize(2);
switch (opType) {
case CommonTestUtils::OpType::SCALAR: {
std::vector<ngraph::Shape> identityShapes(shapes[0].second.size(), {1});
shapes[1] = {{}, identityShapes};
break;
}
case CommonTestUtils::OpType::VECTOR:
if (shapes[1].second.empty()) {
shapes[1] = shapes[0];
}
break;
default:
FAIL() << "Unsupported Secondary operation type";
}
init_input_shapes(shapes);
configuration.insert(additional_config.begin(), additional_config.end());
auto parameters = ngraph::builder::makeDynamicParams(netType, {inputDynamicShapes.front()});
std::shared_ptr<ngraph::Node> secondaryInput;
if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) {
secondaryInput = ngraph::builder::makeDynamicParams(netType, {inputDynamicShapes.back()}).front();
parameters.push_back(std::dynamic_pointer_cast<ngraph::opset3::Parameter>(secondaryInput));
} else {
auto pShape = inputDynamicShapes.back();
ngraph::Shape shape;
if (pShape.is_static()) {
shape = pShape.get_shape();
} else {
ASSERT_TRUE(pShape.rank().is_static());
shape = std::vector<size_t>(pShape.rank().get_length(), 1);
for (size_t i = 0; i < pShape.size(); ++i) {
if (pShape[i].is_static()) {
shape[i] = pShape[i].get_length();
}
}
}
if (netType == ElementType::i32) {
auto data_tensor = generate_eltwise_input(ElementType::i32, shape);
auto data_ptr = reinterpret_cast<int32_t*>(data_tensor.data());
std::vector<int32_t> data(data_ptr, data_ptr + ngraph::shape_size(shape));
secondaryInput = ngraph::builder::makeConstant(netType, shape, data);
} else {
auto data_tensor = generate_eltwise_input(ElementType::f32, shape);
auto data_ptr = reinterpret_cast<float*>(data_tensor.data());
std::vector<float> data(data_ptr, data_ptr + ngraph::shape_size(shape));
secondaryInput = ngraph::builder::makeConstant(netType, shape, data);
}
}
auto eltwise = ngraph::builder::makeEltwise(parameters[0], secondaryInput, eltwiseType);
function = makeNgraphFunction(netType, parameters, eltwise, "Eltwise");
}
private:
ngraph::helpers::EltwiseTypes eltwiseType;
};
TEST_P(EltwiseLayerCPUTest, CompareWithRefs) {
run();
CheckPluginRelatedResults(compiledModel, std::set<std::string>{"Eltwise", "Subgraph"});
}
namespace {
std::vector<ngraph::helpers::InputLayerType> secondaryInputTypes = {
ngraph::helpers::InputLayerType::CONSTANT,
ngraph::helpers::InputLayerType::PARAMETER,
};
std::vector<CommonTestUtils::OpType> opTypes = {
CommonTestUtils::OpType::VECTOR,
};
std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesBinInp = {
ngraph::helpers::EltwiseTypes::ADD,
ngraph::helpers::EltwiseTypes::MULTIPLY,
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64) // TODO: Fix CVS-105430
ngraph::helpers::EltwiseTypes::SUBTRACT,
ngraph::helpers::EltwiseTypes::DIVIDE,
#endif
ngraph::helpers::EltwiseTypes::FLOOR_MOD,
ngraph::helpers::EltwiseTypes::SQUARED_DIFF,
};
std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesDiffInp = { // Different number of input nodes depending on optimizations
ngraph::helpers::EltwiseTypes::POWER,
// ngraph::helpers::EltwiseTypes::MOD // Does not execute because of transformations
};
ov::AnyMap additional_config;
std::vector<ElementType> netType = {
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
ElementType::bf16,
#endif
ElementType::f32};
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}, {}, {})
};
const std::vector<fusingSpecificParams> fusingParamsSet{
emptyFusingSpec,
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
// eltwise
fusingSigmoid,
fusingPRelu1D,
// depthwise
fusingReluScaleShift,
// fake quantize
fusingFakeQuantizePerTensorRelu,
fusingFakeQuantizePerChannelRelu,
fusingFQPerChannelSigmoidFQPerTensor
#endif
};
std::vector<std::vector<ov::Shape>> inShapes_4D = {
{{2, 4, 4, 1}},
{{2, 17, 5, 4}},
{{2, 17, 5, 4}, {1, 17, 1, 1}},
{{2, 17, 5, 1}, {1, 17, 1, 4}},
};
const auto params_4D = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D)),
::testing::ValuesIn(eltwiseOpTypesBinInp),
::testing::ValuesIn(secondaryInputTypes),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder, EltwiseLayerCPUTest, params_4D, EltwiseLayerCPUTest::getTestCaseName);
std::vector<std::vector<ov::Shape>> inShapes_4D_fusing = {
{{2, 4, 4, 1}},
{{2, 17, 5, 4}},
{{2, 17, 5, 1}, {1, 17, 1, 4}},
};
const auto params_4D_fusing = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_fusing)),
::testing::ValuesIn(eltwiseOpTypesBinInp),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes),
::testing::Values(ElementType::f32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D)),
::testing::ValuesIn(fusingParamsSet));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Fusing, EltwiseLayerCPUTest, params_4D_fusing, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_emptyCPUSpec = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D)),
::testing::ValuesIn(eltwiseOpTypesDiffInp),
::testing::ValuesIn(secondaryInputTypes),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::Values(emptyCPUSpec),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_emptyCPUSpec, EltwiseLayerCPUTest, params_4D_emptyCPUSpec, EltwiseLayerCPUTest::getTestCaseName);
std::vector<std::vector<ov::Shape>> inShapes_5D = {
{{2, 4, 3, 4, 1}},
{{2, 17, 7, 5, 4}},
{{2, 17, 6, 5, 4}, {1, 17, 6, 1, 1}},
{{2, 17, 6, 5, 1}, {1, 17, 1, 1, 4}},
};
const auto params_5D = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D)),
::testing::ValuesIn(eltwiseOpTypesBinInp),
::testing::ValuesIn(secondaryInputTypes),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder, EltwiseLayerCPUTest, params_5D, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_emptyCPUSpec = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D)),
::testing::ValuesIn(eltwiseOpTypesDiffInp),
::testing::ValuesIn(secondaryInputTypes),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::Values(emptyCPUSpec),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D, EltwiseLayerCPUTest, params_5D_emptyCPUSpec, EltwiseLayerCPUTest::getTestCaseName);
std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesI32 = {
ngraph::helpers::EltwiseTypes::ADD,
ngraph::helpers::EltwiseTypes::MULTIPLY,
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64) // TODO: Fix CVS-105430
ngraph::helpers::EltwiseTypes::SUBTRACT,
ngraph::helpers::EltwiseTypes::DIVIDE,
#endif
ngraph::helpers::EltwiseTypes::SQUARED_DIFF,
};
const std::vector<fusingSpecificParams> fusingParamsSetI32{
emptyFusingSpec,
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
fusingMultiplyAddPerChannel,
#endif
};
const auto params_5D_emptyCPUSpec_I32 = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D)),
::testing::ValuesIn(eltwiseOpTypesI32),
::testing::ValuesIn(secondaryInputTypes),
::testing::ValuesIn(opTypes),
::testing::Values(ElementType::i32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::Values(emptyCPUSpec),
::testing::ValuesIn(fusingParamsSetI32));
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_I32, EltwiseLayerCPUTest, params_5D_emptyCPUSpec_I32, EltwiseLayerCPUTest::getTestCaseName);
#endif
std::vector<std::vector<ov::Shape>> inShapes_4D_Blocked_Planar = {
{{2, 17, 31, 3}, {2, 1, 31, 3}},
{{2, 17, 5, 1}, {2, 1, 1, 4}},
};
std::vector<CPUSpecificParams> cpuParams_4D_Blocked_Planar = {
CPUSpecificParams({nChw16c, nchw}, {nChw16c}, {}, {}),
};
const auto params_4D_Blocked_Planar = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_Blocked_Planar)),
::testing::ValuesIn(eltwiseOpTypesBinInp),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Planar)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Blocked_Planar, EltwiseLayerCPUTest, params_4D_Blocked_Planar, EltwiseLayerCPUTest::getTestCaseName);
std::vector<std::vector<ov::Shape>> inShapes_4D_Planar_Blocked = {
{{2, 1, 31, 3}, {2, 17, 31, 3}},
{{2, 1, 1, 4}, {2, 17, 5, 1}},
};
std::vector<CPUSpecificParams> cpuParams_4D_Planar_Blocked = {
CPUSpecificParams({nchw, nChw16c}, {nChw16c}, {}, {}),
};
const auto params_4D_Planar_Blocked = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_Planar_Blocked)),
::testing::ValuesIn(eltwiseOpTypesBinInp),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Planar_Blocked)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Planar_Blocked, EltwiseLayerCPUTest, params_4D_Planar_Blocked, EltwiseLayerCPUTest::getTestCaseName);
std::vector<std::vector<ov::Shape>> inShapes_5D_Blocked_Planar = {
{{2, 17, 31, 4, 3}, {2, 1, 31, 1, 3}},
{{2, 17, 5, 3, 1}, {2, 1, 1, 3, 4}},
};
std::vector<CPUSpecificParams> cpuParams_5D_Blocked_Planar = {
CPUSpecificParams({nCdhw16c, ncdhw}, {nCdhw16c}, {}, {}),
};
const auto params_5D_Blocked_Planar = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_Blocked_Planar)),
::testing::ValuesIn(eltwiseOpTypesBinInp),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_Blocked_Planar)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_Blocked_Planar, EltwiseLayerCPUTest, params_5D_Blocked_Planar, EltwiseLayerCPUTest::getTestCaseName);
std::vector<std::vector<ngraph::Shape>> inShapes_5D_Planar_Blocked = {
{{2, 1, 31, 1, 3}, {2, 17, 31, 4, 3}},
{{2, 1, 1, 3, 4}, {2, 17, 5, 3, 1}},
};
std::vector<CPUSpecificParams> cpuParams_5D_Planar_Blocked = {
CPUSpecificParams({ncdhw, nCdhw16c}, {nCdhw16c}, {}, {}),
};
const auto params_5D_Planar_Blocked = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_Planar_Blocked)),
::testing::ValuesIn(eltwiseOpTypesBinInp),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_Planar_Blocked)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_Planar_Blocked, EltwiseLayerCPUTest, params_5D_Planar_Blocked, EltwiseLayerCPUTest::getTestCaseName);
std::vector<std::vector<ngraph::Shape>> inShapes_4D_1D = {
{{2, 17, 5, 4}, {4}},
{{1, 3, 3, 3}, {3}},
};
std::vector<CPUSpecificParams> cpuParams_4D_1D_Constant_mode = {
CPUSpecificParams({nChw16c, nchw}, {nChw16c}, {}, {}),
CPUSpecificParams({nhwc, nhwc}, {nhwc}, {}, {}),
CPUSpecificParams({nchw, nchw}, {nchw}, {}, {})
};
const auto params_4D_1D_constant_mode = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_1D)),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_1D_Constant_mode)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_1D_Constant, EltwiseLayerCPUTest, params_4D_1D_constant_mode, EltwiseLayerCPUTest::getTestCaseName);
std::vector<CPUSpecificParams> cpuParams_4D_1D_Parameter_mode = {
CPUSpecificParams({nchw, x}, {nchw}, {}, {})
};
const auto params_4D_1D_parameter_mode = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_1D)),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_1D_Parameter_mode)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_1D_Parameter, EltwiseLayerCPUTest, params_4D_1D_parameter_mode, EltwiseLayerCPUTest::getTestCaseName);
std::vector<std::vector<ngraph::Shape>> inShapes_5D_1D = {
{{2, 17, 5, 4, 10}, {10}},
{{1, 3, 3, 3, 3}, {3}},
};
std::vector<CPUSpecificParams> cpuParams_5D_1D_constant = {
CPUSpecificParams({nCdhw16c, ncdhw}, {nCdhw16c}, {}, {}),
CPUSpecificParams({ndhwc, ndhwc}, {ndhwc}, {}, {}),
CPUSpecificParams({ncdhw, ncdhw}, {ncdhw}, {}, {})
};
const auto params_5D_1D_constant = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_1D)),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_1D_constant)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_1D_Constant, EltwiseLayerCPUTest, params_5D_1D_constant, EltwiseLayerCPUTest::getTestCaseName);
std::vector<CPUSpecificParams> cpuParams_5D_1D_parameter = {
CPUSpecificParams({ncdhw, x}, {ncdhw}, {}, {})
};
const auto params_5D_1D_parameter = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_1D)),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_1D_parameter)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_1D_Parameter, EltwiseLayerCPUTest, params_5D_1D_parameter, EltwiseLayerCPUTest::getTestCaseName);
std::vector<ngraph::helpers::EltwiseTypes> eltwiseOpTypesBinDyn = {
ngraph::helpers::EltwiseTypes::ADD,
ngraph::helpers::EltwiseTypes::MULTIPLY,
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64) // TODO: Fix CVS-105430
ngraph::helpers::EltwiseTypes::SUBTRACT,
#endif
ngraph::helpers::EltwiseTypes::SQUARED_DIFF,
};
//// ============================================ 4D ============================================
std::vector<std::vector<InputShape>> inShapes_4D_dyn_const = {
{
{
// dynamic
{3, 2, -1, -1},
// target
{
{3, 2, 1, 1},
{3, 2, 5, 1},
{3, 2, 1, 6},
{3, 2, 4, 11},
}
}
},
{
{
// dynamic
{{1, 10}, 2, 5, 6},
// target
{
{3, 2, 5, 6},
{1, 2, 5, 6},
{2, 2, 5, 6},
}
}
},
};
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(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_dyn_const, EltwiseLayerCPUTest, params_4D_dyn_const, EltwiseLayerCPUTest::getTestCaseName);
std::vector<InputShape> inShapes_4D_dyn_param = {
{
// dynamic
{-1, {2, 15}, -1, -1},
// target
{
{3, 2, 1, 1},
{1, 7, 5, 1},
{3, 3, 4, 11},
}
},
{
// dynamic
{-1, {2, 25}, -1, -1},
// target
{
{1, 2, 5, 1},
{3, 7, 1, 10},
{3, 3, 4, 11}
}
}
};
const auto params_4D_dyn_param = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_4D_dyn_param),
::testing::ValuesIn(eltwiseOpTypesBinDyn),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_4D_dyn_param, EltwiseLayerCPUTest::getTestCaseName);
std::vector<InputShape> inShapes_4D_dyn_param_fusing = {
{
// dynamic
{-1, 7, -1, -1},
// target
{
{3, 7, 1, 1},
{1, 7, 5, 1},
{3, 7, 1, 1},
{3, 7, 4, 11},
}
},
{
// dynamic
{-1, 7, -1, -1},
// target
{
{1, 7, 5, 1},
{3, 7, 1, 10},
{1, 7, 5, 1},
{3, 7, 4, 11}
}
}
};
const auto params_4D_dyn_param_fusing = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_4D_dyn_param_fusing),
::testing::ValuesIn(eltwiseOpTypesBinDyn),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes),
::testing::Values(ElementType::f32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D)),
::testing::ValuesIn(fusingParamsSet));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_dyn_param_fusing, EltwiseLayerCPUTest, params_4D_dyn_param_fusing, EltwiseLayerCPUTest::getTestCaseName);
//// ============================================ 5D ============================================
std::vector<InputShape> inShapes_5D_dyn_const = {
{
// dynamic
{3, 2, -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::Values(inShapes_5D_dyn_const),
::testing::ValuesIn(eltwiseOpTypesBinInp),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_const, EltwiseLayerCPUTest, params_5D_dyn_const, EltwiseLayerCPUTest::getTestCaseName);
std::vector<InputShape> inShapes_5D_dyn_param = {
{
// dynamic
{-1, {2, 15}, -1, -1, -1},
// target
{
{3, 2, 1, 1, 1},
{1, 7, 5, 1, 12},
{3, 3, 4, 11, 6},
}
},
{
// dynamic
{-1, {2, 25}, -1, -1, -1},
// target
{
{1, 2, 5, 1, 5},
{3, 7, 1, 10, 1},
{3, 3, 4, 11, 6}
}
}
};
const auto params_5D_dyn_param = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_5D_dyn_param),
::testing::ValuesIn(eltwiseOpTypesBinDyn),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes),
::testing::ValuesIn(netType),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config)),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D)),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_5D_dyn_param, EltwiseLayerCPUTest::getTestCaseName);
} // namespace
} // namespace CPULayerTestsDefinitions

View File

@ -0,0 +1,211 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "single_layer_tests/classes/eltwise.hpp"
#include "shared_test_classes/single_layer/eltwise.hpp"
#include "test_utils/cpu_test_utils.hpp"
#include "test_utils/fusing_test_utils.hpp"
using namespace InferenceEngine;
using namespace CPUTestUtils;
using namespace ngraph::helpers;
using namespace ov::test;
namespace CPULayerTestsDefinitions {
namespace Eltwise {
const auto params_4D = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::ValuesIn(secondaryInputTypes()),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder, EltwiseLayerCPUTest, params_4D, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_emptyCPUSpec = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D())),
::testing::ValuesIn(eltwiseOpTypesDiffInp()),
::testing::ValuesIn(secondaryInputTypes()),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::Values(emptyCPUSpec),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_emptyCPUSpec, EltwiseLayerCPUTest, params_4D_emptyCPUSpec, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::ValuesIn(secondaryInputTypes()),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder, EltwiseLayerCPUTest, params_5D, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_emptyCPUSpec = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D())),
::testing::ValuesIn(eltwiseOpTypesDiffInp()),
::testing::ValuesIn(secondaryInputTypes()),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::Values(emptyCPUSpec),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D, EltwiseLayerCPUTest, params_5D_emptyCPUSpec, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_1D_constant_mode = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_1D())),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_1D_Constant_mode())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_1D_Constant, EltwiseLayerCPUTest, params_4D_1D_constant_mode, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_1D_parameter_mode = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_1D())),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_1D_Parameter_mode())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_1D_Parameter, EltwiseLayerCPUTest, params_4D_1D_parameter_mode, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_1D_constant = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_1D())),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_1D_constant())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_1D_Constant, EltwiseLayerCPUTest, params_5D_1D_constant, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_1D_parameter = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_1D())),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_1D_parameter())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_1D_Parameter, EltwiseLayerCPUTest, params_5D_1D_parameter, EltwiseLayerCPUTest::getTestCaseName);
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(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_dyn_const, EltwiseLayerCPUTest, params_4D_dyn_const, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_dyn_param = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_4D_dyn_param()),
::testing::ValuesIn(eltwiseOpTypesBinDyn()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_4D_dyn_param, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_dyn_const = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_5D_dyn_const()),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_const, EltwiseLayerCPUTest, params_5D_dyn_const, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_dyn_param = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_5D_dyn_param()),
::testing::ValuesIn(eltwiseOpTypesBinDyn()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_param, EltwiseLayerCPUTest, params_5D_dyn_param, EltwiseLayerCPUTest::getTestCaseName);
} // namespace Eltwise
} // namespace CPULayerTestsDefinitions

View File

@ -0,0 +1,562 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "single_layer_tests/classes/eltwise.hpp"
#include "shared_test_classes/single_layer/eltwise.hpp"
#include "test_utils/cpu_test_utils.hpp"
#include "test_utils/fusing_test_utils.hpp"
#include <ngraph_functions/builders.hpp>
#include <common_test_utils/ov_tensor_utils.hpp>
using namespace InferenceEngine;
using namespace CPUTestUtils;
using namespace ngraph::helpers;
using namespace ov::test;
namespace CPULayerTestsDefinitions {
namespace Eltwise {
namespace {
const std::vector<ElementType>& netType() {
static const std::vector<ElementType> netType = {
ElementType::bf16};
return netType;
}
const std::vector<InputShape>& inShapes_4D_dyn_param_fusing() {
static const std::vector<InputShape> inShapes_4D_dyn_param_fusing = {
{
// dynamic
{-1, 7, -1, -1},
// target
{
{3, 7, 1, 1},
{1, 7, 5, 1},
{3, 7, 1, 1},
{3, 7, 4, 11},
}
},
{
// dynamic
{-1, 7, -1, -1},
// target
{
{1, 7, 5, 1},
{3, 7, 1, 10},
{1, 7, 5, 1},
{3, 7, 4, 11}
}
}
};
return inShapes_4D_dyn_param_fusing;
}
const std::vector<std::vector<ov::Shape>>& inShapes_4D_Planar_Blocked() {
static const std::vector<std::vector<ov::Shape>> inShapes_4D_Planar_Blocked = {
{{2, 1, 31, 3}, {2, 17, 31, 3}},
{{2, 1, 1, 4}, {2, 17, 5, 1}},
};
return inShapes_4D_Planar_Blocked;
}
const std::vector<std::vector<ov::Shape>>& inShapes_4D_fusing() {
static const std::vector<std::vector<ov::Shape>> inShapes_4D_fusing = {
{{2, 4, 4, 1}},
{{2, 17, 5, 4}},
{{2, 17, 5, 1}, {1, 17, 1, 4}},
};
return inShapes_4D_fusing;
}
const std::vector<std::vector<ov::Shape>>& inShapes_4D_Blocked_Planar() {
static const std::vector<std::vector<ov::Shape>> inShapes_4D_Blocked_Planar = {
{{2, 17, 31, 3}, {2, 1, 31, 3}},
{{2, 17, 5, 1}, {2, 1, 1, 4}},
};
return inShapes_4D_Blocked_Planar;
}
const std::vector<CPUSpecificParams>& cpuParams_4D_Blocked_Blocked() {
static const std::vector<CPUSpecificParams> cpuParams_4D_Blocked_Blocked = {
CPUSpecificParams({nChw16c, nChw16c}, {nChw16c}, {}, {})
};
return cpuParams_4D_Blocked_Blocked;
}
const std::vector<CPUSpecificParams>& cpuParams_4D_Blocked_Planar() {
static const std::vector<CPUSpecificParams> cpuParams_4D_Blocked_Planar = {
CPUSpecificParams({nChw16c, nchw}, {nChw16c}, {}, {})
};
return cpuParams_4D_Blocked_Planar;
}
const std::vector<CPUSpecificParams>& cpuParams_4D_Planar_Blocked() {
static const std::vector<CPUSpecificParams> cpuParams_4D_Planar_Blocked = {
CPUSpecificParams({nchw, nChw16c}, {nChw16c}, {}, {})
};
return cpuParams_4D_Planar_Blocked;
}
const std::vector<CPUSpecificParams>& cpuParams_5D_Blocked_Blocked() {
static const std::vector<CPUSpecificParams> cpuParams_5D_Blocked_Blocked = {
CPUSpecificParams({nCdhw16c, nCdhw16c}, {nCdhw16c}, {}, {})
};
return cpuParams_5D_Blocked_Blocked;
}
const std::vector<std::vector<ov::Shape>>& inShapes_5D_Blocked_Planar() {
static const std::vector<std::vector<ov::Shape>> inShapes_5D_Blocked_Planar = {
{{2, 17, 31, 4, 3}, {2, 1, 31, 1, 3}},
{{2, 17, 5, 3, 1}, {2, 1, 1, 3, 4}},
};
return inShapes_5D_Blocked_Planar;
}
const std::vector<std::vector<ngraph::Shape>>& inShapes_5D_Planar_Blocked() {
static const std::vector<std::vector<ngraph::Shape>> inShapes_5D_Planar_Blocked = {
{{2, 1, 31, 1, 3}, {2, 17, 31, 4, 3}},
{{2, 1, 1, 3, 4}, {2, 17, 5, 3, 1}},
};
return inShapes_5D_Planar_Blocked;
}
const std::vector<CPUSpecificParams>& cpuParams_5D_Blocked_Planar() {
static const std::vector<CPUSpecificParams> cpuParams_5D_Blocked_Planar = {
CPUSpecificParams({nCdhw16c, ncdhw}, {nCdhw16c}, {}, {}),
};
return cpuParams_5D_Blocked_Planar;
}
const std::vector<CPUSpecificParams>& cpuParams_5D_Planar_Blocked() {
static const std::vector<CPUSpecificParams> cpuParams_5D_Planar_Blocked = {
CPUSpecificParams({ncdhw, nCdhw16c}, {nCdhw16c}, {}, {}),
};
return cpuParams_5D_Planar_Blocked;
}
const std::vector<CPUSpecificParams> & cpuParams_4D_1D_Constant_mode_x64() {
static const std::vector<CPUSpecificParams> cpuParams_4D_1D_Constant_mode = {
CPUSpecificParams({nChw16c, nchw}, {nChw16c}, {}, {})
};
return cpuParams_4D_1D_Constant_mode;
}
const std::vector<fusingSpecificParams> fusingParamsSet_x64{
// eltwise
fusingSigmoid,
fusingPRelu1D,
// depthwise
fusingReluScaleShift,
// fake quantize
fusingFakeQuantizePerTensorRelu,
fusingFakeQuantizePerChannelRelu,
fusingFQPerChannelSigmoidFQPerTensor
};
const auto params_4D_Blocked_Blocked = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::ValuesIn(secondaryInputTypes()),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Blocked())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_Blocked_Blocked, EltwiseLayerCPUTest, params_4D_Blocked_Blocked,
EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_fusing = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_fusing())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::Values(ElementType::f32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D())),
::testing::ValuesIn(fusingParamsSet_x64));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Fusing, EltwiseLayerCPUTest, params_4D_fusing, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_fusing_blocked_blocked = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_fusing())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::Values(ElementType::f32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Blocked())),
::testing::ValuesIn(fusingParamsSet_x64));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Fusing_Blocked_Blocked, EltwiseLayerCPUTest, params_4D_fusing_blocked_blocked,
EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_blocked_blocked_fusing = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_fusing())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::Values(ElementType::f32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Blocked())),
::testing::ValuesIn(fusingParamsSet_x64));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Blocked_Blocked_Fusing, EltwiseLayerCPUTest, params_4D_blocked_blocked_fusing,
EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_emptyCPUSpec = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D())),
::testing::ValuesIn(eltwiseOpTypesDiffInp()),
::testing::ValuesIn(secondaryInputTypes()),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::Values(emptyCPUSpec),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_emptyCPUSpec_x64, EltwiseLayerCPUTest, params_4D_emptyCPUSpec, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_Blocked_Blocked = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::ValuesIn(secondaryInputTypes()),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_Blocked_Blocked())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_Blocked_Blocked, EltwiseLayerCPUTest, params_5D_Blocked_Blocked,
EltwiseLayerCPUTest::getTestCaseName);
const std::vector<fusingSpecificParams> fusingParamsSet_I32{
fusingMultiplyAddPerChannel
};
const auto params_5D_emptyCPUSpec_I32 = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D())),
::testing::ValuesIn(eltwiseOpTypesI32()),
::testing::ValuesIn(secondaryInputTypes()),
::testing::ValuesIn(opTypes()),
::testing::Values(ElementType::i32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::Values(emptyCPUSpec),
::testing::ValuesIn(fusingParamsSet_I32));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_I32, EltwiseLayerCPUTest, params_5D_emptyCPUSpec_I32, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_Blocked_Planar = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_Blocked_Planar())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Planar())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Blocked_Planar, EltwiseLayerCPUTest, params_4D_Blocked_Planar, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_Planar_Blocked = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_Planar_Blocked())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Planar_Blocked())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Planar_Blocked, EltwiseLayerCPUTest, params_4D_Planar_Blocked, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_Blocked_Planar = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_Blocked_Planar())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_Blocked_Planar())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_Blocked_Planar, EltwiseLayerCPUTest, params_5D_Blocked_Planar, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_Planar_Blocked = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_Planar_Blocked())),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_Planar_Blocked())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_Planar_Blocked_x64, EltwiseLayerCPUTest, params_5D_Planar_Blocked, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_1D_constant_mode = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_1D())),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_1D_Constant_mode_x64())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_1D_Constant_x64, EltwiseLayerCPUTest, params_4D_1D_constant_mode, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_1D_parameter_mode = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_4D_1D())),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_1D_Parameter_mode())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_1D_Parameter_x64, EltwiseLayerCPUTest, params_4D_1D_parameter_mode, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_1D_constant = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_1D())),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_1D_constant())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_1D_Constant_x64, EltwiseLayerCPUTest, params_5D_1D_constant, EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_1D_parameter = ::testing::Combine(
::testing::Combine(
::testing::ValuesIn(static_shapes_to_test_representation(inShapes_5D_1D())),
::testing::Values(ngraph::helpers::EltwiseTypes::ADD, ngraph::helpers::EltwiseTypes::MULTIPLY),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_1D_parameter())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_1D_Parameter_x64, EltwiseLayerCPUTest, params_5D_1D_parameter, EltwiseLayerCPUTest::getTestCaseName);
//// ============================================ 4D ============================================
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(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_dyn_const_x64, EltwiseLayerCPUTest, params_4D_dyn_const, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_blocked_blocked_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(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Blocked())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Blocked_Blocked_MemOrder_dyn_const_x64, EltwiseLayerCPUTest, params_4D_blocked_blocked_dyn_const,
EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_dyn_param = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_4D_dyn_param()),
::testing::ValuesIn(eltwiseOpTypesBinDyn()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_MemOrder_dyn_param_x64, EltwiseLayerCPUTest, params_4D_dyn_param, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_blocked_blocked_dyn_param = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_4D_dyn_param()),
::testing::ValuesIn(eltwiseOpTypesBinDyn()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Blocked())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_Blocked_Blocked_MemOrder_dyn_param_x64, EltwiseLayerCPUTest, params_4D_blocked_blocked_dyn_param,
EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_dyn_param_fusing = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_4D_dyn_param_fusing()),
::testing::ValuesIn(eltwiseOpTypesBinDyn()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::Values(ElementType::f32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D())),
::testing::ValuesIn(fusingParamsSet_x64));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_dyn_param_fusing, EltwiseLayerCPUTest, params_4D_dyn_param_fusing, EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_dyn_param_fusing_Blocked_Blocked = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_4D_dyn_param_fusing()),
::testing::ValuesIn(eltwiseOpTypesBinDyn()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::Values(ElementType::f32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Blocked())),
::testing::ValuesIn(fusingParamsSet_x64));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_dyn_param_fusing_Blocked_Blocked, EltwiseLayerCPUTest, params_4D_dyn_param_fusing_Blocked_Blocked,
EltwiseLayerCPUTest::getTestCaseName);
const auto params_4D_blocked_blocked_dyn_param_fusing = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_4D_dyn_param_fusing()),
::testing::ValuesIn(eltwiseOpTypesBinDyn()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::Values(ElementType::f32),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_4D_Blocked_Blocked())),
::testing::ValuesIn(fusingParamsSet_x64));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_4D_blocked_blocked_dyn_param_fusing, EltwiseLayerCPUTest, params_4D_blocked_blocked_dyn_param_fusing,
EltwiseLayerCPUTest::getTestCaseName);
//// ============================================ 5D ============================================
const auto params_5D_dyn_const_Blocked_Blocked = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_5D_dyn_const()),
::testing::ValuesIn(eltwiseOpTypesBinInp()),
::testing::Values(ngraph::helpers::InputLayerType::CONSTANT),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_Blocked_Blocked())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_const_Blocked_Blocked, EltwiseLayerCPUTest, params_5D_dyn_const_Blocked_Blocked,
EltwiseLayerCPUTest::getTestCaseName);
const auto params_5D_dyn_param_Blocked_Blocked = ::testing::Combine(
::testing::Combine(
::testing::Values(inShapes_5D_dyn_param()),
::testing::ValuesIn(eltwiseOpTypesBinDyn()),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::ValuesIn(opTypes()),
::testing::ValuesIn(netType()),
::testing::Values(ov::element::undefined),
::testing::Values(ov::element::undefined),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::Values(additional_config())),
::testing::ValuesIn(filterCPUSpecificParams(cpuParams_5D_Blocked_Blocked())),
::testing::Values(emptyFusingSpec));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_5D_MemOrder_dyn_param_Blocked_Blocked, EltwiseLayerCPUTest, params_5D_dyn_param_Blocked_Blocked,
EltwiseLayerCPUTest::getTestCaseName);
} // namespace
} // namespace Eltwise
} // namespace CPULayerTestsDefinitions

View File

@ -59,7 +59,7 @@ function(create_target_per_test_for_directory TEST_DIR TARGET_PREFIX)
file(GLOB_RECURSE LIST_OF_TEST_ARCH_INSTANCES ${TEST_DIR}/instances/arm/${TEST_CLASS_FILE_NAME})
endif()
file(GLOB_RECURSE LIST_OF_TEST_COMMON_INSTANCES ${TEST_DIR}/instances/common/${TEST_CLASS_FILE_NAME})
list(APPEND LIST_OF_TEST_INSTANCES ${LIST_OF_TEST_COMMON_INSTANCES} ${LIST_OF_TEST_ARCH_INSTANCES})
set(LIST_OF_TEST_INSTANCES ${LIST_OF_TEST_COMMON_INSTANCES} ${LIST_OF_TEST_ARCH_INSTANCES})
set(TEST_INSTANCES "${LIST_OF_TEST_INSTANCES}")
set(TEST_TARGET_NAME ${TARGET_PREFIX}_${TEST_CLASS})

View File

@ -3,6 +3,8 @@
//
// NOTE: WILL BE REWORKED (31905)
#pragma once
#include "ngraph_functions/utils/ngraph_helpers.hpp"
#include "common_test_utils/common_utils.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"