Repository navigation
Add repr method on tensor subclass - #397
Merged
facebook-github-bot merged 3 commits intoJun 19, 2024
Merged
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/397
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c22adf2 with merge base f5b6ec9 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
[ghstack-poisoned]
jerryzh168
reviewed
Jun 18, 2024
| return self | ||
|
|
||
| def __repr__(self): | ||
| return f"TensorCoreTiledAQTLayout(packed_weight={self.packed_weight}, scale_and_zero={self.scale_and_zero})" |
Contributor
There was a problem hiding this comment.
I think you can display the result of get_plain() here, packed_weight is not very useful
int_data, scale, zero_point = self.get_plain()
return f"TensorCoreTiledAQTLayout(int_data={int_data}, scale={scale}, zero_point={zero_point})"
Without this, it will go through default tensor __repr__ method which has some aten ops to print the tensor. This results in triggerring subclass's torch_dispatch. [ghstack-poisoned]
jerryzh168
approved these changes
Jun 18, 2024
Contributor
|
Btw @tugsbayasgalan do you intend to merge this to main? since seems like you're targeting your own branch
|
Contributor
|
btw, the way to merge this PR is the following (heard from Vasiliy):
|
Contributor
Author
|
@tugsbayasgalan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
jerryzh168
added a commit
to jerryzh168/ao
that referenced
this pull request
Jun 25, 2024
Summary: * added repr for TensorCoreTiledAQTLayoutTensor: pytorch#397 * removed the str -> apply_tensor_class map that was used to implement string APIs, which is removed in pytorch#400 Test Plan: CI Reviewers: Subscribers: Tasks: Tags:
jerryzh168
added a commit
to jerryzh168/ao
that referenced
this pull request
Jun 25, 2024
Summary: * added repr for TensorCoreTiledAQTLayoutTensor: pytorch#397 * removed the str -> apply_tensor_class map that was used to implement string APIs, which is removed in pytorch#400 Test Plan: CI Reviewers: Subscribers: Tasks: Tags:
jerryzh168
added a commit
that referenced
this pull request
Jun 26, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stack from ghstack (oldest at bottom):
Without this, it will go through default tensor repr method which has some aten ops to print the tensor. This results in triggerring subclass's torch_dispatch.
Differential Revision: D58786586