77#include < openvino/op/reshape.hpp>
88#include < openvino/op/slice.hpp>
99#include < openvino/op/transpose.hpp>
10+ #include < openvino/op/unsqueeze.hpp>
1011
1112#include " ../node_context.hpp"
1213#include " ../op_table.hpp"
@@ -23,13 +24,18 @@ OutputVector translate_permute(const NodeContext& context) {
2324 int op_case = context.get_op_case ();
2425 FRONT_END_CHECK_IMPLEMENTED (op_case == 1 || op_case == 2 || op_case == 3 , " Unsupported PERMUTE case" );
2526 ov::Output<Node> res;
27+ auto zero = ov::op::v0::Constant::create (ov::element::i64 , {1 }, {0 });
2628
2729 if (op_case == 1 ) {
2830 if (context.is_static ()) {
2931 res = std::make_shared<ov::op::v1::Transpose>(context.get_input (0 ),
3032 ov::op::v0::Constant::create (ov::element::i64 , {3 }, {1 , 0 , 2 }));
3133 } else {
32- res = std::make_shared<ov::op::v1::Transpose>(context.get_input (0 ),
34+ auto src = context.get_input (0 );
35+ if (src.get_partial_shape ().rank () == 3 ) {
36+ src = std::make_shared<ov::op::v0::Unsqueeze>(src, zero);
37+ }
38+ res = std::make_shared<ov::op::v1::Transpose>(src,
3339 ov::op::v0::Constant::create (ov::element::i64 , {4 }, {0 , 2 , 1 , 3 }));
3440 }
3541 } else {
@@ -43,7 +49,6 @@ OutputVector translate_permute(const NodeContext& context) {
4349 attention_size = context.get_input (" attention_size_swa" );
4450 }
4551
46- auto zero = ov::op::v0::Constant::create (ov::element::i64 , {1 }, {0 });
4752 auto one = ov::op::v0::Constant::create (ov::element::i64 , {1 }, {1 });
4853
4954 if (context.is_static ()) {
@@ -57,6 +62,9 @@ OutputVector translate_permute(const NodeContext& context) {
5762 res = std::make_shared<ov::op::v1::Transpose>(src_slice,
5863 ov::op::v0::Constant::create (ov::element::i64 , {3 }, {1 , 0 , 2 }));
5964 } else {
65+ if (src.get_partial_shape ().rank () == 3 ) {
66+ src = std::make_shared<ov::op::v0::Unsqueeze>(src, zero);
67+ }
6068 res = std::make_shared<ov::op::v1::Transpose>(src,
6169 ov::op::v0::Constant::create (ov::element::i64 , {4 }, {0 , 2 , 1 , 3 }));
6270 }
0 commit comments