pytorch
3f108a5c - Save disable_torch_function in ThreadLocalState

Commit
2 years ago
Save disable_torch_function in ThreadLocalState If __torch_function__ was disabled, this TLS should propagate to other threads. Although I was thinking about https://github.com/pytorch/pytorch/pull/73942 when I did this, this doesn't actually help solve the problem, because when I disable __torch_function__ as part of the disabled __torch_function__ implementation, this is prior to when snapshotting happens (also snapshotting only happens for Python tensors anyway). I intend to add some more TLS to this struct soon, which is why it's a struct and not just a bool. Testing is not so easy to do because on CPU there isn't an easy way to get Python code running in another thread. Signed-off-by: Edward Z. Yang <ezyangfb.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/75110 Approved by: https://github.com/albanD
Author
Committer
Parents
Loading