gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 22:30:59 25 4
gpt4 key购买 nike

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

这里的错误:

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

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)

关于python - TensorFlow: AttributeError: 'Tensor' 对象没有属性 'log10',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41826531/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com