TypeError:run()缺少1个必需的位置参数:Session.run()上的'fetches'

gga*_*ano 7 python windows tensorflow

我是tensorflow的新手,我正在尝试按照这个入门教程.但是在"ex001.py"脚本中执行这个非常简单的代码:

import tensorflow as tf

sess = tf.Session
hello = tf.constant('Hello, TensorFlow!')
print(hello)
print(sess.run(hello))
Run Code Online (Sandbox Code Playgroud)

我得到以下输出

Tensor("Const:0",shape =(),dtype = string)Traceback(最近一次调用最后一次):文件"C:\ Users\Giuseppe\Desktop\ex001.py",第6行,打印(sess.run) (你好))TypeError:run()缺少1个必需的位置参数:'fetches'

我已经检查了tf.Session.run()语法,但看起来没错,我找不到任何有同样问题的人.

我正在运行此配置:

  • Windows 7 Professional sp1 64位
  • Python 3.5.3 64位
  • Tensorflow 1.0.1 cpu版本

提前致谢

xxi*_*xxi 21

sess = tf.Session,应该是tf.Session(),你错过了()