-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Record shaping assertions and use them for tracing / scripting optimization and codegen #46948
Comments
If these are recorded, it may be useful to let user access these (shape inference) "type hints". |
Btw with dynamo, this idea of explicit user-provided hints/guarantees may be still relevant @ezyang @albanD (including for asserting numel less than int32 max) Some other useful constraints can include divisibility: e.g. If these are in form of assert statement, they can be nicely executed in eager mode as well and blow up nicely if something is wrong |
Related: #107735 |
Related idea on manual decaying shapes to static to help/simplify the export: |
Somewhat related question on Dynamo preserving the shape/dtype assert statements in Dynamo-captured graphs: https://stackoverflow.com/questions/78426965/how-do-i-get-dynamo-export-to-not-export-shape-asserts |
Motivated in #40373 (comment).
Recording assertions
assert X.shape[1] == Y.shape[2] and X.shape[2] == 64 and Z.ndim == 3
(or directly viatorch.assert_shapes(...)
) as part of tracing / scripting can help and streamline codegen (as can eliminate unneeded checks or broadcasts). #40373 contains a wider discussion, but @ezyang suggested that a more limited scope can be of value as well.cc @gmagogsfm @apaszke
The text was updated successfully, but these errors were encountered: