AttributeError

作者: _sunnyRain | 来源:发表于2018-04-01 17:24 被阅读0次

    错误:

    AttributeError Traceback (most recent call last) in () 1 sess = tf.Session()----> 2 writer = tf.train.SummaryWriter("logs/,sess.graph")AttributeError: module 'tensorflow.python.training.training' has no attribute 'SummaryWriter'

    解决:

    这是因为在1.0版本中,tf.train.SummaryWriter已经改为tf.summary.FileWriter


    错误:

    In [21]: sub = tf.sub(x,a)---------------------------------------------------------------------------AttributeError Traceback (most recent call last)in()

    ----> 1 sub = tf.sub(x,a)

    AttributeError: module 'tensorflow' has no attribute 'sub'

    解决:

    改成:sub = tf.subtract(x,a)


    错误:

    AttributeError: module 'tensorflow' has no attribute 'histogram_summary'

    解决:

    改成:tf.summary.histogram()


    错误:

    AttributeError: module 'tensorflow' has no attribute 'scalar_summary'

    解决:

    改成:tf.summary.scalar('loss',loss)


    错误:

    AttributeError: module 'tensorflow' has no attribute 'merge_all_summaries'

    解决:

    改成:tf.summary.merge_all()


    错误:

    ---------------------------------------------------------------------------AttributeError Traceback (most recent call last) in ()----> 1 with tf.Session as sess: 2 sess.run(init) 3 for _ in range(3): 4 sess.run(update) 5 print(sess.run(state))AttributeError: __exit__

    解决:

    把 with tf.Session as sess: 改成 sess = tf.Session() 


    相关文章

      网友评论

        本文标题:AttributeError

        本文链接:https://www.haomeiwen.com/subject/iylacftx.html