Hi,
I had to modify all the .unsqueeze(0) to .view(1, 1) and probs.dot(probs.t().log()) to probs.mm(probs.t().log()) to make your code run with 0.4 (I don’t have any 0.3 install here).
With these changes, the code runs without any error. So I guess you would need to upgrade your pytorch version.