Benchmarking with this script shows improvements of 15-23% runtime when backpropagating through local cost functions in Theseus. I haven't written any dedicated unit tests, but both versions result in the same loss history in the script above, so things look correct.
The current autograd operators in
torchlie.functional
result in duplicated computation for function calls such asbecause these are computed as follows:
This PR adds a wrapper that reuses the computation, while preserving the custom backward implementation, as follows
Benchmarking with this script shows improvements of 15-23% runtime when backpropagating through local cost functions in Theseus. I haven't written any dedicated unit tests, but both versions result in the same loss history in the script above, so things look correct.