Tensorflow Error

# -*- coding:utf-8 -*-


AttributeError: 'module' object has no attribute 'image_summary'

tf.image_summary()改为tf.summary.image()


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

tf.histogram_summary()改为tf.summary.histogram()


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

tf.scalar_summary()    tf.summary.scalar()


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

tf.merge_all_summaries()  tf.summary.merge_all()


ValueError: Only call `softmax_cross_entropy_with_logits` with named arguments (labels=..., logits=..., ...)

函数中参数(y,y_) 改为(labels=y_, logits=y)


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

tf.train.SummaryWriter()改为tf.summary.FileWriter()


ImportError: No module named Tkinter  原因在于显示不了图形界面

将import matplotlib.pyplot as plt 改为

import matplotlib

matplotlib.use('Agg')

之后将要显示的图直接存下来

from matplotlib.pyplot import plot,savefig

plot(train_X,train_Y,'ro',label='Original data')

savefig(' Original data.jpg')


tf.initialize_all_variables()改为tf.global_variables_initializer()


AttributeError: 'module' object has no attribute 'select'

将 tf.select()  改为  tf.where()

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容