<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>Have I written custom code: No, I'm using MNIST Tensorboard example provided by Google.</li>
<li>OS Platform and Distribution: Ubuntu 16.04</li>
<li>Binary installation (sudo pip3 install tf-nightly-2.0-preview)</li>
<li>TensorFlow version (use command below): 2.0.0-dev20190405</li>
<li>Python version: 3.5.2</li>
<li>CUDA/cuDNN version: 10.0</li>
<li>GPU model and memory: NVIDIA GTX 1080 Ti 11GB</li>
</ul>
<p dir="auto"><strong>Describe the current behavior</strong><br>
My code is provided below.</p>
<p dir="auto">Running this code gives a directory called logs. I launch Tensorboard using <strong>tensorboard --logdir=./logs</strong><br>
I go to localhost:6006, click the Graphs tab in my browser, and I get the message saying:<br>
<strong>Graph: Failed Normalizing names</strong><br>
Tensorboard console doesn't show any errors.</p>
<p dir="auto">I'm using the MNIST Tensorboard example provided here: <a href="https://www.tensorflow.org/tensorboard/r2/graphs" rel="nofollow">https://www.tensorflow.org/tensorboard/r2/graphs</a><br>
And it doesn't work in TensorFlow 2.0. Why?</p>
<p dir="auto"><strong>Describe the expected behavior</strong><br>
I expect it to show the graph for the model.</p>
<p dir="auto"><strong>Code to reproduce the issue</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from datetime import datetime
#from packaging import version

import tensorflow as tf
from tensorflow import keras

print(&quot;TensorFlow version: &quot;, tf.__version__)

# Define the model.
model = keras.models.Sequential([
    keras.layers.Flatten(input_shape=(28, 28)),
    keras.layers.Dense(32, activation='relu'),
    keras.layers.Dropout(0.2),
    keras.layers.Dense(10, activation='softmax')
])

model.compile(
    optimizer='adam',
    loss='sparse_categorical_crossentropy',
    metrics=['accuracy'])
(train_images, train_labels), _ = keras.datasets.fashion_mnist.load_data()
train_images = train_images / 255.0

logdir=&quot;logs/fit/&quot; + datetime.now().strftime(&quot;%Y%m%d-%H%M%S&quot;)
tensorboard_callback = keras.callbacks.TensorBoard(log_dir=logdir)

# Train the model.
model.fit(
    train_images,
    train_labels, 
    batch_size=64,
    epochs=5, 
    callbacks=[tensorboard_callback])"><pre class="notranslate"><code class="notranslate">from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from datetime import datetime
#from packaging import version

import tensorflow as tf
from tensorflow import keras

print("TensorFlow version: ", tf.__version__)

# Define the model.
model = keras.models.Sequential([
    keras.layers.Flatten(input_shape=(28, 28)),
    keras.layers.Dense(32, activation='relu'),
    keras.layers.Dropout(0.2),
    keras.layers.Dense(10, activation='softmax')
])

model.compile(
    optimizer='adam',
    loss='sparse_categorical_crossentropy',
    metrics=['accuracy'])
(train_images, train_labels), _ = keras.datasets.fashion_mnist.load_data()
train_images = train_images / 255.0

logdir="logs/fit/" + datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = keras.callbacks.TensorBoard(log_dir=logdir)

# Train the model.
model.fit(
    train_images,
    train_labels, 
    batch_size=64,
    epochs=5, 
    callbacks=[tensorboard_callback])
</code></pre></div>
<p dir="auto">Attached file is zipped logs directory to be viewed with Tensorboard.<br>
<a href="https://github.com/tensorflow/tensorflow/files/3050778/logs.zip">logs.zip</a></p>
<p dir="auto">Code to reproduce:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


import shutil

import tensorflow as tf


if tf.version.VERSION.startswith('1.'):
  tf.compat.v1.enable_eager_execution()
  tf = tf.compat.v2


LOGDIR = './logs'


def main():
  shutil.rmtree(LOGDIR, ignore_errors=True)
  model = tf.keras.models.Sequential([
    tf.keras.layers.Dense(1, input_shape=(1,)),
  ])
  model.compile(loss='mse', optimizer='adagrad')
  callback = tf.keras.callbacks.TensorBoard(LOGDIR)
  model.fit(x=[[0]], y=[[0]], callbacks=[callback])


if __name__ == '__main__':
  main()"><pre class="notranslate"><span class="pl-k">from</span> __future__ <span class="pl-k">import</span> <span class="pl-s1">absolute_import</span>
<span class="pl-k">from</span> __future__ <span class="pl-k">import</span> <span class="pl-s1">division</span>
<span class="pl-k">from</span> __future__ <span class="pl-k">import</span> <span class="pl-s1">print_function</span>


<span class="pl-k">import</span> <span class="pl-s1">shutil</span>

<span class="pl-k">import</span> <span class="pl-s1">tensorflow</span> <span class="pl-k">as</span> <span class="pl-s1">tf</span>


<span class="pl-k">if</span> <span class="pl-s1">tf</span>.<span class="pl-s1">version</span>.<span class="pl-v">VERSION</span>.<span class="pl-en">startswith</span>(<span class="pl-s">'1.'</span>):
  <span class="pl-s1">tf</span>.<span class="pl-s1">compat</span>.<span class="pl-s1">v1</span>.<span class="pl-en">enable_eager_execution</span>()
  <span class="pl-s1">tf</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-s1">compat</span>.<span class="pl-s1">v2</span>


<span class="pl-v">LOGDIR</span> <span class="pl-c1">=</span> <span class="pl-s">'./logs'</span>


<span class="pl-k">def</span> <span class="pl-en">main</span>():
  <span class="pl-s1">shutil</span>.<span class="pl-en">rmtree</span>(<span class="pl-v">LOGDIR</span>, <span class="pl-s1">ignore_errors</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
  <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-s1">keras</span>.<span class="pl-s1">models</span>.<span class="pl-v">Sequential</span>([
    <span class="pl-s1">tf</span>.<span class="pl-s1">keras</span>.<span class="pl-s1">layers</span>.<span class="pl-v">Dense</span>(<span class="pl-c1">1</span>, <span class="pl-s1">input_shape</span><span class="pl-c1">=</span>(<span class="pl-c1">1</span>,)),
  ])
  <span class="pl-s1">model</span>.<span class="pl-en">compile</span>(<span class="pl-s1">loss</span><span class="pl-c1">=</span><span class="pl-s">'mse'</span>, <span class="pl-s1">optimizer</span><span class="pl-c1">=</span><span class="pl-s">'adagrad'</span>)
  <span class="pl-s1">callback</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-s1">keras</span>.<span class="pl-s1">callbacks</span>.<span class="pl-v">TensorBoard</span>(<span class="pl-v">LOGDIR</span>)
  <span class="pl-s1">model</span>.<span class="pl-en">fit</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span>[[<span class="pl-c1">0</span>]], <span class="pl-s1">y</span><span class="pl-c1">=</span>[[<span class="pl-c1">0</span>]], <span class="pl-s1">callbacks</span><span class="pl-c1">=</span>[<span class="pl-s1">callback</span>])


<span class="pl-k">if</span> <span class="pl-s1">__name__</span> <span class="pl-c1">==</span> <span class="pl-s">'__main__'</span>:
  <span class="pl-en">main</span>()</pre></div>
<p dir="auto">Expected behavior: Running this and then <code class="notranslate">tensorboard --logdir ./logs</code><br>
provides a graph visualizer that shows the Keras implementation graph.</p>
<p dir="auto">Actual behavior: On versions of TensorFlow from 2019-03-23 onward, the<br>
“Default” graph in the graph visualizer gives the error, “Graph: Failed<br>
Normalizing names”.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/4317806/55033543-a74acd80-4fd0-11e9-884c-48f7362eb189.png"><img src="https://user-images.githubusercontent.com/4317806/55033543-a74acd80-4fd0-11e9-884c-48f7362eb189.png" alt="Screenshot of error" style="max-width: 100%;"></a></p>
<p dir="auto">The stack trace in the JS console is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(index):10466 TypeError: d.list.shape.map is not a function
    at d ((index):10270)
    at new &lt;anonymous&gt; ((index):10276)
    at d ((index):10286)
    at (index):10285
    at arrayEach ((index):80)
    at Function.forEach ((index):242)
    at a ((index):10285)
    at arrayEach ((index):80)
    at Function.forEach ((index):242)
    at (index):10286"><pre class="notranslate"><code class="notranslate">(index):10466 TypeError: d.list.shape.map is not a function
    at d ((index):10270)
    at new &lt;anonymous&gt; ((index):10276)
    at d ((index):10286)
    at (index):10285
    at arrayEach ((index):80)
    at Function.forEach ((index):242)
    at a ((index):10285)
    at arrayEach ((index):80)
    at Function.forEach ((index):242)
    at (index):10286
</code></pre></div>
<p dir="auto">(On all versions, the <code class="notranslate">batch_1</code> graph gives the error, <a href="https://github.com/tensorflow/tensorboard/blob/6de38d858b4ec19ed5e4088e863a8eba737292e1/tensorboard/plugins/graph/tf_graph_loader/tf-graph-loader.ts#L193-L197">“Error: The<br>
graph is empty. […]”</a>, and the Keras conceptual graph works fine.)</p>
<p dir="auto">The problem appears to be due to a change in the emitted graphs, not a<br>
change in TensorBoard; the above-described behavior occurs independent<br>
of the TensorBoard version.</p>
<p dir="auto">The behavior is the same under tf-nightly and tf-nightly-2.0-preview<br>
(but removing the <code class="notranslate">enable_eager_execution()</code> call causes the code to<br>
work fine in tf-nightly).</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/stephanwlee/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/stephanwlee">@stephanwlee</a>; not sure whether this is a TensorBoard error or a<br>
TensorFlow problem.</p>