TensorFlow: AttributeError: 'Tensor' object has no attribute 'log10'

孤人 提交于 2019-12-10 22:58:47

问题


I have been using tensorflow with python3 support. There is line in my code which throws me an error.

The error here :

return -10. * np.log10(K.mean(K.square(y_pred - y_true)))

AttributeError: 'Tensor' object has no attribute 'log10'


回答1:


you can do like this:

return 10.0 * K.log(1.0 / (K.mean(K.square(y_pred - y_true)))) / K.log(10.0)


来源:https://stackoverflow.com/questions/41826531/tensorflow-attributeerror-tensor-object-has-no-attribute-log10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!