-
Notifications
You must be signed in to change notification settings - Fork 616
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
Add DeviceJacobianProducts
jacobian product calculator
#4637
Conversation
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for the added test.
It's probably a matter of taste, but I suggested a sentence for the DeviceJacobianProducts
docstring that makes the difference to DeviceDerivatives
explicit.
This PR follows on from #4435 , and adds a child class that can handle device-provided derivatives. It has two private caches, `_results_cache` and `_jacs_cache`. This handles storing the jacobian between the forward pass and the backward pass. The caches will also store results and jacobians between successive calls to the same instance. The class can handle both device interfaces, `qml.Device` and `qml.devices.Device`. Name for the class is still up in the air. This class takes the full jacobian from the device and then performs the dot product. The class in #4637 takes the jacobian product itself from the device. --------- Co-authored-by: David Wierichs <[email protected]> Co-authored-by: Mudit Pandey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
This PR follows on from #4435 , and adds a child class that can handle device-provided derivatives. It has two private caches, `_results_cache` and `_jacs_cache`. This handles storing the jacobian between the forward pass and the backward pass. The caches will also store results and jacobians between successive calls to the same instance. The class can handle both device interfaces, `qml.Device` and `qml.devices.Device`. Name for the class is still up in the air. This class takes the full jacobian from the device and then performs the dot product. The class in #4637 takes the jacobian product itself from the device. --------- Co-authored-by: David Wierichs <[email protected]> Co-authored-by: Mudit Pandey <[email protected]>
This PR is a follow on to #4527 . [sc-44325] It adds `DeviceJacobianProducts` that can bind device provided jvps and vjps to the execution pipeline. --------- Co-authored-by: David Wierichs <[email protected]>
This PR follows on from #4527 and #4637 . Since we still need to make performance improvements to `DefaultQubit.compute_vjp`, I added an opt-in keyword argument `use_device_jacobian_product` to `qml.execute`. This allows us to easily compare between using the device jacobian product and not. Fixes #3217 --------- Co-authored-by: David Wierichs <[email protected]> Co-authored-by: Tom Bromley <[email protected]>
This PR is a follow on to #4527 . [sc-44325]
It adds
DeviceJacobianProducts
that can bind device provided jvps and vjps to the execution pipeline.