Skip to content

Commit ff6ae1c

Browse files
authored
fix autodetermination of plate device (#3405)
Apparently, the torch.Tensor() constructor ignores device contexts
1 parent 24b7a7f commit ff6ae1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pyro/poutine/subsample_messenger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(
4545
)
4646
)
4747
with ignore_jit_warnings(["torch.Tensor results are registered as constants"]):
48-
self.device = device or torch.Tensor().device
48+
self.device = device or torch.tensor(tuple()).device
4949

5050
@ignore_jit_warnings(["Converting a tensor to a Python boolean"])
5151
def sample(self, sample_shape: torch.Size = torch.Size()) -> torch.Tensor:

0 commit comments

Comments
 (0)