ValueError: No gradients provided for any variable

This problem is caused by the following line: tf.nn.softmax_cross_entropy_with_logits(labels=activation, logits=Y)

Based on documentation you should have

labels: Each row labels[i] must be a valid probability distribution.

logits: Unscaled log probabilities.

So logits suppose to be your hypothesis and thus equal to activation and valid probability distribution is Y. So just change it with tf.nn.softmax_cross_entropy_with_logits(labels=Y, logits=activation)

Leave a Comment