[CPU] Dummy shape creation fix for Deconvolution (#10079)

This commit is contained in:
Maxim Andronov 2022-02-04 21:43:25 +03:00 committed by GitHub
parent 69b118ed7b
commit a8c520878d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View File

@ -229,6 +229,9 @@ std::pair<VectorDims, VectorDims> MKLDNNDeconvolutionNode::makeDummyInOutShape()
auto outShape = getOutputShapeAtPort(0);
if (isDynamicNode()) {
auto inputDims = inShape.getStaticDims();
inputDims[1] = IC;
if (externOutShape) {
if (lastOutputSpatialDims.empty()) {
const auto& shape = getOutputShapeAtPort(0);
@ -245,17 +248,18 @@ std::pair<VectorDims, VectorDims> MKLDNNDeconvolutionNode::makeDummyInOutShape()
ov::CoordinateDiff pb = autoPad ? ov::CoordinateDiff(paddingL.size(), 0) : paddingL;
ov::CoordinateDiff pe = autoPad ? ov::CoordinateDiff(paddingR.size(), 0) : paddingR;
auto inputDims = inShape.getStaticDims();
const auto& origInDims = getInputShapeAtPort(0).getDims();
const auto& weightDims = getWeightDims();
const size_t wghOffset = getAlgorithm() == DeconvolutionGrouped ? 1 : 0;
for (size_t i = 0; i < inputDims.size() - 2; i++) {
inputDims[2 + i] = ((lastOutputSpatialDims[i] - (dilation[i] + 1) *
(weightDims[wghOffset + 2 + i] - 1) - 1 + pb[i] + pe[i] - outputPadding[i])) /
stride[i] + 1;
if (origInDims[2 + i] == Shape::UNDEFINED_DIM) {
inputDims[2 + i] = ((lastOutputSpatialDims[i] - (dilation[i] + 1) *
(weightDims[wghOffset + 2 + i] - 1) - 1 + pb[i] + pe[i] - outputPadding[i])) /
stride[i] + 1;
}
}
inShape = Shape(inputDims);
}
inShape = Shape(inputDims);
outShape = Shape(shapeInferInternal(inShape.getStaticDims(), lastOutputSpatialDims));
paddingL = shapeInference->get_pads_begin();
paddingR = shapeInference->get_pads_end();

View File

@ -330,7 +330,7 @@ const std::vector<DeconvInputData> Planar_2D_inputs_nightly = {
{}
},
DeconvInputData{
InputShape{{-1, 12, -1, -1}, {{ 2, 12, 7, 7}, { 2, 12, 5, 7}, { 1, 12, 9, 4}}},
InputShape{{-1, 12, 7, 7}, {{ 1, 12, 7, 7}, { 2, 12, 7, 7}, { 1, 12, 7, 7}}},
ngraph::helpers::InputLayerType::CONSTANT,
{{15, 15}}
}
@ -397,9 +397,9 @@ const std::vector<DeconvInputData> Planar_3D_inputs_nightly = {
{}
},
DeconvInputData{
InputShape{{-1, 12, -1, -1, -1}, {{ 2, 12, 7, 7, 7}, { 2, 12, 5, 7, 7}, { 1, 12, 9, 4, 9}}},
InputShape{{-1, 12, 5, 8, 8}, {{ 2, 12, 5, 8, 8}, { 2, 12, 5, 8, 8}, { 1, 12, 5, 8, 8}}},
ngraph::helpers::InputLayerType::CONSTANT,
{{15, 15, 15}}
{{10, 16, 16}}
}
};