Relative Content

Tag Archive for pytorch

A problem related to torch.nn.functional.logsoftmax

I’m trying to calculate negative log-likelihood for evaluation, ‘pred’ is already a probability vector, and by some reasons I’m trying to get log(pred) by
log_probs = F.log_softmax(pred)
but the numerical result is very wired

In PyTorch, the operation of nn.linear depends on the size. What’s wrong?

test = nn.Linear(1440, 1440, bias=False) hidden1 = torch.randn(100, 1440) hidden2 = torch.randn(400, 1440) output1 = test(hidden1) output2 = test(hidden2) If I test it as above, shouldn’t the output1 and output2[:100,:] parts be exactly the same? There are slightly different parts, do you know why? It should be the same as simple matmul calculation, but it […]