tensorflow gradient - getting all nan values
问题 I am using python 3 with anaconda, and tensorflow 1.12 with eager eval. I am using it to create a triplet loss function for a siamese network, and need to calculate distance between different data samples. I created a function in order to create the distance calculation, but no matter what I do, when I try to calculate it's gradient with respect to the networks output, It keeps giving me all nan gradient. This is the code: def matrix_row_wise_norm(matrix): import tensorflow as tf tensor = tf