Skip to content

Commit 72e44bc

Browse files
committed
revert NCHWAsNHWC(reorder optimization) for non-pillow mode
1 parent 331f551 commit 72e44bc

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

src/plugins/intel_cpu/src/nodes/interpolate.cpp

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,33 +2017,10 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext
20172017
if (isAxesSpecified) {
20182018
axes = ov::as_type_ptr<const ov::op::v0::Constant>(interp->get_input_node_shared_ptr(AXES_ID))
20192019
->cast_vector<int>();
2020-
if (dataRank == 4 && axes.size() == 2 && axes[0] == 1 && axes[1] == 2) {
2021-
interpAttrs.NCHWAsNHWC = true;
2022-
axes[0] = 2;
2023-
axes[1] = 3;
2024-
}
20252020
} else {
2026-
const auto& outputShape = getOutputShapeAtPort(0);
2027-
// For the static shapes, we can avoid reordering NHWC to NCHW
2028-
// if the last dimension of input and output shapes are equal.
2029-
auto avoidReorder = [](const auto& inputDataShape, const auto& outputShape) {
2030-
auto lastInDim = inputDataShape.getDims().back();
2031-
2032-
// Dynamic shape
2033-
if (lastInDim == Shape::UNDEFINED_DIM) {
2034-
return false;
2035-
}
2036-
auto lastOutDim = outputShape.getDims().back();
2037-
return static_cast<bool>(lastOutDim == lastInDim);
2038-
};
2039-
if (dataRank == 4 && avoidReorder(inputDataShape, outputShape)) {
2040-
interpAttrs.NCHWAsNHWC = true;
2041-
axes = {0, 2, 3, 1}; // NHWC
2042-
} else {
2043-
axes.resize(dataRank);
2044-
for (int i = 0; i < static_cast<int>(dataRank); i++) {
2045-
axes[i] = i;
2046-
}
2021+
axes.resize(dataRank);
2022+
for (int i = 0; i < static_cast<int>(dataRank); i++) {
2023+
axes[i] = i;
20472024
}
20482025
}
20492026
} else if (const auto interp = ov::as_type_ptr<const ov::op::v11::Interpolate>(op)) {

0 commit comments

Comments
 (0)