pytorch_version.py 468 B

12345678910111213141516
  1. import torch
  2. def pytorch_cudnn_version() -> str:
  3. message = (
  4. f"pytorch.version={torch.__version__}, "
  5. f"cuda.available={torch.cuda.is_available()}, "
  6. )
  7. if torch.backends.cudnn.enabled:
  8. message += (
  9. f"cudnn.version={torch.backends.cudnn.version()}, "
  10. f"cudnn.benchmark={torch.backends.cudnn.benchmark}, "
  11. f"cudnn.deterministic={torch.backends.cudnn.deterministic}"
  12. )
  13. return message