-
Notifications
You must be signed in to change notification settings - Fork 83
Implements aten_index_put if inputs are SymbolicTensor #2606
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2606 +/- ##
=======================================
Coverage 69.95% 69.96%
=======================================
Files 222 222
Lines 26311 26375 +64
Branches 2604 2617 +13
=======================================
+ Hits 18406 18453 +47
- Misses 6993 7002 +9
- Partials 912 920 +8 ☔ View full report in Codecov by Sentry. |
<https://github.com/pytorch/pytorch/blob/main/torch/onnx/symbolic_opset11.py#L212>`_. | ||
""" | ||
if len(indices) > 1 and any( | ||
isinstance(indice, torch.onnx._internal.exporter._tensors.SymbolicTensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check not isinstance(index, int)
instead as we should not reference the private class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the possible types here? Only int and SymbolicTensor? I prefer to keep SymbolicTensor because I know exactly which type the function is supposed to handle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only int and SymbolicTensor for the exporter, but could be other ir.Value subclasses as well. As the type is an internal type it is not meant for public use, the current usage is not supported and is brittle.
If preferred you may check for ir.Value instead, but really we just assume a type that has shape and dtype fields
return op.ReduceProd(op.Shape(x, start=i + 1), keepdims=1) | ||
|
||
shape = [1] * (len(x.shape) + 1) | ||
mfixed = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer clear variable names and avoid abbreviations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable are used just after. It is short to make the code shorter and esier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any abbreviation adds cognitive load and is not preferred. All names should be thoughtfully created to be precise. Creating variables used right after is a plus but I don’t feel warranting the use of ambiguous names.
No description provided.