Skip to content

Commit 75fe56b

Browse files
esantorellameta-codesync[bot]
authored andcommitted
Fix PairwiseGP test that fails on CUDA (#3283)
Summary: Pull Request resolved: #3283 **Context**: `test_load_state_dict_recomputes_laplace` from `botorch.test.models.test_pairwise_gp.TestPairwiseGP` has been failing since it was added (D99173855) due to an issue with tensors on different devices. **This PR**: Moves a tensor to the appropriate device Reviewed By: ItsMrLin Differential Revision: D101675014 fbshipit-source-id: ca91dd5611d706f9b8ddc8ff3269567e9aa62f72
1 parent 30f2838 commit 75fe56b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

botorch/models/pairwise_gp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ def set_train_data(
887887
self.D = torch.zeros(
888888
D_size, dtype=self.datapoints.dtype, device=self.datapoints.device
889889
)
890-
comp_view = self.comparisons.view(-1, self.m, 2).long()
890+
comp_view = self.comparisons.view(-1, self.m, 2).long().to(self.D.device)
891891
for i, sub_D in enumerate(self.D.view(-1, self.m, self.n)):
892892
sub_D.scatter_(1, comp_view[i, :, [0]], 1)
893893
sub_D.scatter_(1, comp_view[i, :, [1]], -1)

0 commit comments

Comments
 (0)