Hello Kelley!



 KelleyYin:

In version 0.4.1,
a = torch.randn(3, 4)
b = F.softmin(a, dim=-1).sum(dim=-1)

b is equal to tensor([-1.0000, -1.0000, -1.0000])

Is this a bug ?


This appears to be a known and fixed bug:  See this github issue:

  
      github.com/pytorch/pytorch
  
  
    



Issue: [Pytorch] wrong computation of softmin 


	
	opened by arogozhnikov
	on 2018-08-19
	
	
	closed by SsnL
	on 2018-08-20
	


Code example
torch.nn.functional.softmin(torch.arange(2).float(), dim=0)
output tensor([-0.2689, -0.7311])
Error is in priorities (minus applied after softmax):
if dim is None:
 dim = _get_softmax_dim('softmin', input.dim(), _stacklevel)
return -input.softmax(dim)...




  
  
    
    
  
  


(For what it’s worth, when I run your softmin test on pytorch
version 1.0.1, I get the right answer, that is, the softmin values
sum to 1.)
Best.
K. Frank