Tensorboard: ValueError: can only convert an array of size 1 to a Python scalar

Created on 16 May 2019  ·  3Comments  ·  Source: tensorflow/tensorboard

  • tensorboard 1.13.1-1 and python-tensorflow-opt-cuda 1.13.1-5 (both installed from Arch repository)
  • Fully updated Manjaro Linux (Linux 4.19.36-1-MANJARO #1 SMP PREEMPT Sat Apr 20 22:05:46 UTC 2019)
  • Python 3.7.3

I am getting the following error trying to read a directory created with tensorboardX:

I0516 14:23:07.886668 139664853743360 _internal.py:97] ::1 - - [16/May/2019 14:23:07] "GET /data/plugin/scalars/scalars?tag=val_rmse&run=2019-05-16_14-02-20.218&experiment= HTTP/1.1" 500 -
E0516 14:23:07.887801 139664853743360 _internal.py:97] Error on request:
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/werkzeug/serving.py", line 302, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3.7/site-packages/werkzeug/serving.py", line 290, in execute
    application_iter = app(environ, start_response)
  File "/usr/lib/python3.7/site-packages/tensorboard/backend/application.py", line 310, in __call__
    return self.data_applications[clean_path](environ, start_response)
  File "/usr/lib/python3.7/site-packages/werkzeug/wrappers/base_request.py", line 235, in application
    resp = f(*args[:-2] + (request,))
  File "/usr/lib/python3.7/site-packages/tensorboard/plugins/scalar/scalars_plugin.py", line 200, in scalars_route
    (body, mime_type) = self.scalars_impl(tag, run, experiment, output_format)
  File "/usr/lib/python3.7/site-packages/tensorboard/plugins/scalar/scalars_plugin.py", line 162, in scalars_impl
    for tensor_event in tensor_events]
  File "/usr/lib/python3.7/site-packages/tensorboard/plugins/scalar/scalars_plugin.py", line 162, in <listcomp>
    for tensor_event in tensor_events]
ValueError: can only convert an array of size 1 to a Python scalar

I've uploaded the corresponding tfevents file to Google Drive: https://drive.google.com/open?id=1tgeQFyXan5o71pSyzhnoqF-fWWrFKRhX

support

Most helpful comment

Hi @Pastafarianist! Thanks for the report, and thanks for including the
events file.

The events file contains both scalar and histogram summaries with the
tag val_rmse. A minimal script to generate an events file that
reproduces the problem is:

import tensorflow as tf

with tf.summary.create_file_writer("logs").as_default():
  tf.summary.scalar("loss", 0.2, step=0)
  tf.summary.histogram("loss", 0.2, step=0)  # hmmm

Each tag name is required to be uniquely associated with a summary.
Please ensure that your training script doesn’t use the same tag name
for distinct summaries.

All 3 comments

Hi @Pastafarianist! Thanks for the report, and thanks for including the
events file.

The events file contains both scalar and histogram summaries with the
tag val_rmse. A minimal script to generate an events file that
reproduces the problem is:

import tensorflow as tf

with tf.summary.create_file_writer("logs").as_default():
  tf.summary.scalar("loss", 0.2, step=0)
  tf.summary.histogram("loss", 0.2, step=0)  # hmmm

Each tag name is required to be uniquely associated with a summary.
Please ensure that your training script doesn’t use the same tag name
for distinct summaries.

Thank you for investigating the issue. Perhaps there could be an extra check to ensure a more helpful error message?

Hi @Pastafarianist! Thanks for the report, and thanks for including the
events file.

The events file contains both scalar and histogram summaries with the
tag val_rmse. A minimal script to generate an events file that
reproduces the problem is:

import tensorflow as tf

with tf.summary.create_file_writer("logs").as_default():
  tf.summary.scalar("loss", 0.2, step=0)
  tf.summary.histogram("loss", 0.2, step=0)  # hmmm

Each tag name is required to be uniquely associated with a summary.
Please ensure that your training script doesn’t use the same tag name
for distinct summaries.

It really helps

Was this page helpful?
0 / 5 - 0 ratings