tensorflow 利用TensorBoard查看计算图
  TEZNKK3IfmPf 2024年03月29日 77 0
import tensorflow as tf

#定义计算图
g = tf.Graph()
with g.as_default():
hello = tf.constant('hello',name = 'hello')
world = tf.constant('world',name = 'world')
helloworld = tf.string_join([hello,world],name = 'join',separator=' ')

#执行计算图
with tf.Session(graph = g) as sess:
print(sess.run(fetches = helloworld,feed_dict={}))

#查看计算图
with tf.summary.FileWriter('F:\lys\my_graph') as writer:
writer.add_graph(g)

#1,在命令行中切换到 F:\lys\my_graph
#2,运行 tensorboard --logdir=my_graph
#3, 打开浏览器输入地址http://localhost:6006

或者

writer = tf.summary.FileWriter('F:\lys\my_graph', tf.get_default_graph())
writer.close()

查看

tensorflow 利用TensorBoard查看计算图

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2024年03月29日 0

暂无评论

TEZNKK3IfmPf