-
Notifications
You must be signed in to change notification settings - Fork 70
#332 Closed form gradients for Kalman filter #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Suggestion, run custom gradient vs default autodiff in pytensor and time it. Print the compiled graph (.dprint() on the function) to see if what pytensor autodiff is doing isn't already similar. I see the original paper compares with PyTorch, which IMO isn't very clever AD, specially in terms of memory optimization. I'm not sure their 38x speedup / memory improvement also holds against pytensor (or jax). |
Thanks @ricardoV94! I’ve tried looking into it, but it quickly becomes messy… Do you have a particular method for comparing the dprint output? I saw that you can name operations to make things clearer, but that doesn’t seem very efficient given the hundreds of lines I get. I also tried timing it, and the gradient with the closed-form expression actually performs worse. I’m inclined to think that autodiff is still being used under the hood, especially since the runtime scales in pretty much the same way for both forms, depending on the number of states. |
Can you share the timing code, that's easier to give feedback over. Re the dprint that was just curiosity just paste it after you compile (yeah it will be long) |
You can find it at the end of the notebook, here is the benchmark function :
|
Here you'll find, in the notebook section, the notebook I've used to compare execution time between using autodiff and the analytic gradients.