softmax 先exp,再在上面求總和的百分比
解決了負數相互抵消的問題。
if __name__ == '__main__':
import torch
import torch.nn.functional as F
input = torch.randn(2, 2)
print(input)
b = torch.softmax(input, dim=0) # 按列SoftMax,列和爲1
print(b)
b = torch.max(input, dim=0) # 按列SoftMax,列和爲1
print(b)