tensorflow / compression

Data compression in TensorFlow
Apache License 2.0
858 stars 249 forks source link

For log(p), one question #116

Closed yifeipet closed 2 years ago

yifeipet commented 2 years ago

Hello Dr. Balle,

I am not as experienced as you. I have a question regarding your method. I don't know whether the below situation is possible. p = CDF (y + 0.5) - CDF (y-0.5) Is it possible to get p = 0 in the probability matrix? So log(p) can gives '-inf'. tf.reduce_sum(log(p)) = nan

How do you suggest solving this issue?

Can I add a very small number, such as 1e-6, to avoid this issue? For example, I calculate log(p+ 1e-6) instead of log(p).

Thank you! Hope to get your invaluable suggestion.

Best Regards, Yifei