简体   繁体   中英

AttributeError: __enter__ -stackoverflow

I'm writing a python program and run in Google Colaboratory. But it failed to pass the compiling and gave the AttributeError. Any body can help me? Thanks a lot.

 total = []
 with tf.compat.v1.Session as sess:
      sess.run(init_op)
      writer = tf.compat.v1.summary.FileWriter('graphs',sess.graph)

AttributeError: enter

将括号添加到Session

with tf.compat.v1.Session() as sess:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM