Skip to content

Commit 60a2946

Browse files
committed
cleaner
1 parent 292c315 commit 60a2946

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

torch_sparse/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@
2121
f'version {major}.{minor}.')
2222
raise OSError(e)
2323

24-
cuda_version = torch.ops.torch_sparse.cuda_version()
25-
if cuda_version != -1 and torch.version.cuda is not None: # pragma: no cover
26-
if cuda_version < 10000:
24+
if torch.version.cuda is not None: # pragma: no cover
25+
cuda_version = torch.ops.torch_sparse.cuda_version()
26+
27+
if cuda_version == -1:
28+
major = minor = 0
29+
elif cuda_version < 10000:
2730
major, minor = int(str(cuda_version)[0]), int(str(cuda_version)[2])
2831
else:
2932
major, minor = int(str(cuda_version)[0:2]), int(str(cuda_version)[3])
3033
t_major, t_minor = [int(x) for x in torch.version.cuda.split('.')]
31-
cuda_version = str(major) + '.' + str(minor)
3234

3335
if t_major != major or t_minor != minor:
3436
raise RuntimeError(

0 commit comments

Comments
 (0)