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')

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值