其他分享
首页 > 其他分享> > Pytorch torch.nn.functional.softmax: What dimension to use?

Pytorch torch.nn.functional.softmax: What dimension to use?

作者:互联网

torch.nn.functional.softmax

https://pytorch.org/docs/stable/generated/torch.nn.functional.softmax.html?highlight=softmax#torch.nn.functional.softmax

https://stackoverflow.com/questions/49036993/pytorch-softmax-what-dimension-to-use

Pytorch softmax: What dimension to use?

Image transcribed as code:

>>> x = torch.tensor([[1,2],[3,4]],dtype=torch.float)
>>> F.softmax(x,dim=0)
tensor([[0.1192, 0.1192],
        [0.8808, 0.8808]])
>>> F.softmax(x,dim=1)
tensor([[0.2689, 0.7311],
        [0.2689, 0.7311]])

标签:What,tensor,nn,torch,functional,softmax,use
来源: https://www.cnblogs.com/huzhengyu/p/16678390.html