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]])
posted @ 2022-09-10 21:07  TR_Goldfish  阅读(23)  评论(0编辑  收藏  举报