Similar to torch.is_autocast_enabled, but compatible with torch 1.5.1
()
| 391 | |
| 392 | |
| 393 | def is_autocast_enabled() -> bool: |
| 394 | """Similar to torch.is_autocast_enabled, but compatible with torch 1.5.1""" |
| 395 | if hasattr(torch, "is_autocast_enabled"): |
| 396 | return torch.is_autocast_enabled() |
| 397 | return False |
| 398 | |
| 399 | |
| 400 | @contextmanager |