-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[PyTorch FE] Support aten::ravel operation #34006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
53abf55
76b2627
c9351bb
34bdfbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Copyright (C) 2018-2025 Intel Corporation | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
|
|
||
| #include "openvino/frontend/pytorch/node_context.hpp" | ||
| #include "openvino/op/constant.hpp" | ||
| #include "openvino/op/reshape.hpp" | ||
| #include "utils.hpp" | ||
|
|
||
| namespace ov { | ||
| namespace frontend { | ||
| namespace pytorch { | ||
| namespace op { | ||
|
|
||
| using namespace ov::op; | ||
|
|
||
| OutputVector translate_ravel(const NodeContext& context) { | ||
| // aten::ravel(Tensor self) -> Tensor | ||
| num_inputs_check(context, 1, 1); | ||
| auto input = context.get_input(0); | ||
| auto neg_1 = context.mark_node(v0::Constant::create(element::i64, Shape{1}, {-1})); | ||
| return {context.mark_node(std::make_shared<v1::Reshape>(input, neg_1, false))}; | ||
| }; | ||
|
|
||
| } // namespace op | ||
| } // namespace pytorch | ||
| } // namespace frontend | ||
| } // namespace ov | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||
| # Copyright (C) 2018-2025 Intel Corporation | ||||||
| # SPDX-License-Identifier: Apache-2.0 | ||||||
|
|
||||||
| import numpy as np | ||||||
| import pytest | ||||||
|
|
||||||
| from pytorch_layer_test_class import PytorchLayerTest | ||||||
|
|
||||||
|
|
||||||
| class TestRavel(PytorchLayerTest): | ||||||
| def _prepare_input(self, shape, dtype="float32"): | ||||||
| return (np.random.randn(*shape).astype(dtype),) | ||||||
|
||||||
| return (np.random.randn(*shape).astype(dtype),) | |
| return (self.random.randn(*shape).astype(dtype),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[LOW] New files use a
2018-2025copyright header, while most nearby PyTorch FE sources use2018-2026(e.g.,op_table.cpp,range_length.cpp). Please align the year range in this new source file with the repository’s current convention.