[CPU] Fixed dummy shape creation for Pooling (#10147)
This commit is contained in:
@@ -263,7 +263,21 @@ void MKLDNNPoolingNode::getSupportedDescriptors() {
|
||||
if ((inputRank < 3) || (inputRank > 5))
|
||||
IE_THROW() << "Pooling layer. Unsupported mode. Only 3D, 4D and 5D blobs are supported as input.";
|
||||
|
||||
initEffectiveAttributes(MemoryDescUtils::makeDummyShape(parentShape),
|
||||
inShape = MemoryDescUtils::makeDummyShape(parentShape);
|
||||
if (isDynamicNode()) {
|
||||
const auto& origDims = parentShape.getDims();
|
||||
const auto& origMaxDims = parentShape.getMaxDims();
|
||||
|
||||
auto inDims = inShape.getStaticDims();
|
||||
for (size_t i = 0; i < inDims.size() - 2; i++) {
|
||||
if (origDims[i + 2] == Shape::UNDEFINED_DIM) {
|
||||
inDims[i + 2] = std::min<Dim>(origMaxDims[i + 2], std::max<Dim>(inDims[i + 2], kernel[i]));
|
||||
}
|
||||
}
|
||||
inShape = Shape(inDims);
|
||||
}
|
||||
|
||||
initEffectiveAttributes(inShape,
|
||||
MemoryDescUtils::makeDummyShape(childShape));
|
||||
|
||||
if (inputPrecision == Precision::I8 || inputPrecision == Precision::U8) {
|
||||
@@ -428,7 +442,7 @@ std::shared_ptr<pooling_v2_forward::desc> MKLDNNPoolingNode::createDescriptorInt
|
||||
|
||||
void MKLDNNPoolingNode::createDescriptor(const std::vector<MemoryDescPtr> &inputDesc,
|
||||
const std::vector<MemoryDescPtr> &outputDesc) {
|
||||
auto inDesc = inputDesc[0]->isDefined() ? inputDesc[0] : MemoryDescUtils::makeDummyDesc(*inputDesc[0]);
|
||||
auto inDesc = inputDesc[0]->isDefined() ? inputDesc[0] : inputDesc[0]->cloneWithNewDims(inShape.getStaticDims());
|
||||
auto dnnlInDesc = MemoryDescUtils::convertToDnnlMemoryDesc(inDesc);
|
||||
auto in_candidate = dnnlInDesc->getDnnlDesc();
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ private:
|
||||
|
||||
AttrPtr pAttr;
|
||||
|
||||
Shape inShape;
|
||||
|
||||
bool isMaxPool8 = false;
|
||||
bool auto_pad = false;
|
||||
bool exclude_pad = false;
|
||||
|
||||
@@ -462,6 +462,34 @@ INSTANTIATE_TEST_SUITE_P(smoke_AvgPool_CPU_4D_NotOptimized, PoolingLayerCPUTest,
|
||||
::testing::Values(emptyFusingSpec)),
|
||||
PoolingLayerCPUTest::getTestCaseName);
|
||||
|
||||
const std::vector<LayerTestsDefinitions::poolSpecificParams> paramsAvg4D_Large = {
|
||||
LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::AVG, {65, 65}, {65, 65}, {0, 0}, {0, 0},
|
||||
ngraph::op::RoundingType::FLOOR, ngraph::op::PadType::VALID, true },
|
||||
};
|
||||
|
||||
const std::vector<InputShape> inputShapes4D_Large = {
|
||||
{
|
||||
// dynamic
|
||||
{-1, -1, -1, -1},
|
||||
// target
|
||||
{
|
||||
{1, 16, 65, 65},
|
||||
{1, 8, 130, 130},
|
||||
{1, 16, 65, 65}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_AvgPool_CPU_Large, PoolingLayerCPUTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(paramsAvg4D_Large),
|
||||
::testing::ValuesIn(inputShapes4D_Large),
|
||||
::testing::ValuesIn(inpOutPrecision),
|
||||
::testing::Values(false),
|
||||
::testing::ValuesIn(filterCPUInfoForDevice(vecCpuConfigs)),
|
||||
::testing::Values(emptyFusingSpec)),
|
||||
PoolingLayerCPUTest::getTestCaseName);
|
||||
|
||||
/* ============= Pooling (3D) ============= */
|
||||
const std::vector<LayerTestsDefinitions::poolSpecificParams> paramsMax5D = {
|
||||
LayerTestsDefinitions::poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, {2, 2, 2}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0},
|
||||
|
||||
Reference in New Issue
Block a user