[BugFix] Change is_diff check to use is_diff.any()#1477
[BugFix] Change is_diff check to use is_diff.any()#1477pancan21 wants to merge 1 commit intopytorch:mainfrom
Conversation
Previous implementation using list of boolean values resulted in ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() I assume using any() instead of all() is the intended behavior.
|
Hi @pancan21! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
| ) | ||
| is_diff = dest[idx].tolist() != value.tolist() | ||
| if is_diff: | ||
| if is_diff.any(): |
There was a problem hiding this comment.
This should be a list. If it's not, we should fix that!
Description
Previous implementation using list of boolean values resulted in ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I assume using any() instead of all() is the intended behavior.
Motivation and Context
Why is this change required? ValueError when setting td.set_at_()
close #1476
Types of changes
What types of changes does your code introduce? Remove all that do not apply:
Checklist
Go over all the following points, and put an
xin all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!
Not sure how this logical error should be tested. Please help