F.softmax()的用法
>>> import torch
>>> import torch.nn.functional as F
>>> logits = torch.rand(2,2)
>>> pred = F.softmax(logits, dim=1)
>>> logits
tensor([[0.4140, 0.4571],
[0.9392, 0.6504]])
>>> pred
tensor([[0.4892, 0.5108],
[0.5717, 0.4283]])
>>>
可以看出:它是按照行来一行一行做归一化的