Skip to content

[tensor wrapper subclass] Add trace transform for tensor subclasses #1584

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

Closed
wants to merge 3 commits into from

Conversation

crcrpar
Copy link
Collaborator

@crcrpar crcrpar commented Dec 23, 2024

What does this PR do?

Implement

  • prims for my_subclass.__tensor_flatten__ and MySubclass.__tensor_unflatten__
  • trace transform to unroll MySubclass.__torch_dispatch__.
    • This transform uses torch.fx to understand the extended behavior. Currently the mapping from core aten ops to thunder.torch ops is quite optimistic; just querying the aten op name to thunder.torch.

Since __torch_dispatch__ extends the behavior that is implemented in C++ level, we'd need to apply the transform to split forward and backward traces separately.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Dec 23, 2024
@crcrpar crcrpar force-pushed the tensor_subclass_2 branch 2 times, most recently from 2e763f1 to a534003 Compare December 25, 2024 18:21
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
to support `__torch_dispatch__`.
Since it extends the behavior that is implemented in C++ level,
we'd need to apply the transform to split forward and backward traces
separately.

Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Copy link

stale bot commented Apr 16, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the won't fix label Apr 16, 2025
@t-vi t-vi removed the won't fix label Apr 30, 2025
@crcrpar crcrpar closed this Jul 4, 2025
@github-actions github-actions bot deleted the tensor_subclass_2 branch July 5, 2025 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants