Shortcuts

torchtnt.utils.timer.log_elapsed_time

torchtnt.utils.timer.log_elapsed_time(action_name: str, *, cuda_sync: Optional[bool] = None) Generator[None, None, None]

Utility to measure and log elapsed time for a given event.

Parameters:
  • action_name – the name of the event being timed.
  • cuda_sync – Whether to synchronize the stream in order to measure the most accurate timings on CUDA. Defaults to True if CUDA is available.
Raises:

ValueError – If cuda_sync is set to True but CUDA is not available.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources