【持续更新】那些年de过的tensorflow版本升级报错
最近基于之前的大佬写过的代码,用tensorflow在写一个聊天机器人,因为版本的原因,收集到了很多报错信息,将解决方法汇总了一下,方便以后查看。
-
AttributeError: ‘module’ object hasno attribute ‘histogram_summary’
解决方法:tf.histogram_summary() 改为: tf.summaries.histogram()
-
ValueError: Only call sigmoid_cross_entropy_with_logits with named arguments (labels=…, logits=…, …)
解决方法:
loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(output,Y))
改为
loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(labels=output,logits=Y))
-
AttributeError: module ‘tensorflow’ has no attribute ‘batch_matmul’
解决方法:batch_matmul() 改为 matmul()
-
AttributeError: module ‘tensorflow’ has no attribute ‘pack’
解决方法:pack() 改为 stack()
-
TypeError: Expected int32, got list containing Tensors of type ‘_Message’ instead.