# How is this statement from a TensorFlow implementation of a certain KL-divergence formula related to the corresponding formula?

I am trying to understand a certain KL-divergence formula (which can be found on page 6 of the paper Evidential Deep Learning to Quantify Classification Uncertainty) and found a TensorFlow implementation for it. I understand most parts of the formula and put colored frames around them. Unfortunately, there is one term in the implementation (underlined red) that I can't tell how it fits in the formula.

Is this a mistake in the implementation? I don't understand how the red part is necessary.

It should remain from a general code that has been refactored. By the way, the red code phrase is always zero. Because, beta is a vector of 1, and $$\log(\Gamma(1)) = \log(1) = 0$$, i.e., tf.math.lgamma(beta). So, sum of zeros will be zero.

As you said, the other parts of the code are clear and completely matched with the definition.

• Thank you, you are right. I was worried because I found this code multiple times on the internet, but it seems everyone copied from the same source.
– Baka
Aug 8, 2021 at 8:07