mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Fixes for collections.Counter
(#159368)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159368 Approved by: https://github.com/mlazos ghstack dependencies: #159365, #159366
This commit is contained in:
committed by
PyTorch MergeBot
parent
2542e71f3f
commit
e5621b4d8b
@ -2543,6 +2543,13 @@ class BuiltinVariable(VariableTracker):
|
||||
(operator.neg)(a.as_proxy()),
|
||||
sym_num=None,
|
||||
)
|
||||
|
||||
if (
|
||||
isinstance(a, UserDefinedObjectVariable)
|
||||
and a.call_obj_hasattr(tx, "__neg__").value # type: ignore[attr-defined]
|
||||
):
|
||||
return a.call_method(tx, "__neg__", [], {})
|
||||
|
||||
# None no-ops this handler and lets the driving function proceed
|
||||
return None
|
||||
|
||||
|
Reference in New Issue
Block a user