TensorFlow版本不同的问题(一)

分别基于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

Namely:

In a new version of TF, all summary functions were renamed.

Summary functions have been consolidated under the tf.summary namespace.

  • tf.audio_summary should be renamed to tf.summary.audio
  • tf.contrib.deprecated.histogram_summary should be renamed to tf.summary.histogram
  • tf.contrib.deprecated.scalar_summary should be renamed to tf.summary.scalar
  • tf.histogram_summary should be renamed to tf.summary.histogram
  • tf.image_summary should be renamed to tf.summary.image
  • tf.merge_all_summaries should be renamed to tf.summary.merge_all
  • tf.merge_summary should be renamed to tf.summary.merge
  • tf.scalar_summary should be renamed to tf.summary.scalar
  • tf.train.SummaryWriter should be renamed to tf.summary.FileWriter
  •  

下边这个是 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

python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multibyte sequence

python读取文件时提示"UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multibyte sequence"

解决办法1.

FILE_OBJECT= open('order.log','r', encoding='UTF-8')

解决办法2.

  

FILE_OBJECT= open('order.log','rb')

猜你喜欢

转载自blog.csdn.net/jasminexjf/article/details/81079040