TensorFlow:AttributeError:'Tensor'对象没有属性'log10' [英] TensorFlow: AttributeError: 'Tensor' object has no attribute 'log10'
本文介绍了TensorFlow:AttributeError:'Tensor'对象没有属性'log10'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在使用tensorflow和python3支持。我的代码中有一行会引发错误。
I have been using tensorflow with python3 support. There is line in my code which throws me an error.
此处的错误:
return -10. * np.log10(K.mean(K.square(y_pred - y_true)))
AttributeError:'Tensor'对象没有属性'log10'
AttributeError: 'Tensor' object has no attribute 'log10'
推荐答案
你可以这样做:
return 10.0 * K.log(1.0 / (K.mean(K.square(y_pred - y_true)))) / K.log(10.0)
这篇关于TensorFlow:AttributeError:'Tensor'对象没有属性'log10'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文