-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Profiler + Minor improvements (#1548)
There is currently a bug in the profiler, that the first run recorded includes the runtime of all the warmup runs, making one ugly outlier. This is because `times[0]` is set before the warmups and is never properly reset. This fixes that and makes the surrounding code a bit cleaner (e.g. using `np.diff` instead of list comprehension). I also added some options that make the profiler more usable when it's called inside of other `tqdm` progress bars (allows setting `tqdm`'s `leave=False` and stop it from printing results). List of changes: - Fix: timing error - Add: `tqdm_leave` parameter - Add: `print_results` parameter - Cleanup: Only print `Profiling...` if `tqdm` is not used - Cleanup: use `warnings.warn()` instead of `print("WARNING: ...")` - Cleanup: remove unused variable for return value (didn't seem to be used) - Cleanup: make diff calculation more concise --------- Co-authored-by: Tal Ben-Nun <[email protected]>
- Loading branch information
Showing
2 changed files
with
53 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters