Use specific exception types in CUDA version parse

Per AGENTS.md: prefer specific exception types in new code. AttributeError
covers torch.version.cuda being None, ValueError covers an unparseable
version string.
This commit is contained in:
Alan Li 2026-07-31 22:33:14 -04:00
parent 868c29cff3
commit 8f4e58d29f
1 changed files with 1 additions and 1 deletions

View File

@ -1966,7 +1966,7 @@ def supports_nvfp4_compute(device=None):
# cuBLAS FP4 matmul kernels require CUDA 13+, see #11864 # cuBLAS FP4 matmul kernels require CUDA 13+, see #11864
try: try:
cuda_version_major = int(torch.version.cuda.split(".")[0]) cuda_version_major = int(torch.version.cuda.split(".")[0])
except: except (AttributeError, ValueError):
return False return False
if cuda_version_major < 13: if cuda_version_major < 13:
return False return False