Improve torch der log
Created by: gcarleo
This improves the gradient function (der_log) in Torch machines (follow-up of #335) reducing the number of calls to the underlying module and retaining the graph for subsequent calls of autograd.grad
. In my experiments this version could be as much as 60% faster.
@nikita-astronaut please have a look and see if this also improves your calculations