BinRoot / TensorFlow-Book

Accompanying source code for Machine Learning with TensorFlow. Refer to the book for step-by-step explanations.
http://www.tensorflowbook.com
MIT License
4.45k stars 1.21k forks source link

CHP 2 Tensorboard attribute error #30

Closed BiceCold closed 6 years ago

BiceCold commented 6 years ago

Hello,

I've been searching all over for a solution to this and can't come up with anything. In Listing 2.16 there is an issue. When I copy from the example I get this error:


AttributeError Traceback (most recent call last)

in () 17 with tf.Session() as sess: 18 sess.run(init) ---> 19 sess.add_graph(sess.graph) 20 for i in range(len(raw_data)): 21 summary_str, curr_avg = sess.run([merged, update_avg], feed_dict={curr_value: raw_data[i]}) AttributeError: 'Session' object has no attribute 'add_graph'
ilyaperepelitsa commented 6 years ago

@BiceCold Did you figure it out? seems like this book is filled with typos and no one bothered to check the code before printing=(((

mikecarroll commented 6 years ago

@ilyaperepelitsa @BiceCold Yeah, it's a mistake. You need to change sess.add_graph(sess.graph) to writer.add_graph(sess.graph). If you Google around, the add_graph() method exists on the FileWriter class.