"test/vscode:/vscode.git/clone" did not exist on "4e99c12dc0ec327e5eb5b91a21f6d6b055bee991"
Commit a2e95a60 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower
Browse files

Internal change

PiperOrigin-RevId: 296469938
parent 393c1399
...@@ -26,7 +26,7 @@ from absl import logging ...@@ -26,7 +26,7 @@ from absl import logging
import tensorflow as tf import tensorflow as tf
from tensorflow.core.protobuf import rewriter_config_pb2 from tensorflow.core.protobuf import rewriter_config_pb2
from tensorflow.python import tf2 from tensorflow.python import tf2
from tensorflow.python.profiler import profiler_v2 as profiler from tensorflow.python.eager import profiler
class BatchTimestamp(object): class BatchTimestamp(object):
...@@ -145,14 +145,16 @@ class ProfilerCallback(tf.keras.callbacks.Callback): ...@@ -145,14 +145,16 @@ class ProfilerCallback(tf.keras.callbacks.Callback):
def on_batch_begin(self, batch, logs=None): def on_batch_begin(self, batch, logs=None):
if batch == self.start_step_in_epoch and self.should_start: if batch == self.start_step_in_epoch and self.should_start:
self.should_start = False self.should_start = False
profiler.start(self.log_dir) profiler.start()
logging.info('Profiler started at Step %s', self.start_step) logging.info('Profiler started at Step %s', self.start_step)
def on_batch_end(self, batch, logs=None): def on_batch_end(self, batch, logs=None):
if batch == self.stop_step_in_epoch and self.should_stop: if batch == self.stop_step_in_epoch and self.should_stop:
self.should_stop = False self.should_stop = False
profiler.stop() results = profiler.stop()
logging.info('Profiler saved profiles for steps between %s and %s to %s', profiler.save(self.log_dir, results)
logging.info(
'Profiler saved profiles for steps between %s and %s to %s',
self.start_step, self.stop_step, self.log_dir) self.start_step, self.stop_step, self.log_dir)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment