Skip to content

Commit a33a753

Browse files
committed
Add missing _lazy_init in cuda python functions (#4907)
1 parent 86fdc89 commit a33a753

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

torch/cuda/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,15 @@ def current_stream():
315315

316316
def current_blas_handle():
317317
"""Returns cublasHandle_t pointer to current cuBLAS handle"""
318+
_lazy_init()
318319
return torch._C._cuda_getCurrentBlasHandle()
319320

320321

321322
def empty_cache():
322323
"""Releases all unoccupied cached memory currently held by the caching
323324
allocator so that those can be used in other GPU application and visible in
324325
`nvidia-smi`."""
326+
_lazy_init()
325327
return torch._C._cuda_emptyCache()
326328

327329

0 commit comments

Comments
 (0)