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

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容