python - Tensorboard get blank page -
i'm new in tensorflow , follow tutorial learn framework.
now i'm trying visualize graph using tensorboard but tensorboard blank page without result.
the code use visualize graph is:
from __future__ import print_function import tensorflow tf import numpy np def add_layer(inputs, in_size, out_size, n_layer, activation_function=none): # add 1 more layer , return output of layer layer_name = 'layer%s' % n_layer tf.name_scope(layer_name): tf.name_scope('weights'): weights = tf.variable(tf.random_normal([in_size, out_size]), name='w') tf.summary.histogram(layer_name + '/weights', weights) tf.name_scope('biases'): biases = tf.variable(tf.zeros([1, out_size]) + 0.1, name='b') tf.summary.histogram(layer_name + '/biases', biases) tf.name_scope('wx_plus_b'): wx_plus_b = tf.add(tf.matmul(inputs, weights), biases) if activation_function none: outputs = wx_plus_b else: outputs = activation_function(wx_plus_b, ) tf.summary.histogram(layer_name + '/outputs', outputs) return outputs # make real data x_data = np.linspace(-1, 1, 300)[:, np.newaxis] noise = np.random.normal(0, 0.05, x_data.shape) y_data = np.square(x_data) - 0.5 + noise # define placeholder inputs network 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, n_layer=1, activation_function=tf.nn.relu) # add output layer prediction = add_layer(l1, 10, 1, n_layer=2, activation_function=none) # error between prediciton , real data tf.name_scope('loss'): loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction), reduction_indices=[1])) tf.summary.scalar('loss', loss) tf.name_scope('train'): train_step = tf.train.gradientdescentoptimizer(0.1).minimize(loss) sess = tf.session() merged = tf.summary.merge_all() writer = tf.summary.filewriter("logs/", sess.graph) init = tf.global_variables_initializer() sess.run(init) in range(1000): sess.run(train_step, feed_dict={xs: x_data, ys: y_data}) if % 50 == 0: result = sess.run(merged, feed_dict={xs: x_data, ys: y_data}) writer.add_summary(result, i)
i'm using ubuntu 16.04 python 2.7 , tensorflow version 1.0.1.
when run program created new log file, , after use theis command visualize tensorboard:
tensorboard --logdir=/logs
then if go http://127.0.1.1:6006/ tensorboard page without summary, why?
i try use browser not works.
you saving logs folder @ place running ipython notebook. however, tensorboard tries load /logs folder (instead of /users/something/logs). try --logdir=./logs
Comments
Post a Comment