-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PT FE] Support negative orders in aten::permute (#28459)
### Details: - *Support negative orders in `aten::permute`* ### Tickets: - *ticket-id* --------- Signed-off-by: Maxim Vafin <[email protected]>
- Loading branch information
Showing
4 changed files
with
39 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2018-2025 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "openvino/core/validation_util.hpp" | ||
#include "openvino/frontend/pytorch/node_context.hpp" | ||
#include "openvino/op/transpose.hpp" | ||
#include "utils.hpp" | ||
|
||
namespace ov { | ||
namespace frontend { | ||
namespace pytorch { | ||
namespace op { | ||
|
||
OutputVector translate_permute(const NodeContext& context) { | ||
num_inputs_check(context, 2, 2); | ||
auto data = context.get_input(0); | ||
auto order = get_input_concat_if_list(context, 1); | ||
auto rank = std::get<1>(get_shape_rank(context, data)); | ||
auto rank_converted = context.mark_node(std::make_shared<ov::op::v1::ConvertLike>(rank, order)); | ||
auto order_normalized = normalize_axis(context, order, rank_converted); | ||
if (const auto order_const = ov::util::get_constant_from_source(order_normalized)) { | ||
order_normalized = order_const; | ||
} | ||
return {context.mark_node(std::make_shared<ov::op::v1::Transpose>(data, order_normalized))}; | ||
} | ||
|
||
} // namespace op | ||
} // namespace pytorch | ||
} // namespace frontend | ||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters