Closed ludvik-martin closed 3 years ago
Check out this pull request on
Review Jupyter notebook visual diffs & provide feedback on notebooks.
Powered by ReviewNB
Actually, at the end of jupyter the notebook Jeremy refactores the code in the same way... Should have read it properly to the end :)
The (inp.unsqueeze(-1) * out.g.unsqueeze(1)).sum(0) is actually doing the same thing as inp.T @ out.g, but much slower. The only reason for the operation with unsqueeze() is to exercise the broadcasting. Compared with %timeit - the method with @ is nearly order of magnitude faster (on my machine)