a = torch.Tensor([[1,1],[2,2],[3,3]])
a.size()
Out[89]: torch.Size([3, 2])
b = torch.nn.Softmax(dim=0)(a)
b
Out[91]:
tensor([[0.0900, 0.0900],
[0.2447, 0.2447],
[0.6652, 0.6652]])
b = torch.nn.Softmax(dim=1)(a)
b
Out[93]:
tensor([[0.5000, 0.5000],
[0.5000, 0.5000],
[0.5000, 0.5000]])
10-25
3256
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交