类型错误: run() 缺少 1 个必需的位置参数: 'fetches' 在 Session.run() 上



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

import tensorflow as tf
sess = tf.Session
hello = tf.constant('Hello, TensorFlow!')
print(hello)
print(sess.run(hello))

我得到以下输出

Tensor("Const:0", shape=((, dtype=string( 回溯(最近一次调用(: 文件 "C:\Users\Giuseppe\Desktop\ex001.py",第 6 行,在 print(sess.run(hello(( 类型错误:run(( 缺少 1 个必需的位置参数:"fetches">

我已经检查了 tf。Session.run(( 语法,但看起来正确,我没有找到有相同问题的人。

我正在运行此配置:

  • 视窗 7 专业版 sp1 64 位
  • 蟒蛇 3.5.3 64 位
  • 张量流 1.0.1 CPU 版本

提前致谢

不是sess = tf.Session,应该是tf.Session(),你缺少()

sess = tf.会话行的会话语法不正确。它应该是

SESS = TF。会话((

(( 缺失。

最新更新