tensorflow / tensorflow/tensorboard

Graph: show output nodes of a model if it is not connected to any other nodes

Open
#1,992 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin:graph type:bug
Dominant language
TypeScript
Stars
7.2k
Forks
1.7k
Avg merge
4d 22h
Merged PRs (30d)
1

Description

Version: tensorflow 2.0.0a0

Python code for bug reproduction:

import numpy as np
import tensorflow as tf

print(tf.__version__)

input1 = tf.keras.Input(shape=[3, 4])

lstm = tf.keras.layers.GRU(1, return_state=True)
[output1, output2] = lstm(input1)

dense = tf.keras.layers.Dense(1)
output1 = dense(output1)

model = tf.keras.Model(inputs=input1, outputs=[output1, output2])
model.compile(loss=['mean_squared_error', 'mean_squared_error'],
              optimizer='sgd')

num_examples = 8
xs1 = np.zeros([num_examples, 3, 4])
ys1 = np.ones([num_examples, 1])
ys2 = np.zeros([num_examples, 1])

model.fit(xs1, [ys1, ys2], epochs=10,
          callbacks=[tf.keras.callbacks.TensorBoard('/tmp/foo6

Then start tensorboard:

tensorboard --logdir /tmp/foo6

Navigate to the Graph dashboard and select tag "keras". The graph looks like the following:
image

This graph is misleading in a number of ways:

  1. It doesn't indicate that the model has two outputs (output1 and output2 in the code)
  2. It doesn't indicate that the GRU (unified_gru) layer has two outputs
  3. It seems to indicate that both outputs of the GRU layer go into the dense layer, whereas in reality only the first one does and the second one is directly routed to the output of the entire model.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the Python reproduction with TensorBoard and inspect the Graph dashboard's "keras" tag. Trace how the displayed graph represents the model's output nodes and the GRU's two outputs. Done means the graph distinguishes both model outputs and shows that only the first GRU output feeds the dense layer.

Written by the indexing model from the issue text.

Assessment

Tech stack
keras, python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.