Skip to content

Commit 7837aa8

Browse files
authored
Merge pull request #681 from GeophyAI/fix_jax
Support JAX backend in ChirpRadon2D/3D by removing in-place assignment.
2 parents 3b79888 + 8c14077 commit 7837aa8

5 files changed

Lines changed: 13 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,4 @@ A list of video tutorials to learn more about PyLops:
152152
* Alex Rakowski, alex-rakowski
153153
* David Sollberger, solldavid
154154
* Gustavo Coelho, guaacoelho
155+
* Shaowen Wang, GeophyAI

docs/source/credits.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ Contributors
2323
* `Fedor Goncharov <https://github.com/fedor-goncharov>`_, fedor-goncharov
2424
* `Alex Rakowski <https://github.com/alex-rakowski>`_, alex-rakowski
2525
* `David Sollberger <https://github.com/solldavid>`_, solldavid
26-
* `Gustavo Coelho <https://github.com/guaacoelho>`_, guaacoelho
26+
* `Gustavo Coelho <https://github.com/guaacoelho>`_, guaacoelho
27+
* `Shaowen Wang <https://github.com/GeophyAI>`_, GeophyAI

docs/source/gpu.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,11 @@ Signal processing:
473473
* - :class:`pylops.signalprocessing.ChirpRadon2D`
474474
- |:white_check_mark:|
475475
- |:white_check_mark:|
476-
- |:red_circle:|
476+
- |:white_check_mark:|
477477
* - :class:`pylops.signalprocessing.ChirpRadon3D`
478478
- |:white_check_mark:|
479479
- |:white_check_mark:|
480-
- |:red_circle:|
480+
- |:white_check_mark:|
481481
* - :class:`pylops.signalprocessing.Sliding1D`
482482
- |:white_check_mark:|
483483
- |:white_check_mark:|

pylops/signalprocessing/_chirpradon2d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pylops.utils.backend import get_array_module
1+
from pylops.utils.backend import get_array_module, inplace_set
22
from pylops.utils.typing import NDArray
33

44

@@ -62,7 +62,7 @@ def _chirp_radon_2d(
6262

6363
# perform transform
6464
h = ncp.zeros((2 * nx, nt)).astype(cdtype)
65-
h[0:nx, :] = ncp.fft.fftn(data, axes=(1,)) * K
65+
h = inplace_set(ncp.fft.fftn(data, axes=(1,)) * K, h, (slice(0, nx), slice(None)))
6666
g = ncp.fft.ifftn(
6767
ncp.fft.fftn(h, axes=(0,)) * ncp.fft.fftn(K0, axes=(0,)), axes=(0,)
6868
)

pylops/signalprocessing/_chirpradon3d.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy as np
22

3-
from pylops.utils.backend import get_array_module
3+
from pylops.utils.backend import get_array_module, inplace_set
44
from pylops.utils.typing import NDArray
55

66
try:
@@ -88,8 +88,11 @@ def _chirp_radon_3d(
8888

8989
# perform transform
9090
h = ncp.zeros((2 * ny, 2 * nx, nt)).astype(cdtype)
91-
h[0:ny, 0:nx, :] = ncp.fft.fftn(data, axes=(2,)) * K1 * K2
92-
91+
h = inplace_set(
92+
ncp.fft.fftn(data, axes=(2,)) * K1 * K2,
93+
h,
94+
(slice(0, ny), slice(0, nx), slice(None)),
95+
)
9396
g = ncp.fft.ifftn(
9497
ncp.fft.fftn(h, axes=(1,)) * ncp.fft.fftn(K01, axes=(1,)), axes=(1,)
9598
)

0 commit comments

Comments
 (0)