sess.run - 带有字符串变量名的 Sess.run
问题描述
我一直在研究《Tensor flow for Dummies》这本书,有一段代码可以恢复之前存储的变量
使用 tf.Session() 作为 sess:
# Load stored graph into current graph
saver = tf.train.import_meta_graph('output.meta')
# Restore variables into graph
saver.restore(sess, os.getcwd() + '/output')
# Display value of variable
print('Variable value: ', sess.run('x_result:0'))
在这里,变量被定义为文本名称为“x_result”,但是在最后一行中,我们通过“x_result:0”调用变量,“:0”是什么意思。此外,当我删除“:0”时,我没有得到所需的结果。请帮助我了解 ':0' 的所有用途
解决方案
推荐阅读
- python - Networkx:将 MultiDiGraph 转换为 DiGraph
- android - 如何从 ExoPlayer2 中的实时视频中获取比特率
- excel - 使用在下拉列表中选择的单元格编号将行导出到 PDF/Word
- android - 应用程序无法在 Api 19 Android KitKat 4.4 中运行
- css - 覆盖我无法访问的 CSS 引导属性
- java - Java:生成一个随机值,然后将 1 添加到另一个变量中的值
- java - 启动 Springboot 时 bean 中的 StackOverflowError
- linux - 大括号中的 Bash 脚本奇怪的转义和磅符号
- python - 如何检查 MongoEngine 中的查询返回空对象?
- java - 从嵌套的 json 数据返回索引值