Skip to content

Commit

Permalink
Check torch version
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Aug 14, 2024
1 parent 1e467be commit 775a9ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kornia/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ def is_autocast_enabled(both: bool = True) -> bool:
return False

if both:
return torch.is_autocast_enabled() or torch.is_autocast_enabled("cpu")
if torch_version_ge(2, 4):
return torch.is_autocast_enabled() or torch.is_autocast_enabled("cpu")
else:
return torch.is_autocast_enabled() or torch.is_autocast_cpu_enabled()

return torch.is_autocast_enabled()

Expand Down

0 comments on commit 775a9ba

Please sign in to comment.