Tensorflow CIFAR-10训练例子报错解决
2017-06-09 16:20
369 查看
这些问题都是由于tensorflow版本的原因,大家可以看一下自己tensorflow版本
我的tensorflow版本是1.0.0,一般在1.0.0以上的版本都会有这些问题。对于0.12一下版本的不会出现,这些仅供大家参考
AttributeError: ‘module’ object has no attribute ‘SummaryWriter’
tf.train.SummaryWriter改为:tf.summary.FileWriter
AttributeError: ‘module’ object has no attribute ‘summaries’
tf.merge_all_summary()改为:summary_op = tf.summary.merge_all()
tf.histogram_summary(var.op.name, var)
AttributeError: ‘module’ object has no attribute ‘histogram_summary’
改为: tf.summaries.histogram()
tf.scalar_summary(l.op.name + ’ (raw)’, l)
AttributeError: ‘module’ object has no attribute ‘scalar_summary’
tf.scalar_summary(‘images’, images)改为:tf.summary.scalar(‘images’, images)
tf.image_summary(‘images’, images)改为:tf.summary.image(‘images’, images)
ValueError: Only call
cross_entropy = tf.nn.softmax_cross_entropy_with_logits(
logits, dense_labels, name=’cross_entropy_per_example’)
改为:
cross_entropy = tf.nn.softmax_cross_entropy_with_logits(
logits=logits, labels=dense_labels, name=’cross_entropy_per_example’)
TypeError: Using a
if grad: 改为 if grad is not None:
ValueError: Shapes (2, 128, 1) and () are incompatible
concated = tf.concat(1, [indices, sparse_labels])改为:
concated = tf.concat([indices, sparse_labels], 1)
File”tensorflow/models/slim/preprocessing/cifarnet_preproces.py”, line70, in preprocess_for_train
return tf.image.per_image_whitening(distorted_image)
AttributeError: ‘module’ object has no attribute’per_image_whitening’
‘per_image_whitening 改为:’per_image_standardization
tensorflow:AttributeError: ‘module’ object has noattribute ‘mul’
tf.mul改为:tf.multiply
出现这些问题的每一个函数都得改变,不然还是会报错
python import tensorflow as tf tf.__version__
我的tensorflow版本是1.0.0,一般在1.0.0以上的版本都会有这些问题。对于0.12一下版本的不会出现,这些仅供大家参考
AttributeError: ‘module’ object has no attribute ‘SummaryWriter’
tf.train.SummaryWriter改为:tf.summary.FileWriter
AttributeError: ‘module’ object has no attribute ‘summaries’
tf.merge_all_summary()改为:summary_op = tf.summary.merge_all()
tf.histogram_summary(var.op.name, var)
AttributeError: ‘module’ object has no attribute ‘histogram_summary’
改为: tf.summaries.histogram()
tf.scalar_summary(l.op.name + ’ (raw)’, l)
AttributeError: ‘module’ object has no attribute ‘scalar_summary’
tf.scalar_summary(‘images’, images)改为:tf.summary.scalar(‘images’, images)
tf.image_summary(‘images’, images)改为:tf.summary.image(‘images’, images)
ValueError: Only call
softmax_cross_entropy_with_logitswith named arguments (labels=…, logits=…, …)
cifar10.loss(labels, logits) 改为:cifar10.loss(logits=logits, labels=labels)
cross_entropy = tf.nn.softmax_cross_entropy_with_logits(
logits, dense_labels, name=’cross_entropy_per_example’)
改为:
cross_entropy = tf.nn.softmax_cross_entropy_with_logits(
logits=logits, labels=dense_labels, name=’cross_entropy_per_example’)
TypeError: Using a
tf.Tensoras a Python
boolis not allowed. Use
if t is not None:instead of
if t:to test if a tensor is defined, and use TensorFlow ops such as tf.cond to execute subgraphs conditioned on the value of a tensor.
if grad: 改为 if grad is not None:
ValueError: Shapes (2, 128, 1) and () are incompatible
concated = tf.concat(1, [indices, sparse_labels])改为:
concated = tf.concat([indices, sparse_labels], 1)
File”tensorflow/models/slim/preprocessing/cifarnet_preproces.py”, line70, in preprocess_for_train
return tf.image.per_image_whitening(distorted_image)
AttributeError: ‘module’ object has no attribute’per_image_whitening’
‘per_image_whitening 改为:’per_image_standardization
tensorflow:AttributeError: ‘module’ object has noattribute ‘mul’
tf.mul改为:tf.multiply
出现这些问题的每一个函数都得改变,不然还是会报错
相关文章推荐
- Tensorflow CIFAR-10训练例子报错解决
- Tensorflow CIFAR-10训练例子报错解决
- TensorFlow CIFAR-10训练例子报错解决(亲测有效)
- Tensorflow CIFAR-10训练例子报错解决
- TensorFlow学习笔记(九):CIFAR-10训练例子报错解决
- Tensorflow+CIFAR-10实例讲解
- 【学习笔记】机器学习之用TensorFlow cnn 测试CIFAR-10数据集
- Tersorflow CIFAR-10 训练示例报错及解决方案
- 运行tensorflow cifar10教程时,cifar-10-binary.tar.gz下载太慢,自己下载并解压方法
- tensorflow cifar_10 代码阅读与理解
- 卷积网络训练太慢?Yann LeCun:已解决CIFAR-10,目标 ImageNet
- TensorFlow CNN 测试CIFAR-10数据集
- TensorFlow CIFAR-10数据集
- 卷积网络训练太慢?Yann LeCun:已解决CIFAR-10,目标 ImageNet
- 清新脱俗的TensorFlow CIFAR10例程的代码重构——更简明更快的数据读取、loss accuracy实时输出
- Tensorflow cifar例子错误
- TensorFlow CNN 测试CIFAR-10数据集
- Tensor Flow textum 使用过程中 遇到的问题和解决
- Tensorflow cifar模型源码