Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pytorch_memlab/line_profiler/line_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ def enable(self):
try:
torch.cuda.empty_cache()
self._reset_cuda_stats()
# Pytorch-1.7.0 raises AttributeError while <1.6.0 raises AssertionError
except (AssertionError, AttributeError) as error:
# What error is raised depends on PyTorch version:
# latest raises RuntimeError, 1.7.0 raises AttributeError, <1.7.0 raises AssertionError
except (AssertionError, AttributeError, RuntimeError) as error:
print('Could not reset CUDA stats and cache: ' + str(error))

self.register_callback()
Expand Down