Yuan Ma
Yuan Ma

Reputation: 868

Tensorflow: 'module' object has no attribute 'scalar_summary'

I tried to run the following code to test my TensorBoard, however, when I ran the program, there is an error said:

'module' object has no attribute 'scalar_summary'

I want to know how can I fix this issue, thanks.

The following is the system info:

Test program and Output: enter image description here

Upvotes: 19

Views: 29144

Answers (2)

Salvador Dali
Salvador Dali

Reputation: 222751

In a new version of TF, all summary functions were renamed.

Summary functions have been consolidated under the tf.summary namespace.

  • tf.audio_summary should be renamed to tf.summary.audio
  • tf.contrib.deprecated.histogram_summary should be renamed to tf.summary.histogram
  • tf.contrib.deprecated.scalar_summary should be renamed to tf.summary.scalar
  • tf.histogram_summary should be renamed to tf.summary.histogram
  • tf.image_summary should be renamed to tf.summary.image
  • tf.merge_all_summaries should be renamed to tf.summary.merge_all
  • tf.merge_summary should be renamed to tf.summary.merge
  • tf.scalar_summary should be renamed to tf.summary.scalar
  • tf.train.SummaryWriter should be renamed to tf.summary.FileWriter

Upvotes: 30

mrry
mrry

Reputation: 126184

The tf.scalar_summary() function was moved in the master branch, after the 0.12 release. You can now find it as tf.summary.scalar().

Upvotes: 49

Related Questions