Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tf.summary.histogram fails with TypeError: __init__() got an unexpected keyword argument 'values' #1993

Closed
Daniel451 opened this issue Mar 10, 2019 · 3 comments

Comments

@Daniel451
Copy link

  • TensorBoard version (from pip package, also printed out when running tensorboard)
    -- TensorBoard 1.14.0a20190301
  • TensorFlow version if different from TensorBoard
    -- TensorFlow-gpu 2.0-alpha
  • OS Platform and version (e.g., Linux Ubuntu 16.04)
    -- Linux, Arch, Kernel 4.19
  • Python version (e.g. 2.7, 3.5)
    -- Python 3.6.7

I have built a GAN with TF 2.0-alpha using tf.keras. I am using TensorBoard via train_writer = tf.summary.create_file_writer("log-train"). Adding scalars with tf.summary.scalar("loss g", loss_g, step=batch_id) and storing predicted images with tf.summary.image("g pred", prediction[0:3], step=batch_id) works without any problems.

However, when I try to add the generator's weights to TensorBoard with tf.summary.histogram it fails.

for layer in G_model.layers:
    for weight in layer.weights:
        tf.summary.histogram(weight.name, weight, step=batch_id)

G_model is a tf.keras model created with the functional API.

The exception seems to be TensorBoard-specific:

Traceback (most recent call last):
  File "train.py", line 84, in <module>
    tf.summary.histogram(weight.name, weight, step=batch_id)
  File "(...)/python3.6/site-packages/tensorboard/plugins/histogram/summary_v2.py", line 73, in histogram
    tensor = _buckets(data, bucket_count=buckets)
  File "(...)/python3.6/site-packages/tensorboard/plugins/histogram/summary_v2.py", line 91, in _buckets
    with tf.name_scope('buckets', values=[data, bucket_count]):
TypeError: __init__() got an unexpected keyword argument 'values'

If I simply delete , values=[data, bucket_count] in summary_v2.py (line 91) it works, weights are showing up correctly in TensorBoard then.

Thus, original code of summary_v2.py in line 91:

with tf.name_scope('buckets', values=[data, bucket_count]):

throws the exception posted above, while this code:

with tf.name_scope('buckets'):

is working properly.

@wchargin
Copy link
Contributor

Hi @Daniel451! Thanks for the report; I can reproduce this.

This should be fixed by #1933, which did not make it into the
1.14.0a20190301 version of TensorBoard bundled with the TF 2.0 alpha,
but did make it into the next day’s 1.14.0a20190302.

We can push a patch release 1.14.0a20190301.post001 that would; cc
@nfelt @stephanwlee as to whether we want to do this, noting that we
also considered cherry-picking #1945.

@nfelt
Copy link
Contributor

nfelt commented Mar 11, 2019

@Daniel451 just to be clear, for now a workaround is to pip install --upgrade tb-nightly which will get you a version of the nightly TensorBoard build that includes the fix for this in #1933.

@Harshini-Gadige
Copy link

Harshini-Gadige commented Mar 13, 2019

Closing this issue as this should be resolved with tb-nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants