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.