Skip to content

Commit

Permalink
fix autodetermination of plate device (#3405)
Browse files Browse the repository at this point in the history
Apparently, the torch.Tensor() constructor ignores device contexts
  • Loading branch information
ilia-kats authored Oct 24, 2024
1 parent 24b7a7f commit ff6ae1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyro/poutine/subsample_messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(
)
)
with ignore_jit_warnings(["torch.Tensor results are registered as constants"]):
self.device = device or torch.Tensor().device
self.device = device or torch.tensor(tuple()).device

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

0 comments on commit ff6ae1c

Please sign in to comment.