From 2b17b10211a133b55d2570deed9fdd66833a5334 Mon Sep 17 00:00:00 2001 From: Ilia Kats Date: Mon, 21 Oct 2024 14:19:56 +0200 Subject: [PATCH] fix autodetermination of plate device Apparently, the torch.Tensor() constructor ignores device contexts --- pyro/poutine/subsample_messenger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyro/poutine/subsample_messenger.py b/pyro/poutine/subsample_messenger.py index 58fba6faa8..5fe9203aea 100644 --- a/pyro/poutine/subsample_messenger.py +++ b/pyro/poutine/subsample_messenger.py @@ -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: