title: RuntimeError: Attempting to capture an EagerTensor without building a function
body: <p>I use <code>tf.data.datset</code> API and use residual network. When I run code for TensorBoard for visualizing my embeddings I have this error, but when I use a two layers network I don't have this problem.</p>
  
  <pre><code>def load_and_preprocess_from_path_label(path, label):
      return load_and_preprocess_image(path), label
  
  ds = tf.data.Dataset.from_tensor_slices((all_image_paths, all_image_labels))
  with tf.Session() as sess:
      # TODO (@omoindrot): remove the hard-coded 10000
      # Obtain the test labels
      image_label_ds = ds.map(load_and_preprocess_from_path_label)
      ds = image_label_ds.shuffle(image_count)
  </code></pre>
  
  <hr>
  
  <pre><code>RuntimeError                              Traceback (most recent call last)
  &lt;ipython-input-41-ead5d6a54baa&gt; in &lt;module&gt;()
       92         # TODO (@omoindrot): remove the hard-coded 10000
       93         # Obtain the test labels
  ---&gt; 94         image_label_ds = ds.map(load_and_preprocess_from_path_label)
       95         ds = image_label_ds.shuffle(image_count)
       96 
  RuntimeError: Attempting to capture an EagerTensor without building a function.
  </code></pre>