Skip to content

Commit 59c4de9

Browse files
fix submodule imports by importing functions directly (#6188)
Summary: fixes two sporadic issues from missing attributes: - breaking circular imports - submodule not being imported explicitly Reviewed By: ehhuang Differential Revision: D37071652 fbshipit-source-id: 0680f098384b0fd21076339750e9d1a96186ede3 Co-authored-by: Edward Wang (EcoF) <[email protected]>
1 parent 28557e0 commit 59c4de9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

torchvision/extension.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,18 @@ def _check_cuda_version():
4747
"""
4848
if not _HAS_OPS:
4949
return -1
50-
import torch
50+
from torch.version import cuda as torch_version_cuda
5151

5252
_version = torch.ops.torchvision._cuda_version()
53-
if _version != -1 and torch.version.cuda is not None:
53+
if _version != -1 and torch_version_cuda is not None:
5454
tv_version = str(_version)
5555
if int(tv_version) < 10000:
5656
tv_major = int(tv_version[0])
5757
tv_minor = int(tv_version[2])
5858
else:
5959
tv_major = int(tv_version[0:2])
6060
tv_minor = int(tv_version[3])
61-
t_version = torch.version.cuda
62-
t_version = t_version.split(".")
61+
t_version = torch_version_cuda.split(".")
6362
t_major = int(t_version[0])
6463
t_minor = int(t_version[1])
6564
if t_major != tv_major or t_minor != tv_minor:

0 commit comments

Comments
 (0)