Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pylops/_torchoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def forward(ctx, x, forw, adj, device, devicetorch):
x = x.cpu().detach().numpy()
else:
# pass x to cupy using DLPack
x = cp.fromDlpack(to_dlpack(x))
x = cp.from_dlpack(to_dlpack(x))

# apply forward operator
y = ctx.forw(x)
Expand All @@ -46,7 +46,7 @@ def forward(ctx, x, forw, adj, device, devicetorch):
y = torch.from_numpy(y).to(ctx.devicetorch)
else:
# move y to torch and device
y = from_dlpack(y.toDlpack())
y = from_dlpack(y)
return y

@staticmethod
Expand All @@ -56,7 +56,7 @@ def backward(ctx, y):
y = y.cpu().detach().numpy()
else:
# pass x to cupy using DLPack
y = cp.fromDlpack(to_dlpack(y))
y = cp.from_dlpack(to_dlpack(y))

# apply adjoint operator
x = ctx.adj(y)
Expand All @@ -65,5 +65,5 @@ def backward(ctx, y):
if ctx.device == "cpu":
x = torch.from_numpy(x).to(ctx.devicetorch)
else:
x = from_dlpack(x.toDlpack())
x = from_dlpack(x)
return x, None, None, None, None, None
Loading