Skip to content
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

Convert aten.reshape to ttnn.reshape #190

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tests/lowering/tensor_manipulation/test_reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ def forward(self, x, new_shape):
return torch.reshape(x, new_shape)


@pytest.mark.xfail(reason="lowering issue (#67)")
@pytest.mark.parametrize(
"input_shape, new_shape",
[((3 * 5, 7), (7 * 3, 5))],
(((3 * 5, 7), (7 * 3, 5)), ((1, 512, 1, 1), (1, 512))),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case passes on its own. Maybe we need to check the next op or the synergy between reshape and the next op?

)
def test_reshape(device, input_shape, new_shape):
m = ReshapeModule()
Expand Down
4 changes: 2 additions & 2 deletions torch_ttnn/passes/lowering/to_tt_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,9 @@ def call_function(self, target, args, kwargs):
if target == torch.ops.aten.permute.default:
return self.call_function_prop_meta(ttnn.permute, args, kwargs)

if target == torch.ops.aten.view.default:
if target in (torch.ops.aten.reshape.default, torch.ops.aten.view.default):
# aten.reshape is more stable if the input nodes have changed
return self.call_function_prop_meta(torch.ops.aten.reshape.default, args, kwargs)
return self.call_function_prop_meta(ttnn.reshape, args, kwargs)

############################################################
# Other ops
Expand Down