「現場で使える!TensorFlow開発入門」という発売されたばかりの本で、グラフを可視化するための
以下のコードを実施したのですが、AttributeError: __enter__という見たことのないエラーが出てきます。
エラーを見てもどこが悪いかわからず、対応方法を教えていただけないでしょうか?
(環境:MacOS、TensorFlow1.1.0、Python3.6.5)
import tensorflow as tf LOG_DIR = './logs' a = tf.constant(1, name='a') b = tf.constant(1, name='b') c = a + b graph = tf.get_default_graph() with tf.summary.FileWriter(LOG_DIR) as writer: writer.add_graph(graph)
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-3cc8bfda43d6> in <module>() 9 10 graph = tf.get_default_graph() ---> 11 with tf.summary.FileWriter(LOG_DIR) as writer: 12 writer.add_graph(graph) AttributeError: __enter__
上記リンクによるとこの書籍で動かしているtensorflowのversionは1.5.0のようです
回答2件
あなたの回答
tips
プレビュー