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

[IR] Implement methods to check dynamism on Shape #1952

Merged
merged 11 commits into from
Nov 15, 2024
Merged

Conversation

justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Nov 15, 2024

Define is_static() and is_dynamic() on Shape. Users can check if the shape is static/dynamic, or if a specific axis is static/dynamic.

Fixes #1950

onnxscript/ir/_core.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 97.91667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 74.97%. Comparing base (e6e3d52) to head (4d76da3).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
onnxscript/ir/_core.py 93.75% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1952      +/-   ##
==========================================
+ Coverage   74.89%   74.97%   +0.08%     
==========================================
  Files         262      262              
  Lines       28467    28558      +91     
  Branches     3284     3289       +5     
==========================================
+ Hits        21320    21411      +91     
- Misses       6138     6139       +1     
+ Partials     1009     1008       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@titaiwangms titaiwangms left a comment

Choose a reason for hiding this comment

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

Do you think a method return whether the Shape is static or not would be another useful method? (When users do not want to go through all dims one by one.)

@justinchuby
Copy link
Collaborator Author

Do you think a method return whether the Shape is static or not would be another useful method? (When users do not want to go through all dims one by one.)

Sure! Basically we can make shape.is_static() return this info

onnxscript/ir/_core.py Fixed Show fixed Hide fixed
onnxscript/ir/_core.py Fixed Show fixed Hide fixed
onnxscript/ir/_core.py Fixed Show fixed Hide fixed
onnxscript/ir/_core.py Fixed Show fixed Hide fixed
onnxscript/ir/_core.py Fixed Show fixed Hide fixed
onnxscript/ir/_core.py Fixed Show fixed Hide fixed
onnxscript/ir/_core.py Fixed Show fixed Hide fixed
onnxscript/ir/_core.py Fixed Show fixed Hide fixed
onnxscript/ir/_core.py Fixed Show fixed Hide fixed
@justinchuby justinchuby added the topic: IR Intermediate representation label Nov 15, 2024
@justinchuby justinchuby enabled auto-merge (squash) November 15, 2024 22:29
@justinchuby justinchuby merged commit 8c8417d into main Nov 15, 2024
26 of 41 checks passed
@justinchuby justinchuby deleted the justinchu/dim branch November 15, 2024 22:42
@justinchuby
Copy link
Collaborator Author

Do you think a method return whether the Shape is static or not would be another useful method? (When users do not want to go through all dims one by one.)

Sure! Basically we can make shape.is_static() return this info

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: IR Intermediate representation
Projects
Development

Successfully merging this pull request may close these issues.

[IR] Add is_static(dim) on Shape
2 participants