When I try to make tensorboard, Syntax error comes out. I can not understand in spite of open source code. I tried to search about code for tensorboard but It's unclear.
Even I'm not good at python. I write the path in this way, C:\\Users\\jh902\\Documents\\.logs
because I'm using Windows 10 but I'm not sure. (I used double back slash but in this monitor it seems like one slash).
If I code like this,
tensorboard --logdir="C:\Users\\jh902\\Documents\\.logs"
this error message comes out
File "<ipython-input-32-4b130bd6177b>", line 1
tensorboard --logdir="C:\Users\\jh902\\Documents\\.logs"
^
SyntaxError: can't assign to operator
What's the problem?
# cost/loss function
cost = tf.reduce_mean(tf.square(hypothesis - Y))
# Minimize/Optimizer
optimizer = tf.train.AdamOptimizer(learning_rate=1e-5)
train = optimizer.minimize(cost)
# Launch the graph in a session.
sess = tf.Session()
w2_hist=tf.summary.histogram("weight2",W2)
cost_summ=tf.summary.scalar("cost",cost)
summary=tf.summary.merge_all()
#Create Summary writer
writer=tf.summary.FileWriter("C:\\Users\\jh902\\Documents\\.logs")
writer.add_graph(sess.graph)
# Initializes global variables in the graph.
sess.run(tf.global_variables_initializer())
# Fit the Line with new training data
for step in range(1001):
s, cost_val, hy_val, _ = sess.run([summary, cost, hypothesis, train], feed_dict={X: x_data, Y: y_data})
writer.add_summary(s, global_step=step)
if step % 100 == 0:
print(step, "Cost: ", cost_val, "Prediction: ", hy_val)
tensorboard --logdir=C:\\Users\\jh902\\Documents\\.logs
File "<ipython-input-29-82d09538d544>", line 1
tensorboard --logdir=C:\\Users\\jh902\\Documents\\.logs
^
SyntaxError: invalid syntax
Try define variable in Python something like
logs_path = /tmp/logs/1
Then define your writer like this
writer = tf.summary.FileWriter(logs_path,graph=tf.get_default_graph())
Then in Command Prompt run command
tensorboard --logdir = /tmp/logs/1
Is a console command, you will have to run it from window's cmd.
the problem could be, you are missing an extra slash '\' after
C:
try: