I use the tensor flow on the jupyter notebook, but I can't use the tensor board.

Asked 2 years ago, Updated 2 years ago, 50 views

I'm a beginner.
I use the tensor flow on the jupyter notebook, but I can't use the tensor board.
Enter the following program on the jupyter notebook to tensorboard --logdir=/path/to/log
I typed in at the terminal, but it didn't work.
I would appreciate it if you could let me know.

import tensorflow as tf
import numpy as np
importos
LOG_DIR=os.path.join(os.path.dirname("__file__"), 'log')
ifos.path.exists(LOG_DIR) is False:
    os.mkdir(LOG_DIR)
w = tf.Variable(tf.zeros([2,1]))
b=tf.Variable(tf.zeros([1]))
x = tf.placeholder (tf.float32,shape=[None, 2])
t=tf.placeholder(tf.float32,shape=[None,1])
y = tf.nn.sigmoid(tf.matmul(x,w)+b)

cross_entropy=-tf.reduce_sum(t*tf.log(y)+(1-t)*tf.log(1-y))
train_step=tf.train.GradientDescentOptimizer (0.1).minimize(cross_entropy)

correct_prediction=tf.equal(tf.to_float(tf.greater(y,0.5)),t)
acuracy=tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

init=tf.initialize_all_variables()
sess=tf.Session()
tf.train.SummaryWriter(LOG_DIR, sess.graph)
sess.run(init)

python tensorflow

2022-09-30 17:12

1 Answers

I have read the article on the multi-post.
https://teratail.com/questions/80320

tensorboard --logdir=/path/to/log

Instead of typing /path/to/log as it is, you need to specify the log storage location for your environment.
In other words,
os.path.dirname("__file__") so this is the log folder under the script execution location


2022-09-30 17:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.