1.module 'tensorflow' has no attribute 'mul'

 

tf.mul已经在新版本中被移除,使用 tf.multiply 代替

 

解决方法

 

tf.mul(input1, input2) 改为 tf.multiply(input1, input2)

 

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

 

将sub换成subtract解决方案如下:

tf.sub(model.y_,model.y)变换为tf.subtract(model.y_, model.y)

 

3.tf.scalar_summary('batch_loss', loss)

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

修改为:tf.summary.scalar('batch_loss', loss)

 

4.AttributeError: 'module' object has no attribute 'histogram_summary'

修改为:tf.summary.histogram

 

5.tf.merge_all_summaries()改为:summary_op = tf.summaries.merge_all()

 

6.AttributeError: 'module' object has no attribute 'SummaryWriter'

将tf.train.SummaryWriter改为tf.summary.FileWriter

 

7.AttributeError: 'module' object has no attribute 'SummaryWriter'

 

tf.train.SummaryWriter改为:tf.summary.FileWriter

 

8.AttributeError: 'module' object has no attribute 'summaries'

 

tf.merge_all_summaries()改为:summary_op = tf.summary.merge_all()

 

9.AttributeError: 'module' object has no attribute 'histogram_summary'

 

tf.histogram_summary()改为:tf.summary.histogram()

 

10.tf.scalar_summary()改为:tf.summary.scalar()

 

 

11.tf.image_summary()改为:tf.summary.image()

 

12.merged_summary_op = tf.merge.summaries_all()改为summary_op = tf.merge.summaries_all()

 

 

posted on 2018-11-30 10:01  Fiona_Y  阅读(848)  评论(0编辑  收藏  举报