Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions tensorboard/plugins/debugger/debugger_plugin_testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@

import portpicker # pylint: disable=import-error
import tensorflow as tf
from tensorflow.python import pywrap_tensorflow

# To keep compatibility with both 1.x and 2.x
try:
from tensorflow.python import _pywrap_events_writer as tf_events_writer
except ImportError:
from tensorflow.python import pywrap_tensorflow as tf_events_writer
from werkzeug import wrappers
from werkzeug import test as werkzeug_test

Expand Down Expand Up @@ -61,7 +66,7 @@ def setUp(self):
self.log_dir = self.get_temp_dir()
file_prefix = tf.compat.as_bytes(
os.path.join(self.log_dir, 'events.debugger'))
writer = pywrap_tensorflow.EventsWriter(file_prefix)
writer = tf_events_writer.EventsWriter(file_prefix)
device_name = '/job:localhost/replica:0/task:0/cpu:0'
writer.WriteEvent(
self._CreateEventWithDebugNumericSummary(
Expand Down Expand Up @@ -107,7 +112,7 @@ def setUp(self):
os.mkdir(run_foo_directory)
file_prefix = tf.compat.as_bytes(
os.path.join(run_foo_directory, 'events.debugger'))
writer = pywrap_tensorflow.EventsWriter(file_prefix)
writer = tf_events_writer.EventsWriter(file_prefix)
writer.WriteEvent(
self._CreateEventWithDebugNumericSummary(
device_name=device_name,
Expand Down
9 changes: 7 additions & 2 deletions tensorboard/plugins/debugger/events_writer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
import time

import tensorflow as tf
from tensorflow.python import pywrap_tensorflow

# To keep compatibility with both 1.x and 2.x
try:
from tensorflow.python import _pywrap_events_writer as tf_events_writer
except ImportError:
from tensorflow.python import pywrap_tensorflow as tf_events_writer
from tensorboard.util import tb_logging

logger = tb_logging.get_logger()
Expand Down Expand Up @@ -209,7 +214,7 @@ def _create_events_writer(self, directory):
os.path.join(directory, DEBUGGER_EVENTS_FILE_STARTING_TEXT),
time.time(), self._events_file_count)
logger.info("Creating events file %s", file_path)
return pywrap_tensorflow.EventsWriter(tf.compat.as_bytes(file_path))
return tf_events_writer.EventsWriter(tf.compat.as_bytes(file_path))

def _fetch_events_files_on_disk(self):
"""Obtains the names of debugger-related events files within the directory.
Expand Down