Is there a built-in KL divergence loss function in TensorFlow?
I'm not sure why it's not implemented, but perhaps there is a workaround. The KL divergence is defined as:
KL(prob_a, prob_b) = Sum(prob_a * log(prob_a/prob_b))
The cross entropy H, on the other hand, is defined as:
H(prob_a, prob_b) = -Sum(prob_a * log(prob_b))
So, if you create a variable y = prob_a/prob_b, you could obtain the KL divergence by calling negative H(proba_a, y). In Tensorflow notation, something like:
KL = tf.reduce_mean(-tf.nn.softmax_cross_entropy_with_logits(prob_a, y))
I have two tensors, prob_a and prob_b with shape [None, 1000], and I want to compute the KL divergence from prob_a to prob_b. Is there a built-in function for this in TensorFlow?  I tried using tf.contrib.distributions.kl(prob_a, prob_b), but it gives:

NotImplementedError: No KL(dist_a || dist_b) registered for dist_a type Tensor and dist_b type Tensor

If there is no built-in function, what would be a good workaround?