Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Fix 1D transpose test case (#31842)

shiyi37fba130bd50
diff --git a/src/plugins/intel_cpu/src/nodes/common/permute_kernel.cpp b/src/plugins/intel_cpu/src/nodes/common/permute_kernel.cpp
index c1949a76e58..6b1d8af334b 100644
--- a/src/plugins/intel_cpu/src/nodes/common/permute_kernel.cpp
+++ b/src/plugins/intel_cpu/src/nodes/common/permute_kernel.cpp
@@ -231,15 +231,24 @@ void PermuteKernel::optimizedExecute(const uint8_t* src_data, const uint8_t* dst
switch (jcp.n) {
case 0:
- // This is a degenerate case that is only possible if the tensor has 0 or 1st rank
- // Such a situation is possible in the following graph:
- // Parameter
- // |
- // Transpose
- // |
- // Result
- // The elimination of the Transpose node will not be performed
- // So copy from input buffer to output buffer without any permutation
+ // This is a degenerate case that is only possible if the tensor has 0 or 1st rank
+ // Such a situation is possible in the following graph:
+ // Parameter
+ // |
+ // Transpose
+ // |
+ // Result
+ // The elimination of the Transpose node will not be performed
+ // So copy from input buffer to output buffer without any permutation
+ {
+ auto arg = jit_args_permute();
+
+ arg.src = src_data;
+ arg.dst = dst_data;
+
+ (*permute_kernel)(&arg);
+ }
+ break;
case 1:
parallel_for(dst_dims[0], [&](int i0) {
auto arg = jit_args_permute();
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/transpose.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/transpose.cpp
index e1f0d559cf2..d1fd5f69006 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/transpose.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/transpose.cpp
@@ -173,6 +173,25 @@ INSTANTIATE_TEST_SUITE_P(smoke_dynamicShapes5D_PermutePerChannels, TransposeLaye
::testing::Values(additional_config),
::testing::Values(CPUSpecificParams{})),
TransposeLayerCPUTest::getTestCaseName);
+
+const std::vector<InputShape> staticInputShapes1D = {InputShape{
+ // dynamic
+ {-1},
+ // Static shapes
+ {{24}}}
+};
+
+const std::vector<std::vector<size_t>> inputOrder1D = {std::vector<size_t>{0}};
+
+INSTANTIATE_TEST_SUITE_P(smoke_staticShapes1D_Transpose, TransposeLayerCPUTest,
+ ::testing::Combine(
+ ::testing::ValuesIn(staticInputShapes1D),
+ ::testing::ValuesIn(inputOrder1D),
+ ::testing::Values(ov::element::f32),
+ ::testing::Values(ov::test::utils::DEVICE_CPU),
+ ::testing::Values(additional_config),
+ ::testing::Values(CPUSpecificParams{})),
+ TransposeLayerCPUTest::getTestCaseName);
} // namespace
} // namespace Transpose
} // namespace test