当前位置: 首页 > news >正文

tensorflow 1.14 的 demo 02 —— tensorboard 远程访问

tensorflow 1.14.0, 提供远程访问 tensorboard 服务的方法

第一步生成 events 文件:

在上一篇demo的基础上加了一句,如下,

 tf.summary.FileWriter("./tmp/summary", graph=sess1.graph)

hello_tensorboard_remote.py

import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'def tf114_demo():a = 3b = 4c = a + bprint("a + b in py =",c)a_t = tf.constant(3)b_t = tf.constant(4)c_t = a_t + b_tprint("TensorFlow add a_t + b_t =", c_t)with tf.Session() as sess:c_t_value = sess.run(c_t)print("c_t_value= ", c_t_value)return Nonedef graph_demo():a_t = tf.constant(3)b_t = tf.constant(4)c_t = a_t + b_tprint("TensorFlow add a_t + b_t =", c_t)default_g = tf.get_default_graph()print("default_g:\n",default_g)print("a_t g:", a_t.graph)print("c_t g:", c_t.graph)with tf.Session() as sess:c_t_value = sess.run(c_t)print("c_t_value= ", c_t_value)print("sess g:", sess.graph)new_g = tf.Graph()with new_g.as_default():a_new = tf.constant(20)b_new = tf.constant(30)c_new = a_new + b_newprint("c_new:", c_new)print("a_new g:",a_new.graph)print("b_new g:",c_new.graph)with tf.Session() as sess1:c_t_value = sess1.run(c_t)
#               print("c_new_value:", c_new_value)print("sess1 g:", sess1.graph)tf.summary.FileWriter("./tmp/summary", graph=sess1.graph)with tf.Session(graph=new_g) as new_sess:c_new_value = new_sess.run((c_new))print("c_new_value:", c_new_value)print("new_sess graph properties:", new_sess.graph)
#               return Noneif __name__ == "__main__":
#       tf114_demo()graph_demo()

运行 tensorflow1 的 app:

python3 hello_tensorboard_remote.py

ls ./tmp/summary/ 

启动 tensorboard 网络服务:

tensorboard --logdir="./tmp/summary" --port 6789

6789是自己选定的端口号,尝试任选;

运行状态如下:

远程访问tensorboard:

在同一个网络内的主机网页浏览器的地址栏中输入:

http://10.208.14.37:6789

效果如下,显示出来了示例中非常简单的一个计算图:

 

如果是本机访问,则在地址栏里输入

http://127.0.0.1:6006

http://www.lryc.cn/news/116690.html

相关文章:

  • Spring中Bean的循环依赖问题
  • 若依管理系统后端将 Mybatis 升级为 Mybatis-Plus
  • 剪切、复制、粘贴事件
  • Redis储存结构
  • 使用logback异步打印日志
  • ArcGIS Pro暨基础入门、制图、空间分析、影像分析、三维建模、空间统计分析与建模、python融合、案例应用
  • Rabbitmq的消息确认
  • 在飞机设计中的仿真技术
  • (2023Arxiv)Meta-Transformer: A Unified Framework for Multimodal Learning
  • 解决Python读取图片路径存在转义字符
  • Windows 安装 pandoc 将 jupyter 导出 pdf 文件
  • 混合云环境实现K8S可观测的6大策略
  • 音视频 FFmpeg命令行搭建
  • ​ORACLE wallet实现无需输入用户名与密码登陆数据库 注意修改目录权限
  • linux - 用户权限
  • 计蒜客T1115——字符串判等
  • Android Framework工具——EA画图
  • 使用MyEclipse如何部署Descriptor (XML)编辑器?
  • Codeforces Round 889 (Div. 2)C题题解
  • 无涯教程-Perl - Subroutines(子例程)
  • Rpc异步日志模块
  • python-pip
  • 无涯教程-Perl - getppid函数
  • AUTOSAR规范与ECU软件开发(基础篇)1.2 汽车电子控制系统的基本构成
  • 一个可以通过多个条件筛选的系统界面是如何实现的(springboot+mybatis)
  • WebRTC | 实现数据流的一对一通信
  • 基于MATLAB小波变换的信号突变点检测
  • JUC并发编程(JUC核心类、TimeUnit类、原子操作类、CASAQS)附带相关面试题
  • 个人用C#编写的壁纸管理器 - 开源研究系列文章
  • iTextSharp 生成PDF