tensorboard_还出现报错,找不到流_先跳过
2017-12-12 21:34
134 查看
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2017-12-10 16:18:28 # @Author : Lebhoryi@gmail.com # @Link1 : http://blog.csdn.net/xuan_zizizi/article/details/77815986 # @Link2 : https://morvanzhou.github.io/tutorials/machine-learning/tensorflow/3-1-add-layer/ # @Version : tensorflow_tensorboard import tensorflow as tf def add_layer(inputs, in_size, out_size, activation_function=None): # add one more layer and return the output of this layer with tf.name_scope('layer'): with tf.name_scope('weights'): Weights = tf.Variable(tf.random_normal([in_size, out_size]), name='W') with tf.name_scope('biases'): biases = tf.Variable(tf.zeros([1, out_size]) + 0.1, name='b') with tf.name_scope('Wx_plus_b'): Wx_plus_b = tf.add(tf.matmul(inputs, Weights), biases) if activation_function is None: outputs = Wx_plus_b else: outputs = activation_function(Wx_plus_b) return outputs # define placeholder for inputs to network with tf.name_scope('inputs'): xs = tf.placeholder(tf.float32, [None, 1], name = 'x_input') ys = tf.placeholder(tf.float32, [None, 1], name = 'y_input') # add hidden layer l1 = add_layer(xs, 1, 10, activation_function=tf.nn.relu) # add output layer prediction = add_layer(l1, 10, 1, activation_function=None) # the error between prediciton and real data with tf.name_scope('loss'): loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction), reduction_indices=[1]),name = 'mean') with tf.name_scope('train'): train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss) sess = tf.Session() # tf.train.SummaryWriter soon be deprecated, use following # if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1: # tensorflow version < 0.12 writer = tf.train.SummaryWriter('20171210/', sess.graph) # else: # tensorflow version >= 0.12 # file_writer = tf.summary.FileWriter("20171210/", sess.graph) # tf.initialize_all_variables() no long valid from # 2017-03-02 if using tensorflow >= 0.12 ## if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1: ## init = tf.initialize_all_variables() ## else: init = tf.global_variables_initializer() sess.run(init) # direct to the local dir and run this in terminal: # $ tensorboard --logdir=logs
相关文章推荐
- 【tensorboard】tensorboard的启动步骤及出现的问题汇总
- Tensorflow(5) 使用 tensorboard 出现locale.Error: unsupported locale setting错误
- 解决根据tensorboard调用events.out.tfevents文件得到网址出现No dashboards are active for the current data set问题
- Tensorboard出现空白页解决方案
- Tensorboard 在win10上出现 path /[[_traceDataUrl]] not found, sending 404
- tensorboard找不到文件问题(windows10)
- TensorBoard 出现 No scalar data was found
- 【TensorBoard】运行TensorBoard出现的错误汇总及相关的解决方案
- 解决本地tensorboard找不到命令的问题
- 解决在linux 系统下使用 tensorboard 命令出现 not command
- mac使用TensorFlowBoard时出现unsupported locale setting问题
- 学习笔记TF007:Tensor、Graph、Op、Variable、占位符、Session、名称作用域、Board综合例子
- 第一阶段-入门详细图文讲解tensorflow1.4 -(十一)TensorBoard Histogram Dashboard
- Eclipse开发STM32出现找不到函数的情况的解决方法
- eclipse中导入项目出现小红叉却找不到错误之处的解决办法
- javabean出现找不到属性值的问题解决
- IDEA环境下创建基于Maven的Web项目出现找不到资源文件的问题
- Tensorboard初步
- TensorFlow 教程 --进阶指南--3.9TensorBoard: 图表可视化
- WinPE安装系统时出现安装程序找不到有效系统分区问题解决方法