Skip to content

Add support for _unsafe_index_put#1314

Closed
xadupre wants to merge 3 commits into
microsoft:mainfrom
xadupre:input_put
Closed

Add support for _unsafe_index_put#1314
xadupre wants to merge 3 commits into
microsoft:mainfrom
xadupre:input_put

Conversation

@xadupre

@xadupre xadupre commented Mar 25, 2024

Copy link
Copy Markdown
Member

No description provided.

matcher=lambda sample: not (sample.args[0][0].dtype == torch.int64),
reason="this Aten overload only supports tensor(int) as indices",
)
TorchLibOpInfo(

Check failure

Code scanning / CodeQL

Syntax error

Syntax Error (in Python 3).
Comment thread onnxscript/tests/function_libs/torch_lib/ops_test_data.py
reason="this Aten overload only supports tensor(int) as indices",
)
TorchLibOpInfo(
"_unsafe_index_put",

@justinchuby justinchuby Mar 25, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since it looks like it is the same as index_put, we can actually make it the same function.

If for any reason we believe they could behave differently or if we want to safeguard the implementation, I would create test cases in extra_opinfo.py to run it against torch.ops.aten._unsafe_index_put (Looks like _unsafe_index_put does not exist in https://github.com/pytorch/pytorch/blob/main/torch/testing/_internal/common_methods_invocations.py so we may need to create our own test cases)

Comment thread onnxscript/function_libs/torch_lib/ops/core.py Outdated
@justinchuby

Copy link
Copy Markdown
Collaborator

Curious what is unsafe about this op itself?

Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
@codecov

codecov Bot commented Mar 25, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.08%. Comparing base (ce3eb4a) to head (93ad32c).
Report is 24 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1314       +/-   ##
===========================================
- Coverage   78.68%   62.08%   -16.61%     
===========================================
  Files         119      117        -2     
  Lines       15762    14922      -840     
  Branches     2486     2372      -114     
===========================================
- Hits        12403     9264     -3139     
- Misses       2950     5318     +2368     
+ Partials      409      340       -69     

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

@xadupre

xadupre commented Mar 25, 2024

Copy link
Copy Markdown
Member Author

Dropped for #1315.

@xadupre xadupre closed this Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants