python summary writer_python – ‘module’对象没有属性’SummaryWriter’

我使用Tearsflow 0.12.head与

Python 2.7在linux CentOS 7上,当我运行这个:

import tensorflow as tf

a = tf.constant(5, name="input_a")

b = tf.constant(3, name="input_b")

c = tf.mul(a, b, name="mul_c")

d = tf.add(a, b, name="add_d")

e = tf.add(c, d, name="add_e")

sess = tf.Session()

output = sess.run(e)

writer = tf.train.SummaryWriter('./my_graph', sess.graph)

我得到这个错误:

AttributeError Traceback (most recent call last) in ()

----> 1 writer = tf.train.SummaryWriter('./my_graph', sess.graph)

AttributeError: 'module' object has no attribute 'SummaryWriter'

我已经运行了这两个命令,因为在Github上有bug issue出现同样的问题:

>>> import six

>>> print(six.__version__)

1.10.0

>>> print(dir(six.moves.queue)) ['Empty', 'Full', 'LifoQueue', 'PriorityQueue', 'Queue', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_threading', '_time', 'deque', 'heapq']

>>> print(six.moves.queue.__file__) /usr/lib64/python2.7/Queue.pyc

我在Python和Tensorflow中都是新的.你知道如何解决这个错误?

我用FileWriter更改了SummaryWriter:

writer = tf.train.FileWriter('./my_graph', sess.graph)

并且我得到相同的错误,但与FileWriter功能:

AttributeError Traceback (most recent call last)

in ()

----> 1 writer = tf.train.FileWriter('./my_graph', sess.graph)

AttributeError: 'module' object has no attribute 'FileWriter'

我也运行在终端,我得到相同的结果:

[VansFannel@localhost ~]$python

Python 2.7.5 (default, Nov 6 2016, 00:28:07)

[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow as tf

W tensorflow/core/platform/cpu_feature_guard.cc:95] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.

W tensorflow/core/platform/cpu_feature_guard.cc:95] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.

>>> a = tf.constant(5, name="input_a")

>>> b = tf.constant(3, name="input_b")

>>> c = tf.mul(a, b, name="mul_c")

>>> d = tf.add(a, b, name="add_d")

>>> e = tf.add(c, d, name="add_e")

>>> sess = tf.Session()

>>> output = sess.run(e)

>>> writer = tf.train.FileWriter('./my_graph', sess.graph)

Traceback (most recent call last):

File "", line 1, in

AttributeError: 'module' object has no attribute 'FileWriter'

>>>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值