How to check NaN in gradients in Tensorflow when updating?

后端 未结 2 1955
借酒劲吻你
借酒劲吻你 2021-01-03 04:38

All,

When you train a large model with large amount samples, some samples may be cause NaN gradient when parameter updating.

And I want to find these samples

2条回答
  •  天命终不由人
    2021-01-03 04:55

    You could use tf.is_nan in combination with tf.cond to only execute the rest of your code if the loss is not NaN.

提交回复
热议问题