lcn icon indicating copy to clipboard operation
lcn copied to clipboard

nan in output

Open mgerdzhev opened this issue 5 years ago • 1 comments

https://github.com/anthonymlortiz/lcn/blob/master/local_context_norm.py#L40 if squares < sums*sums/n var becomes negative so when you take square root later in padded_vars it leads to nan results

would adding var = torch.abs(var) make sense

mgerdzhev avatar Sep 08 '20 20:09 mgerdzhev

The variance should never be negative. I had the same problem, in my case it was caused by overflow because I was using float16.

matthias-wright avatar Apr 12 '21 17:04 matthias-wright