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

added view_as #351

Merged
merged 12 commits into from
May 10, 2024
Merged

added view_as #351

merged 12 commits into from
May 10, 2024

Conversation

k223kim
Copy link
Contributor

@k223kim k223kim commented May 2, 2024

Before submitting
  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Fixes #328. I am not sure if I should include the test case for view_as opinfos.py (cause there wasn't one for view, maybe it is similar to reshape?). Also, I added view_as to prims, although I am not sure if this is necessary. Let me know how I can improve!

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

👊

@k223kim k223kim marked this pull request as ready for review May 3, 2024 01:43
thunder/core/prims.py Outdated Show resolved Hide resolved
thunder/torch/__init__.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Hey @k223kim! Cool stuff! I made a couple minor comments

@mruberry mruberry self-requested a review May 3, 2024 14:12
@mruberry
Copy link
Collaborator

mruberry commented May 3, 2024

Forgot to add -- yes, a test with an opinfo would be great! It doesn't have to be especially complicated

@k223kim
Copy link
Contributor Author

k223kim commented May 6, 2024

Hi @mruberry! Thanks for the awesome review! Just some questions regarding this PR. I have added a test case for view_as but I am not sure if I should include supports_grad=True. If I do so, it throws the following errors:

FAILED thunder/tests/test_grad.py::test_phantom_grad_vs_torch_consistency_view_as_torch_cpu_bfloat16 - RuntimeError: One of the differentiated Tensors appears to not have been used in the graph. Set allow_unused=True if this is the desired behavior.

Do you think this is necessary?

@mruberry
Copy link
Collaborator

mruberry commented May 6, 2024

Hi @mruberry! Thanks for the awesome review! Just some questions regarding this PR. I have added a test case for view_as but I am not sure if I should include supports_grad=True. If I do so, it throws the following errors:

FAILED thunder/tests/test_grad.py::test_phantom_grad_vs_torch_consistency_view_as_torch_cpu_bfloat16 - RuntimeError: One of the differentiated Tensors appears to not have been used in the graph. Set allow_unused=True if this is the desired behavior.

Do you think this is necessary?

Nope, don't need to add supports_grad=True for now. fyi @IvanYashchuk

Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Cool! Looks great with thorough tests

fyi @Borda and @t-vi to merge

@t-vi t-vi merged commit 3fc8442 into Lightning-AI:main May 10, 2024
37 checks passed
@t-vi
Copy link
Collaborator

t-vi commented May 10, 2024

Thank you @k223kim @mruberry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Impement TensorBase.view_as
3 participants