Is it not possible to autodiff through jnp.histogram2d? #9519
-
I'm trying to train a model where the loss is the KL-divergence between two joint distributions. I'm constructing these densities by using Can you confirm this, and perhaps suggest an alternative? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can autodiff through Regarding how to work around this: I seem to recall there are ways to estimate the KL divergence without binning your data. I can't remember any exact references, but that's where I would start in this case. |
Beta Was this translation helpful? Give feedback.
You can autodiff through
histogram2d
, but I believe the correct gradient for the counts in each bin is zero. The issue at play is similar to the one discussed in detail in this answer: #8977 (comment)Regarding how to work around this: I seem to recall there are ways to estimate the KL divergence without binning your data. I can't remember any exact references, but that's where I would start in this case.