commit | c8889f4e109866610bd1981f03deee8f102b5ce6 | [log] [tgz] |
---|---|---|
author | Nikita Shulga <nshulga@fb.com> | Wed Oct 19 22:15:28 2022 +0000 |
committer | PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> | Wed Oct 19 22:15:28 2022 +0000 |
tree | 570f4f3644382b384e006e5dd857667254318003 | |
parent | 56b150ac63653f982c2b4aaa61336e5f6ecd1e4c [diff] |
`cuda._is_in_bad_fork`->`_C._cuda_isInBadFork` (#87317) Former is always available, while later is only available if PyTorch compiled with CUDA And if it does, then ``` $ python -c "import torch;print(torch._C._cuda_isInBadFork == torch.cuda._is_in_bad_fork)" True ``` Fixes https://github.com/pytorch/torchdynamo/issues/1709 ( at least the symptom) cc @jansel @lezcano @fdrocha Pull Request resolved: https://github.com/pytorch/pytorch/pull/87317 Approved by: https://github.com/voznesenskym, https://github.com/albanD, https://github.com/soumith, https://github.com/jansel
diff --git a/torch/_dynamo/variables/tensor.py b/torch/_dynamo/variables/tensor.py index 4a4e500..a8db819 100644 --- a/torch/_dynamo/variables/tensor.py +++ b/torch/_dynamo/variables/tensor.py
@@ -332,7 +332,7 @@ ) elif ( proxy.node.target == torch._C._DisableFuncTorch - or proxy.node.target == torch._C._cuda_isInBadFork + or proxy.node.target == torch.cuda._is_in_bad_fork ): from . import UserDefinedObjectVariable