[CPU]Adaptive pooling dynamic shape support (#8703)
This commit is contained in:
@@ -23,10 +23,6 @@ using namespace mkldnn::impl::cpu::x64;
|
||||
|
||||
bool MKLDNNAdaptivePoolingNode::isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op, std::string& errorMessage) noexcept {
|
||||
try {
|
||||
if (isDynamicNgraphNode(op)) {
|
||||
errorMessage = "Doesn't support op with dynamic shapes";
|
||||
return false;
|
||||
}
|
||||
if (one_of(op->get_type_info(), ngraph::op::v8::AdaptiveAvgPool::get_type_info_static())) {
|
||||
auto adaPool = std::dynamic_pointer_cast<const ngraph::opset8::AdaptiveAvgPool>(op);
|
||||
if (!adaPool) {
|
||||
@@ -63,6 +59,7 @@ MKLDNNAdaptivePoolingNode::MKLDNNAdaptivePoolingNode(const std::shared_ptr<ngrap
|
||||
algorithm = Algorithm::AdaptivePoolingMax;
|
||||
}
|
||||
spatialDimsCount = getInputShapeAtPort(0).getRank() - 2;
|
||||
spatialDimsValue.resize(spatialDimsCount);
|
||||
}
|
||||
|
||||
void MKLDNNAdaptivePoolingNode::getSupportedDescriptors() {
|
||||
@@ -74,12 +71,9 @@ void MKLDNNAdaptivePoolingNode::getSupportedDescriptors() {
|
||||
if (getChildEdges().size() != (algorithm == AdaptivePoolingMax ? 2 : 1))
|
||||
IE_THROW() << errorPrefix << "has incorrect number of output edges: " << getParentEdges().size();
|
||||
|
||||
auto parentDims = getInputShapeAtPort(0).getStaticDims();
|
||||
auto childDims = getOutputShapeAtPort(0).getStaticDims();
|
||||
|
||||
spatialDimsCount = parentDims.size() - 2;
|
||||
auto srcRank = getInputShapeAtPort(0).getRank();
|
||||
if (!one_of(spatialDimsCount, 1, 2, 3)) {
|
||||
IE_THROW() << errorPrefix << "doesn't support 0th input with rank: " << getInputShapeAtPort(0).getRank();
|
||||
IE_THROW() << errorPrefix << "doesn't support 0th input with rank: " << srcRank;
|
||||
}
|
||||
|
||||
if (getInputShapeAtPort(1).getRank() != 1) {
|
||||
@@ -91,6 +85,35 @@ void MKLDNNAdaptivePoolingNode::getSupportedDescriptors() {
|
||||
}
|
||||
}
|
||||
|
||||
bool MKLDNNAdaptivePoolingNode::needShapeInfer() const {
|
||||
const auto newSpatialDimsPtr = reinterpret_cast<int32_t *>(getParentEdgesAtPort(1)[0]->getMemoryPtr()->GetPtr());
|
||||
for (size_t i = 0; i < spatialDimsCount; i++) {
|
||||
if (spatialDimsValue[i] != newSpatialDimsPtr[i])
|
||||
return true;
|
||||
}
|
||||
return MKLDNNNode::needShapeInfer();
|
||||
}
|
||||
|
||||
std::vector<VectorDims> MKLDNNAdaptivePoolingNode::shapeInfer() const {
|
||||
const auto inputDims = getParentEdgesAtPort(0)[0]->getMemory().GetShape().getStaticDims();
|
||||
const auto spatialDims = getParentEdgesAtPort(1)[0]->getMemory().GetShape().getStaticDims();
|
||||
const auto inputRank = inputDims.size();
|
||||
const auto spatialDimsSize = spatialDims[0];
|
||||
|
||||
VectorDims outputDims(inputRank);
|
||||
outputDims[0] = inputDims[0];
|
||||
outputDims[1] = inputDims[1];
|
||||
auto newSpatialDimsPtr = reinterpret_cast<int32_t *>(getParentEdgesAtPort(1)[0]->getMemoryPtr()->GetPtr());
|
||||
for (size_t i = 0; i < spatialDimsSize; i++) {
|
||||
outputDims[i + 2] = newSpatialDimsPtr[i];
|
||||
spatialDimsValue[i] = newSpatialDimsPtr[i];
|
||||
}
|
||||
|
||||
std::vector<VectorDims> result = {};
|
||||
result.resize(outputShapes.size(), outputDims);
|
||||
return result;
|
||||
}
|
||||
|
||||
void MKLDNNAdaptivePoolingNode::initSupportedPrimitiveDescriptors() {
|
||||
if (!supportedPrimitiveDescriptors.empty())
|
||||
return;
|
||||
@@ -104,7 +127,8 @@ void MKLDNNAdaptivePoolingNode::initSupportedPrimitiveDescriptors() {
|
||||
config.outConfs.resize((algorithm == Algorithm::AdaptivePoolingAvg ? 1 : 2));
|
||||
|
||||
std::vector<LayoutType> dataFormats{ LayoutType::ncsp };
|
||||
if (getInputShapeAtPort(0).getStaticDims()[1] != 1) {
|
||||
const auto &inDims = getInputShapeAtPort(0).getDims();
|
||||
if (inDims[1] != Shape::UNDEFINED_DIM && inDims[1] != 1) {
|
||||
dataFormats.push_back(LayoutType::nspc);
|
||||
dataFormats.push_back(LayoutType::nCsp16c);
|
||||
dataFormats.push_back(LayoutType::nCsp8c);
|
||||
|
||||
@@ -26,10 +26,17 @@ public:
|
||||
|
||||
private:
|
||||
int spatialDimsCount;
|
||||
mutable std::vector<Dim> spatialDimsValue = {};
|
||||
InferenceEngine::Precision precision = InferenceEngine::Precision::FP32;
|
||||
inline void setBinBorders(size_t *startPtr, size_t *endPtr, size_t idx, size_t inputLength, size_t outputLength);
|
||||
|
||||
std::string errorPrefix;
|
||||
|
||||
protected:
|
||||
bool needShapeInfer() const override;
|
||||
std::vector<VectorDims> shapeInfer() const override;
|
||||
bool needPrepareParams() const override { return false; };
|
||||
void executeDynamicImpl(mkldnn::stream strm) override { execute(strm); };
|
||||
};
|
||||
|
||||
} // namespace MKLDNNPlugin
|
||||
|
||||
@@ -2,53 +2,65 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <functional_test_utils/ov_tensor_utils.hpp>
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
#include "test_utils/cpu_test_utils.hpp"
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
#include "ngraph_functions/utils/ngraph_helpers.hpp"
|
||||
|
||||
using namespace InferenceEngine;
|
||||
using namespace CPUTestUtils;
|
||||
using namespace ov::test;
|
||||
|
||||
namespace CPULayerTestsDefinitions {
|
||||
namespace {
|
||||
std::vector<int> pooledSpatialShape;
|
||||
std::string mode;
|
||||
std::vector<size_t> inputShape;
|
||||
std::vector<InputShape> inputShape;
|
||||
} // namespace
|
||||
|
||||
typedef std::tuple<
|
||||
using AdaPoolSpecificParams = std::tuple<
|
||||
std::vector<int>, // pooled vector
|
||||
std::vector<size_t> // feature map shape
|
||||
> AdaPoolSpecificParams;
|
||||
std::vector<InputShape>>; // feature map shape
|
||||
|
||||
typedef std::tuple<
|
||||
using AdaPoolLayerTestParams = std::tuple<
|
||||
AdaPoolSpecificParams,
|
||||
std::string, // mode
|
||||
InferenceEngine::Precision, // Net precision
|
||||
LayerTestsUtils::TargetDevice // Device name
|
||||
> AdaPoolLayerTestParams;
|
||||
std::string, // mode
|
||||
bool, // second Input is Constant
|
||||
ElementType, // Net precision
|
||||
TargetDevice>; // Device name
|
||||
|
||||
typedef std::tuple<
|
||||
using AdaPoolLayerCPUTestParamsSet = std::tuple<
|
||||
CPULayerTestsDefinitions::AdaPoolLayerTestParams,
|
||||
CPUSpecificParams> AdaPoolLayerCPUTestParamsSet;
|
||||
CPUSpecificParams>;
|
||||
|
||||
class AdaPoolLayerCPUTest : public testing::WithParamInterface<AdaPoolLayerCPUTestParamsSet>,
|
||||
virtual public LayerTestsUtils::LayerTestsCommon, public CPUTestsBase {
|
||||
virtual public SubgraphBaseTest, public CPUTestsBase {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<AdaPoolLayerCPUTestParamsSet> obj) {
|
||||
CPULayerTestsDefinitions::AdaPoolLayerTestParams basicParamsSet;
|
||||
CPUSpecificParams cpuParams;
|
||||
std::tie(basicParamsSet, cpuParams) = obj.param;
|
||||
std::string td;
|
||||
Precision netPr;
|
||||
ElementType netPr;
|
||||
bool isStatic;
|
||||
AdaPoolSpecificParams adaPar;
|
||||
std::tie(adaPar, mode, netPr, td) = basicParamsSet;
|
||||
std::tie(adaPar, mode, isStatic, netPr, td) = basicParamsSet;
|
||||
std::tie(pooledSpatialShape, inputShape) = adaPar;
|
||||
std::ostringstream result;
|
||||
result << "AdaPoolTest_";
|
||||
result << "IS=" << CommonTestUtils::vec2str(inputShape) << "_";
|
||||
result << "IS=(";
|
||||
for (const auto& shape : inputShape) {
|
||||
result << CommonTestUtils::partialShape2str({shape.first}) << "_";
|
||||
}
|
||||
result << ")_TS=(";
|
||||
for (const auto& shape : inputShape) {
|
||||
for (const auto& item : shape.second) {
|
||||
result << CommonTestUtils::vec2str(item) << "_";
|
||||
}
|
||||
}
|
||||
result << "OS=" << CommonTestUtils::vec2str(pooledSpatialShape) << "(spat.)_";
|
||||
result << netPr.name() << "_";
|
||||
result << netPr << "_";
|
||||
result << mode << "_";
|
||||
result << CPUTestsBase::getTestCaseName(cpuParams) << "_";
|
||||
result << std::to_string(obj.index);
|
||||
@@ -62,31 +74,103 @@ protected:
|
||||
std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
|
||||
|
||||
CPULayerTestsDefinitions::AdaPoolSpecificParams adaPoolParams;
|
||||
auto netPrecision = InferenceEngine::Precision::UNSPECIFIED;
|
||||
std::tie(adaPoolParams, mode, netPrecision, targetDevice) = basicParamsSet;
|
||||
inPrc = outPrc = netPrecision;
|
||||
std::tie(pooledSpatialShape, inputShape) = adaPoolParams;
|
||||
ElementType netPrecision;
|
||||
bool isStatic;
|
||||
std::tie(adaPoolParams, mode, isStatic, netPrecision, targetDevice) = basicParamsSet;
|
||||
std::tie(pooledVector, inputShape) = adaPoolParams;
|
||||
|
||||
ngraph::Shape coordsShape = {pooledSpatialShape.size() };
|
||||
auto pooledParam = ngraph::builder::makeConstant<int32_t>(ngraph::element::i32, coordsShape, pooledSpatialShape);
|
||||
auto params = ngraph::builder::makeParams(ngraph::element::f32, {inputShape});
|
||||
|
||||
// we cannot create abstract Op to use polymorphism
|
||||
auto adapoolMax = std::make_shared<ngraph::opset8::AdaptiveMaxPool>(params[0], pooledParam, ngraph::element::i32);
|
||||
adapoolMax->get_rt_info() = getCPUInfo();
|
||||
auto adapoolAvg = std::make_shared<ngraph::opset8::AdaptiveAvgPool>(params[0], pooledParam);
|
||||
adapoolAvg->get_rt_info() = getCPUInfo();
|
||||
init_input_shapes(inputShape);
|
||||
if (!isStatic) {
|
||||
for (auto &target : targetStaticShapes) {
|
||||
target.push_back({pooledVector.size()});
|
||||
}
|
||||
}
|
||||
|
||||
selectedType = std::string("unknown_FP32");
|
||||
threshold = 1e-2;
|
||||
function = (mode == "max" ? std::make_shared<ngraph::Function>(adapoolMax->outputs(), params, "AdaPoolMax") :
|
||||
std::make_shared<ngraph::Function>(adapoolAvg->outputs(), params, "AdaPoolAvg"));
|
||||
if (netPrecision == ElementType::bf16) {
|
||||
rel_threshold = 1e-2;
|
||||
}
|
||||
function = createFunction(isStatic);
|
||||
}
|
||||
|
||||
void generatePooledVector() {
|
||||
std::random_device rd;
|
||||
std::uniform_int_distribution<int32_t> distribution(1, 5);
|
||||
for (int i = 0; i < pooledVector.size(); i++) {
|
||||
pooledVector[i] = distribution(rd);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<ngraph::Function> createFunction(bool secondInputConst) {
|
||||
auto params = ngraph::builder::makeDynamicParams(ngraph::element::f32, { inputDynamicShapes[0] });
|
||||
params.front()->set_friendly_name("ParamsInput");
|
||||
std::shared_ptr<ov::Node> secondInput;
|
||||
if (secondInputConst) {
|
||||
secondInput = ngraph::op::Constant::create(ngraph::element::i32, ngraph::Shape{pooledVector.size()}, pooledVector);
|
||||
} else {
|
||||
auto pooledParam = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::i32, ngraph::Shape{pooledVector.size()});
|
||||
pooledParam->set_friendly_name("ParamSecondInput");
|
||||
params.push_back(pooledParam);
|
||||
secondInput = pooledParam;
|
||||
}
|
||||
|
||||
auto adapoolMax = std::make_shared<ngraph::opset8::AdaptiveMaxPool>(params[0], secondInput, ngraph::element::i32);
|
||||
adapoolMax->get_rt_info() = getCPUInfo();
|
||||
auto adapoolAvg = std::make_shared<ngraph::opset8::AdaptiveAvgPool>(params[0], secondInput);
|
||||
adapoolAvg->get_rt_info() = getCPUInfo();
|
||||
|
||||
auto function = (mode == "max" ? std::make_shared<ngraph::Function>(adapoolMax->outputs(), params, "AdaPoolMax") :
|
||||
std::make_shared<ngraph::Function>(adapoolAvg->outputs(), params, "AdaPoolAvg"));
|
||||
return function;
|
||||
}
|
||||
|
||||
void init_ref_function(std::shared_ptr<ov::Function> &funcRef, const std::vector<ov::Shape>& targetInputStaticShapes) override {
|
||||
if (function->get_parameters().size() == 2) {
|
||||
generatePooledVector();
|
||||
funcRef = createFunction(true);
|
||||
}
|
||||
ngraph::helpers::resize_function(funcRef, targetInputStaticShapes);
|
||||
}
|
||||
|
||||
void validate() override {
|
||||
if (function->get_parameters().size() == 2) {
|
||||
auto pos = std::find_if(inputs.begin(), inputs.end(),
|
||||
[](const std::pair<std::shared_ptr<ov::Node>, ov::runtime::Tensor> ¶ms) {
|
||||
return params.first->get_friendly_name() == "ParamSecondInput";
|
||||
});
|
||||
IE_ASSERT(pos != inputs.end());
|
||||
inputs.erase(pos);
|
||||
}
|
||||
SubgraphBaseTest::validate();
|
||||
}
|
||||
|
||||
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override {
|
||||
inputs.clear();
|
||||
const auto& funcInputs = function->inputs();
|
||||
for (int i = 0; i < funcInputs.size(); ++i) {
|
||||
const auto& funcInput = funcInputs[i];
|
||||
ov::runtime::Tensor tensor;
|
||||
|
||||
if (i == 1) {
|
||||
tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i]);
|
||||
auto *dataPtr = tensor.data<int32_t>();
|
||||
for (size_t i = 0; i < pooledVector.size(); i++) {
|
||||
dataPtr[i] = pooledVector[i];
|
||||
}
|
||||
} else {
|
||||
tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 2560, 0, 256);
|
||||
}
|
||||
inputs.insert({funcInput.get_node_shared_ptr(), tensor});
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<int> pooledVector;
|
||||
};
|
||||
|
||||
TEST_P(AdaPoolLayerCPUTest, CompareWithRefs) {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||
Run();
|
||||
run();
|
||||
CheckPluginRelatedResults(executableNetwork, "AdaptivePooling");
|
||||
}
|
||||
|
||||
@@ -151,9 +235,9 @@ std::vector<CPUSpecificParams> filterCPUInfoForDevice(std::string dims = "3D", s
|
||||
return resCPUParams;
|
||||
}
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::BF16
|
||||
const std::vector<ElementType> netPrecisions = {
|
||||
ElementType::f32,
|
||||
ElementType::bf16
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int>> pooled3DVector = {
|
||||
@@ -173,24 +257,36 @@ const std::vector<std::vector<int>> pooled5DVector = {
|
||||
{ 3, 5, 3 },
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> input3DShapeVector = {
|
||||
SizeVector({ 1, 17, 3 }),
|
||||
SizeVector({ 3, 17, 5 }),
|
||||
std::vector<std::vector<ov::Shape>> staticInput3DShapeVector = {{{1, 17, 3}, {3, 7, 5}}};
|
||||
|
||||
const std::vector<std::vector<InputShape>> input3DShapeVector = {
|
||||
{
|
||||
{{{-1, 17, -1}, {{1, 17, 3}, {3, 17, 5}, {3, 17, 5}}}},
|
||||
{{{{1, 10}, 20, {1, 10}}, {{1, 20, 5}, {2, 20, 4}, {3, 20, 6}}}}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> input4DShapeVector = {
|
||||
SizeVector({ 1, 3, 1, 1 }),
|
||||
SizeVector({ 3, 17, 5, 2 }),
|
||||
std::vector<std::vector<ov::Shape>> staticInput4DShapeVector = {{{1, 3, 1, 1}, {3, 17, 5, 2}}};
|
||||
|
||||
const std::vector<std::vector<InputShape>> input4DShapeVector = {
|
||||
{
|
||||
{{{-1, 3, -1, -1}, {{1, 3, 1, 1}, {3, 3, 5, 2}, {3, 3, 5, 2}}}},
|
||||
{{{{1, 10}, 3, {1, 10}, {1, 10}}, {{2, 3, 10, 6}, {3, 3, 6, 5}, {3, 3, 6, 5}}}}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> input5DShapeVector = {
|
||||
SizeVector({ 1, 17, 2, 5, 2 }),
|
||||
SizeVector({ 3, 17, 4, 5, 4 }),
|
||||
std::vector<std::vector<ov::Shape>> staticInput5DShapeVector = {{{ 1, 17, 2, 5, 2}, {3, 17, 4, 5, 4}}};
|
||||
|
||||
const std::vector<std::vector<InputShape>> input5DShapeVector = {
|
||||
{
|
||||
{{{-1, 17, -1, -1, -1}, {{1, 17, 2, 5, 2}, {3, 17, 4, 5, 4}, {3, 17, 4, 5, 4}}}},
|
||||
{{{{1, 10}, 3, {1, 10}, {1, 10}, {1, 10}}, {{3, 3, 2, 5, 2}, {1, 3, 4, 5, 4}, {1, 3, 4, 5, 4}}}}
|
||||
}
|
||||
};
|
||||
|
||||
const auto adaPool3DParams = ::testing::Combine(
|
||||
::testing::ValuesIn(pooled3DVector), // output spatial shape
|
||||
::testing::ValuesIn(input3DShapeVector) // feature map shape
|
||||
::testing::ValuesIn(input3DShapeVector) // feature map shape
|
||||
);
|
||||
|
||||
const auto adaPool4DParams = ::testing::Combine(
|
||||
@@ -203,11 +299,27 @@ const auto adaPool5DParams = ::testing::Combine(
|
||||
::testing::ValuesIn(input5DShapeVector) // feature map shape
|
||||
);
|
||||
|
||||
const auto staticAdaPool3DParams = ::testing::Combine(
|
||||
::testing::ValuesIn(pooled3DVector), // output spatial shape
|
||||
::testing::ValuesIn(static_shapes_to_test_representation(staticInput3DShapeVector)) // feature map shape
|
||||
);
|
||||
|
||||
const auto staticAdaPool4DParams = ::testing::Combine(
|
||||
::testing::ValuesIn(pooled4DVector), // output spatial shape
|
||||
::testing::ValuesIn(static_shapes_to_test_representation(staticInput4DShapeVector)) // feature map shape
|
||||
);
|
||||
|
||||
const auto staticAdaPool5DParams = ::testing::Combine(
|
||||
::testing::ValuesIn(pooled5DVector), // output spatial shape
|
||||
::testing::ValuesIn(static_shapes_to_test_representation(staticInput5DShapeVector)) // feature map shape
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg3DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
adaPool3DParams,
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(false),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("3D", "avg"))),
|
||||
@@ -218,6 +330,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg4DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
adaPool4DParams,
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(false),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("4D", "avg"))),
|
||||
@@ -228,6 +341,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolAvg5DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
adaPool5DParams,
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(false),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("5D", "avg"))),
|
||||
@@ -238,6 +352,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax3DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
adaPool3DParams,
|
||||
::testing::Values("max"),
|
||||
::testing::Values(false),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("3D", "max"))),
|
||||
@@ -248,6 +363,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax4DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
adaPool4DParams,
|
||||
::testing::Values("max"),
|
||||
::testing::Values(false),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("4D", "max"))),
|
||||
@@ -258,22 +374,111 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPoolMax5DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
adaPool5DParams,
|
||||
::testing::Values("max"),
|
||||
::testing::Values(false),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("5D", "max"))),
|
||||
AdaPoolLayerCPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg3DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
staticAdaPool3DParams,
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("3D", "avg"))),
|
||||
AdaPoolLayerCPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg4DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
staticAdaPool4DParams,
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("4D", "avg"))),
|
||||
AdaPoolLayerCPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolAvg5DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
staticAdaPool5DParams,
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("5D", "avg"))),
|
||||
AdaPoolLayerCPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax3DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
staticAdaPool3DParams,
|
||||
::testing::Values("max"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("3D", "max"))),
|
||||
AdaPoolLayerCPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax4DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
staticAdaPool4DParams,
|
||||
::testing::Values("max"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("4D", "max"))),
|
||||
AdaPoolLayerCPUTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_StaticAdaPoolMax5DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
staticAdaPool5DParams,
|
||||
::testing::Values("max"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice("5D", "max"))),
|
||||
AdaPoolLayerCPUTest::getTestCaseName);
|
||||
|
||||
|
||||
// in 1-channel cases {..., 1, 1, 1} shape cannot be correctly resolved on oneDnn level, so it was removed from instances
|
||||
|
||||
const std::vector<std::vector<InputShape>> input3DShape1Channel = {
|
||||
{
|
||||
{{{-1, -1, -1}, {{1, 1, 2}, {1, 1, 2}, {1, 1, 2}}}},
|
||||
{{{{1, 10}, {1, 10}, {1, 10}}, {{1, 1, 2}, {2, 1, 2}, {2, 1, 2}}}}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<InputShape>> input4DShape1Channel = {
|
||||
{
|
||||
{{{-1, -1, -1, -1}, {{1, 1, 1, 2}, {2, 1, 2, 1}, {2, 1, 2, 1}}}},
|
||||
{{{{1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{1, 1, 1, 2}, {1, 1, 1, 2}, {2, 1, 2, 1}}}}
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<InputShape>> input5DShape1Channel = {
|
||||
{
|
||||
{{{-1, -1, -1, -1, -1}, {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 2, 1}}}},
|
||||
{{{{1, 10}, {1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 2, 1}}}}
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg3DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(std::vector<std::vector<int>> {
|
||||
{1}, {2}}),
|
||||
::testing::ValuesIn(std::vector<std::vector<size_t>> {
|
||||
SizeVector{1, 1, 2}, SizeVector{2, 1, 2}})),
|
||||
::testing::ValuesIn(input3DShape1Channel)),
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::Values(CPUSpecificParams{{ncw, x}, {ncw}, {}, {}})),
|
||||
@@ -287,11 +492,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg4DLayoutTest, AdaPoolLayerCPUTest,
|
||||
{1, 1},
|
||||
{2, 2}
|
||||
}),
|
||||
::testing::ValuesIn(std::vector<std::vector<size_t>> {
|
||||
SizeVector{1, 1, 1, 2},
|
||||
SizeVector{2, 1, 2, 1}
|
||||
})),
|
||||
::testing::ValuesIn(input4DShape1Channel)),
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::Values(CPUSpecificParams{{nchw, x}, {nchw}, {}, {}})),
|
||||
@@ -303,9 +506,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Avg5DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(std::vector<std::vector<int>> {
|
||||
{1, 1, 1}, {2, 2, 2}}),
|
||||
::testing::ValuesIn(std::vector<std::vector<size_t>> {
|
||||
SizeVector{1, 1, 1, 1, 2}, SizeVector{2, 1, 1, 2, 1}})),
|
||||
::testing::ValuesIn(input5DShape1Channel)),
|
||||
::testing::Values("avg"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::Values(CPUSpecificParams{{ncdhw, x}, {ncdhw}, {}, {}})),
|
||||
@@ -318,9 +521,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max3DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(std::vector<std::vector<int>> {
|
||||
{1}, {2}}),
|
||||
::testing::ValuesIn(std::vector<std::vector<size_t>> {
|
||||
SizeVector{1, 1, 2}, SizeVector{2, 1, 2}})),
|
||||
::testing::ValuesIn(input3DShape1Channel)),
|
||||
::testing::Values("max"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::Values(CPUSpecificParams{{ncw, x}, {ncw}, {}, {}})),
|
||||
@@ -332,9 +535,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max4DLayoutTest, AdaPoolLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(std::vector<std::vector<int>> {
|
||||
{1, 1}, {2, 2}}),
|
||||
::testing::ValuesIn(std::vector<std::vector<size_t>> {
|
||||
SizeVector{1, 1, 1, 2}, SizeVector{2, 1, 2, 1}})),
|
||||
::testing::ValuesIn(input4DShape1Channel)),
|
||||
::testing::Values("max"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::Values(CPUSpecificParams{{nchw, x}, {nchw}, {}, {}})),
|
||||
@@ -348,11 +551,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_AdaPool_1ch_Max5DLayoutTest, AdaPoolLayerCPUTest,
|
||||
{1, 1, 1},
|
||||
{2, 2, 2}
|
||||
}),
|
||||
::testing::ValuesIn(std::vector<std::vector<size_t>> {
|
||||
SizeVector{1, 1, 1, 1, 2},
|
||||
SizeVector{2, 1, 1, 2, 1}
|
||||
})),
|
||||
::testing::ValuesIn(input5DShape1Channel)),
|
||||
::testing::Values("max"),
|
||||
::testing::Values(true),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||
::testing::Values(CPUSpecificParams{{ncdhw, x}, {ncdhw}, {}, {}})),
|
||||
|
||||
Reference in New Issue
Block a user