title: Visualizing a Keras Model with Tensorboard in Tensorflow 2.0
body: <p>I am learning to visualize a Keras model using Tensorboard with Tensorflow 2.0</p>
  
  <p>For a reproducible example:</p>
  
  <pre><code>inputs = Input(shape = (train_data.shape[1], ))
  x1 = Dense(100, kernel_initializer = 'he_normal', activation = 'elu')(inputs)
  x1a = Dropout(0.5)(x1)
  x2 = Dense(100, kernel_initializer = 'he_normal', activation = 'elu')(x1a)
  x2a = Dropout(0.5)(x2)
  x3 = Dense(100, kernel_initializer = 'he_normal', activation = 'elu')(x2a)
  x3a = Dropout(0.5)(x3)
  x4 = Dense(100, kernel_initializer = 'he_normal', activation = 'elu')(x3a)
  x4a = Dropout(0.5)(x4)
  x5 = Dense(100, kernel_initializer = 'he_normal', activation = 'elu')(x4a)
  predictions = Dense(1)(x5)
  model = Model(inputs = inputs, outputs = predictions)
  
  @tf.function
  def traceme(x):
      return model(x)
  
  
  logdir = "log"
  writer = tf.summary.create_file_writer(logdir)
  tf.summary.trace_on(graph=True, profiler=True)
  # Forward pass
  traceme(tf.zeros((1, train_data.shape[1])))
  with writer.as_default():
      tf.summary.trace_export(name="model_trace", step=0, profiler_outdir=logdir)
  </code></pre>
  
  <p>How can I proceed from this point to get the visualization?</p>
  
  <hr>
  
  <p>When I run the command from  my Jupyter Notebook I get an error message:</p>
  
  <pre><code>%load_ext tensorboard.notebook
  %tensorboard --logdir logs
  
  ERROR: Failed to launch TensorBoard (exited with 1).
  Contents of stderr:
  c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
    from ._conv import register_converters as _register_converters
  Traceback (most recent call last):
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Scripts\tensorboard.exe\__main__.py", line 5, in &lt;module&gt;
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\tensorboard\main.py", line 44, in &lt;module&gt;
      from tensorboard import default
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\tensorboard\default.py", line 36, in &lt;module&gt;
      from tensorboard.plugins.beholder import beholder_plugin
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\tensorboard\plugins\beholder\__init__.py", line 15, in &lt;module&gt;
      from tensorboard.plugins.beholder.beholder import Beholder
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\tensorboard\plugins\beholder\beholder.py", line 199, in &lt;module&gt;
      class BeholderHook(tf.estimator.SessionRunHook):
  AttributeError: module 'tensorflow' has no attribute 'estimator'
  </code></pre>
  
  <p>When I run it from the terminal window again I get an exception:</p>
  
  <p><a href="https://i.stack.imgur.com/ny8SB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ny8SB.png" alt="enter image description here"></a></p>
  
  <pre><code>(base) C:\WINDOWS\system32&gt;tensorboard --logdir log
  c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
    from ._conv import register_converters as _register_converters
  Traceback (most recent call last):
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Scripts\tensorboard.exe\__main__.py", line 5, in &lt;module&gt;
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\tensorboard\main.py", line 44, in &lt;module&gt;
      from tensorboard import default
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\tensorboard\default.py", line 36, in &lt;module&gt;
      from tensorboard.plugins.beholder import beholder_plugin
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\tensorboard\plugins\beholder\__init__.py", line 15, in &lt;module&gt;
      from tensorboard.plugins.beholder.beholder import Beholder
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\tensorboard\plugins\beholder\beholder.py", line 199, in &lt;module&gt;
      class BeholderHook(tf.estimator.SessionRunHook):
  AttributeError: module 'tensorflow' has no attribute 'estimator'
  </code></pre>