fix pickling for BitwiseFn (#163571)

Summary:
ran into AttributeError: Can't get local object 'make_opaque_bitwise_fn.<locals>.BitwiseFn'

looks like it was fixed for UnaryFn but not BitwiseFn in https://github.com/pytorch/pytorch/pull/138395

Fixes #147841

Pull Request resolved: https://github.com/pytorch/pytorch/pull/163571
Approved by: https://github.com/jamesjwu
This commit is contained in:
dolpm
2025-09-25 04:52:11 +00:00
committed by PyTorch MergeBot
parent 783a9dcb6d
commit cde5c9aebd
3 changed files with 17 additions and 5 deletions

View File

@ -1411,7 +1411,10 @@ def make_opaque_bitwise_fn(name, real_op_name):
return sympy.Integer(getattr(operator, real_op_name)(int(a), int(b)))
return None
BitwiseFn.__name__ = "BitwiseFn_" + name
nm = "BitwiseFn_" + name
BitwiseFn.__name__ = nm
BitwiseFn.__qualname__ = nm
return BitwiseFn