-
Notifications
You must be signed in to change notification settings - Fork 102
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
Adding jax backend #562
Closed
Closed
Adding jax backend #562
Changes from 9 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
062c3bb
feat: started to add support for jax
mrava87 6a0eac4
feat: added jaxoperator
mrava87 372c39f
minor: fix backend to return jnp
mrava87 d3b3b66
minor: added ncp to fft2d
mrava87 780efa3
minor: added ncp to fftnd
mrava87 c2b7038
feat: added jax to backends
mrava87 9c008af
feat: add jax backend for convolve1d
mrava87 e1fa060
minor: remove prints from convolve1d
mrava87 68efee3
feat: remove cusignal since it is incorporated in cupy
mrava87 648c7fd
feature: continue integrating jax
mrava87 3093bd8
feat: adapted first derivative and vstack for jax
mrava87 208660d
feat: enabled jax for more basicoperators
mrava87 0ef312f
doc: added docstring and types to jaxoperator
mrava87 61b5807
feat: enabled jax for firstderivative
mrava87 cfb09e3
feat: enable jax in FirstDerivative and SecondDerivative
mrava87 597317f
minor: fix inconsistency in convolve1d
mrava87 a99ff5d
doc: added jax example in doc
mrava87 11c7e1d
feat: adapted nonstatconvolve1d to jax
mrava87 72c30d1
feat: enable Shift with jax arrays
mrava87 f5205ab
minor: add explicit and clinear to JaxOperator
mrava87 3d703d4
minor: fix FFT2D rmatvec for jax
mrava87 7604e0f
fix: fix get_block_diag from using cupy without checking if available
mrava87 a0813ec
feat: finalized jax integration of signalprocessing
mrava87 b52c537
feat: jax integration of avo
mrava87 83ea4c7
feat: jax integration of waveeqprocessing
mrava87 7a31c3b
doc: added jax tutorial
mrava87 4f2aabd
build: temporarely force numpy/scipy versions
mrava87 8bd76f1
doc: added jax tutorial
mrava87 aa458f5
test: added tests for JaxOperator
mrava87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
__all__ = [ | ||
"JaxOperator", | ||
] | ||
|
||
|
||
import jax | ||
|
||
from pylops import LinearOperator | ||
|
||
|
||
class JaxOperator(LinearOperator): | ||
def __init__(self, Op): | ||
super().__init__(dtype=Op.dtype, dims=Op.dims, dimsd=Op.dimsd, name=Op.name) | ||
self._matvec = jax.jit(Op._matvec) | ||
self._rmatvec = jax.jit(Op._rmatvec) | ||
|
||
def _rmatvecad(self, x, y): | ||
mrava87 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
_, f_vjp = jax.vjp(self._matvec, x) | ||
return jax.jit(f_vjp)(y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
if you put a comma at the end it will be more readable
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.
not sure what you mean...