tensorflow error LossTensor is inf or nan : Tensor had Inf values

如果在TensorFlow的程序中使用了tf.log()函数,也就是求了tf.log(0) 这样值就是inf 因此会报错

解决办法:

将tf.log改为如下:

-tf.log(tf.clip_by_value(value, 1e-8, 1.0))

猜你喜欢

转载自blog.csdn.net/maka_uir/article/details/89375148
inf