Commit 3f29beb0 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower
Browse files

Internal change

PiperOrigin-RevId: 296108291
parent 5cca172e
......@@ -26,7 +26,7 @@ from absl import logging
import tensorflow as tf
from tensorflow.core.protobuf import rewriter_config_pb2
from tensorflow.python import tf2
from tensorflow.python.eager import profiler
from tensorflow.python.profiler import profiler_v2 as profiler
class BatchTimestamp(object):
......@@ -145,16 +145,14 @@ class ProfilerCallback(tf.keras.callbacks.Callback):
def on_batch_begin(self, batch, logs=None):
if batch == self.start_step_in_epoch and self.should_start:
self.should_start = False
profiler.start()
profiler.start(self.log_dir)
logging.info('Profiler started at Step %s', self.start_step)
def on_batch_end(self, batch, logs=None):
if batch == self.stop_step_in_epoch and self.should_stop:
self.should_stop = False
results = profiler.stop()
profiler.save(self.log_dir, results)
logging.info(
'Profiler saved profiles for steps between %s and %s to %s',
profiler.stop()
logging.info('Profiler saved profiles for steps between %s and %s to %s',
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