tfl.test_utils.TimeTracker
Stay organized with collections
Save and categorize content based on your preferences.
Tracks time.
tfl.test_utils.TimeTracker(
list_to_append, num_steps=1
)
Keeps track of time spent in its scope and appends it to 'list_to_append'
on exit from scope divided by 'num_steps' if provided.
Example |
training_step_times = []
with TimeTracker(training_step_times, num_steps=num_epochs):
model.fit(... epochs=num_epochs ...)
print np.median(training_step_times)
|
Methods
__enter__
View source
__enter__()
__exit__
View source
__exit__(
unuesd_type, unuesd_value, unuesd_traceback
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-02 UTC.
[null,null,["Last updated 2024-08-02 UTC."],[],[],null,["# tfl.test_utils.TimeTracker\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/test_utils.py#L27-L51) |\n\nTracks time. \n\n tfl.test_utils.TimeTracker(\n list_to_append, num_steps=1\n )\n\nKeeps track of time spent in its scope and appends it to 'list_to_append'\non exit from scope divided by 'num_steps' if provided.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Example ------- ||\n|---|---|\n| training_step_times = \\[\\] with TimeTracker(training_step_times, num_steps=num_epochs): model.fit(... epochs=num_epochs ...) print np.median(training_step_times) ||\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `__enter__`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/test_utils.py#L44-L46) \n\n __enter__()\n\n### `__exit__`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/test_utils.py#L48-L51) \n\n __exit__(\n unuesd_type, unuesd_value, unuesd_traceback\n )"]]