I want to apply plain softmax in pytorch, so I used that way:
softmax = F.softmax # or softmax = nn.Softmax() k = torch.randn([1,2]) print(k) # a tensor print(softmax(k)) # a variable container
and interesting that, softmax(k) becomes a Variable container, which makes my next code
torch.matmul(w, k) fail for the reason that “w” is a plain tensor, and every function of pytorch cannot has mixed inputs.
In my view, the softmax function of pytorch do too many things
And I also tested other function in nn package like nn.CosineSimilarity, it will not do this redundant thing.
Could someone tell me the reason? Thanks a lot
I found that every nn activation will do this thing.
So is that a good coding style to make everything into Variable?