We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 718e401 commit a302aabCopy full SHA for a302aab
setup.py
@@ -9,13 +9,13 @@
9
10
11
# If WITH_CUDA is defined
12
-if os.getenv("WITH_CUDA") is None:
13
- if os.environ.get("WITH_CUDA", "0") == "1":
14
- use_cuda = True
15
- elif os.environ.get("WITH_CUDA", "0") == "0":
16
- use_cuda = False
17
- else:
18
- raise ValueError("Invalid flag with WITH_CUDA environment variable. Expected '0' or '1'")
+env_with_cuda = os.getenv("WITH_CUDA")
+if env_with_cuda is not None:
+ if env_with_cuda not in ("0", "1"):
+ raise ValueError(
+ "Invalid flag with WITH_CUDA environment variable. Expected '0' or '1'"
+ )
+ use_cuda = env_with_cuda == "1"
19
else:
20
use_cuda = torch.cuda._is_compiled()
21
0 commit comments