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

Add example code for printing the operator and shapes in a model #902

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented Sep 18, 2024

Summary:
This will be useful for people to do understand the ops/shapes for a model that they are interested in optimizing, also helpful for microbenchmarks with target ops/shapes. This is used in #391 (search for Microbenchmarks)

Example output:

TORCH_FUNC=<built-in function linear> (M, K, N): 10 10 10
TORCH_FUNC=<method 'add' of 'torch._C.TensorBase' objects> args[0] shape: torch.Size([10, 10])

all linear shapes (M, K, N): [(10, 10, 10)]

Test Plan:
python tutorials/developer_api_guide/print_op_and_shapes.py

Reviewers:

Subscribers:

Tasks:

Tags:

Summary:
This will be useful for people to do understand the ops/shapes for a model
that they are interested in optimizing, also helpful for microbenchmarks with target ops/shapes

Test Plan:
python tutorials/developer_api_guide/print_op_and_shapes.py

Reviewers:

Subscribers:

Tasks:

Tags:
Copy link

pytorch-bot bot commented Sep 18, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/902

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit f97da6e with merge base bd264f9 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 18, 2024
@msaroufim
Copy link
Member

msaroufim commented Sep 18, 2024

Can you show us what this prints on some model?

Copy link
Contributor

@vkuzo vkuzo left a comment

Choose a reason for hiding this comment

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

lgtm!

@jerryzh168
Copy link
Contributor Author

Can you show us what this prints on some model?

added in summary, this util is used in the torchao dev guide as a util for developers

@jerryzh168 jerryzh168 merged commit 4865ee6 into pytorch:main Sep 18, 2024
17 checks passed
@jerryzh168 jerryzh168 deleted the print-shapes branch September 18, 2024 17:00
jainapurva pushed a commit that referenced this pull request Sep 22, 2024
Summary:
This will be useful for people to do understand the ops/shapes for a model
that they are interested in optimizing, also helpful for microbenchmarks with target ops/shapes

Test Plan:
python tutorials/developer_api_guide/print_op_and_shapes.py

Reviewers:

Subscribers:

Tasks:

Tags:
jainapurva pushed a commit that referenced this pull request Sep 23, 2024
Summary:
This will be useful for people to do understand the ops/shapes for a model
that they are interested in optimizing, also helpful for microbenchmarks with target ops/shapes

Test Plan:
python tutorials/developer_api_guide/print_op_and_shapes.py

Reviewers:

Subscribers:

Tasks:

Tags:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants