TensorFlow不同版本引起的錯誤

__Sunny__發表於2017-04-30

這幾天分別基於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()


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

相關文章