MCPcopy Index your code
hub / github.com/tensorflow/models / StepTimer

Class StepTimer

orbit/controller.py:584–600  ·  view source on GitHub ↗

Utility class for measuring steps/second.

Source from the content-addressed store, hash-verified

582
583
584class StepTimer:
585 """Utility class for measuring steps/second."""
586
587 def __init__(self, step):
588 self.step = step
589 self.start()
590
591 def start(self):
592 self.last_iteration = self.step.numpy()
593 self.last_time = time.time()
594
595 def steps_per_second(self, restart=True):
596 value = ((self.step.numpy() - self.last_iteration) /
597 (time.time() - self.last_time))
598 if restart:
599 self.start()
600 return value

Callers 1

_train_n_stepsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected