TensorFlow:AttributeError:' Tensor'对象没有属性' log10'

时间:2017-01-24 11:03:17

标签: python image-processing tensorflow python-3.5 keras

我一直在使用tensorflow和python3支持。我的代码中有一行会引发错误。

这里的错误:

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

属性错误:' Tensor'对象没有属性' log10'

1 个答案:

答案 0 :(得分:4)

你可以这样做:

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