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



作者:嫩芽33
链接:https://www.jianshu.com/p/bac16643d571
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

猜你喜欢

转载自blog.csdn.net/m0_37870649/article/details/80992096