Skip to content

Commit 4be2eb1

Browse files
authored
Merge pull request #11 from mrava87/master
Remove .to for numpy arrays
2 parents eed70f1 + 0493ee7 commit 4be2eb1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pylops_gpu/TorchOperator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def forward(ctx, x, forw, adj, pylops, device):
4040
if ctx.pylops:
4141
if ctx.device == 'cpu':
4242
# move y to torch and device
43-
y = torch.from_numpy(y).to(ctx.device)
43+
y = torch.from_numpy(y)
4444
else:
4545
# move y to torch and device
4646
y = from_dlpack(y.toDlpack())
@@ -62,10 +62,10 @@ def backward(ctx, y):
6262
# prepare output
6363
if ctx.pylops:
6464
if ctx.device == 'cpu':
65-
x = torch.from_numpy(x).to(ctx.device)
65+
x = torch.from_numpy(x)
6666
else:
6767
x = from_dlpack(x.toDlpack())
68-
return x, None, None, None, None
68+
return x, None, None, None, None
6969

7070

7171
class TorchOperator():

0 commit comments

Comments
 (0)