NaN when width=channel=1, B0
charlesxjyang opened this issue · 2 comments
I am using this on my own computer vision dataset. My image size is small enough that when the image size ends up being (batch_size,n_channels,1,1), the EvoNorm begins returning NaN's. I know the reason is because the width=channel=1 because when I make my network smaller with less convolution layers i.e. width,channel>1, the NaN's go away. Is there any reason why this is the case?
The NaN's are coming from the instance_std and torch.max returns NaN when any of it's elements are NaN. I just added a simple check to see if instance_std was NaN and just return (var+self.eps).sqrt()
. The instance_std is most likely NaN because width=channel=1 has no instance variance e.g. variance of a constant is not well-defined in torch, is my guess. I'd be happy to submit a pull request to fix this.
Hi. Thanks for raising the issue and providing a solution for it. Please submit a PR.