Skip to content
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 differentiable backend using Jax #93

Closed
3 tasks
madagra opened this issue Oct 13, 2023 · 2 comments
Closed
3 tasks

Add differentiable backend using Jax #93

madagra opened this issue Oct 13, 2023 · 2 comments
Assignees
Labels
backends Improving the backends feature New feature or request

Comments

@madagra
Copy link
Collaborator

madagra commented Oct 13, 2023

Motivations

Currently, we only support PyTorch as DifferentiableBackend. However, it is useful to have a more general interface to support other backends such as Jax. The benefits of Jax over PyTorch are several:

  • fully functional interface
  • out-of-the-box JIT compilation of models also with complex number
  • usually performance of Jax models is significantly higher than PyTorch even without compilation

Proposal

Adapt the current DifferentiableBackend interface to support Jax as a differentiable backend for the code. In essence, one should be able to write an abstract program with qadence and its execution should yield a Jax array in case that Jax differentiable backend is selected. In this way, qadence models will be compatible with any Jax-based optimization workflow and library.

To bear in mind while performing this implementation:

  • the QuantumModel and generally high-level interface of the package should not change
  • It is probably necessary to introduce a generic Tensor datatype that handles tensors in both Jax and PyTorch. If possible, do not proceed the Pennylane way, i.e. using the autoray package. The interface is not clean and the package is not really maintained currently.
  • make sure that also the GPSR differentiation mode is taken into account. If too long, this can be handled in a separate issue.
@dominikandreasseitz
Copy link
Collaborator

@Roland-djee

@RolandMacDoland
Copy link
Collaborator

@dominikandreasseitz This can be closed right ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backends Improving the backends feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants