(转载)TensorFlow不同版本引起的错误

原文:http://blog.csdn.net/s_sunnyy/article/details/70999462

 

这几天分别基于tensorflow0.11和1.0版本测试,记录下两个版本不同的API,

参考:http://blog.csdn.NET/edwards_june/article/details/65652385

 

前4个是 V0.11 的API 用在 V1.0 的错误

1. AttributeError: 'module' object has no attribute 'merge_all_summaries'

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

或者在引用模块的时候加句话:

import tensorflow as tf
tf.merge_all_summaries = tf.summary.merge_all
tf.train.SummaryWriter = tf.summary.FileWriter

 

 

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

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

 

 

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

>> tf.scalar_summary 改为:tf.summary.scalar

 

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

>> histogram_summary 改为:tf.summary.histogram
 
下边这个是 V1.0 的API 用在 V0.11 的错误
File "dis-alexnet_benchmark.py", line 110, in alexnet_v2
    biases_initializer=tf.zeros_initializer(),
TypeError: zeros_initializer() takes at least 1 argument (0 given)
>> 将 biases_initializer=tf.zeros_initializer() 改为:biases_initializer=tf.zeros_initializer
 
posted @ 2018-03-16 16:39  奥古斯都乀  阅读(248)  评论(0编辑  收藏  举报