Skip to content

Commit 2222a7b

Browse files
committed
Fix acoustic tests
1 parent d95af45 commit 2222a7b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tests/test_acoustic.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,13 @@ def test_forward_cpu_gpu_match() -> None:
236236
propagator=acousticprop,
237237
device=torch.device("cpu"),
238238
prop_kwargs={"python_backend": python},
239+
dtype=torch.double,
239240
)
240241
actual_gpu = run_forward(
241242
propagator=acousticprop,
242243
device=torch.device("cuda"),
243244
prop_kwargs={"python_backend": python},
245+
dtype=torch.double,
244246
)
245247
for cpui, gpui in zip(actual_cpu, actual_gpu):
246248
assert torch.allclose(cpui, gpui.cpu(), atol=5e-5)
@@ -318,6 +320,8 @@ def test_unused_source_receiver(
318320
torch.manual_seed(1)
319321
if device is None:
320322
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
323+
if dtype is None:
324+
dtype = torch.double
321325

322326
if prop_kwargs is None:
323327
prop_kwargs = {}
@@ -892,7 +896,7 @@ def run_gradcheck(
892896
)
893897

894898
if isinstance(rho_val, torch.Tensor):
895-
rho = rho_val.to(device)
899+
rho_val = rho_val.to(device)
896900
rho = (
897901
torch.ones(*nx, device=device, dtype=dtype) * rho_val
898902
+ torch.rand(*nx, device=device, dtype=dtype) * drho

0 commit comments

Comments
 (0)