Skip to content

Commit

Permalink
Set writable flag to avoid copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-T-McCann committed Dec 15, 2023
1 parent 77f9d08 commit 88f04fe
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scico/linop/xray/astra.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ def _proj(self, x: jax.Array) -> jax.Array:
# apply the forward projector and generate a sinogram

def f(x):
if x.flags.writeable == False:
x = x.copy()
x.setflags(write=True)
if self.num_dims == 2:
proj_id, result = astra.create_sino(x, self.proj_id)
astra.data2d.delete(proj_id)
Expand All @@ -200,8 +199,7 @@ def f(x):
def _bproj(self, y: jax.Array) -> jax.Array:
# apply backprojector
def f(y):
if y.flags.writeable == False:
y = y.copy()
y.setflags(write=True)
if self.num_dims == 2:
proj_id, result = astra.create_backprojection(y, self.proj_id)
astra.data2d.delete(proj_id)
Expand Down

0 comments on commit 88f04fe

Please sign in to comment.