For Normalization btw [0,1]
x = x/x.sum(0).expand_as(x) 
x[torch.isnan(x)]=0   #if an entire column is zero, division by 0 will cause NaNs

For Normalization btw [-1,1]
x = x/x.sum(0).expand_as(x) 
x[torch.isnan(x)]=0   #if an entire column is zero, division by 0 will cause NaNs
x = 2*x - 1