Skip to content

Commit 479900d

Browse files
author
Han Wang
committed
fix(test): add .cpu() before .numpy() for GPU-compatible activation tests
1 parent fb25ccb commit 479900d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

source/tests/consistent/test_activation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_pt_expt_consistent_with_ref(self) -> None:
113113
x = torch.tensor(
114114
self.random_input, dtype=torch.float64, device=PT_EXPT_DEVICE
115115
)
116-
test = _torch_activation(x, self.activation).detach().numpy()
116+
test = _torch_activation(x, self.activation).detach().cpu().numpy()
117117
np.testing.assert_allclose(self.ref, test, atol=1e-10)
118118

119119

@@ -155,5 +155,5 @@ def test_pt_expt_consistent_with_ref(self) -> None:
155155
x = torch.tensor(
156156
self.random_input, dtype=torch.float64, device=PT_EXPT_DEVICE
157157
)
158-
test = _torch_activation(x, self.activation).detach().numpy()
158+
test = _torch_activation(x, self.activation).detach().cpu().numpy()
159159
np.testing.assert_allclose(self.ref, test, atol=1e-10)

0 commit comments

Comments
 (0)