AttributeError: the 'module' object does not have the 'merge_all_summaries' attribute

Ubuntu 14.04.

Python 2.7.13 :: Anaconda custom (64-bit)

I installed Tensorflow following the guide: https://www.tensorflow.org/install/

when i introduce

~ / anaconda2 / Library / python2.7 / site packages / tensorflow / examples / tutorials / mnist

and try to run an existing python file:

fully_connected_feed.py

I met below AttributeError :

:~/anaconda2/lib/python2.7/site-packages/tensorflow/examples/tutorials/mnist$ python fully_connected_feed.py 
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Extracting Mnist_data/train-images-idx3-ubyte.gz
Extracting Mnist_data/train-labels-idx1-ubyte.gz
Extracting Mnist_data/t10k-images-idx3-ubyte.gz
Extracting Mnist_data/t10k-labels-idx1-ubyte.gz
Traceback (most recent call last):
  File "fully_connected_feed.py", line 229, in <module>
    tf.app.run()
  File "/home/hok/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "fully_connected_feed.py", line 225, in main
    run_training()
  File "fully_connected_feed.py", line 154, in run_training
    summary_op = tf.merge_all_summaries()
AttributeError: 'module' object has no attribute 'merge_all_summaries'

But the same code successfully runs on another computer. Therefore, I believe that this is a configuration problem on my computer.

I followed the same steps to install tensorflow many times and use it to run Deep Learning over a period of time. But I first encountered such a problem.

Google , AttributeError python. .

+4
4

fooobar.com/questions/503843/... : . https://www.tensorflow.org/install/migration. ,

- tf.merge_summary
    - should be renamed to tf.summary.merge
- tf.train.SummaryWriter
    - should be renamed to tf.summary.FileWriter

( SummaryWriter.) , ,

import tensorflow as tf
tf.merge_all_summaries = tf.summary.merge_all
tf.train.SummaryWriter = tf.summary.FileWriter

( Keras + TensorFlow: "module" tensorflow " 'merge_all_summaries' '" .)

+5

Tensorflow API Python, , .. _connected_feed.py

tf.merge_all_summaries() tf.summary.merge_all()

Tensorflow

tf.summary.merge_all()

,

tf.merge_all_summaries()
0
source

It worked for me

import tensorflow as tf
tf.merge_all_summaries = tf.compat.v1.summary.merge_all
tf.train.SummaryWriter = tf.compat.v1.summary.FileWriter
0
source

Source: https://habr.com/ru/post/1670910/


All Articles