In bs_log_density, if you request dropping of constant terms, it is important we instantiate the model class' log_prob implementation with vars (doubles are considered constants, and therefore dropped).
However, it is not necessary to actually compute the backward pass on those vars, which is currently done in log_density when propto=True. This means the log density calculation is slower than it could be, which this PR fixes.
In
bs_log_density
, if you request dropping of constant terms, it is important we instantiate the model class' log_prob implementation withvar
s (double
s are considered constants, and therefore dropped).However, it is not necessary to actually compute the backward pass on those vars, which is currently done in log_density when
propto=True
. This means the log density calculation is slower than it could be, which this PR fixes.