Solved by KFrank in post #2 
              
              
                Hi Umang! 

I haven’t checked your weighted, stable log-sum-exp implementation 
carefully, but, at first glance, it looks correct to me. 

If your issues really do show up first with probs = m.log_prob(target), 
then your log_sum_exp() is likely not the problem. 
Note that the log in log_prob() itse…