Use the strategy's `root_device` instead of the LightningModule's device property (#11734)

This commit is contained in:
ananthsub 2022-02-04 19:33:25 -08:00 committed by GitHub
parent 58324b5197
commit 72db64d294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -93,7 +93,7 @@ class ParallelStrategy(Strategy, ABC):
return all_gather_ddp_if_available(tensor, group=group, sync_grads=sync_grads)
def reduce_boolean_decision(self, decision: bool) -> bool:
decision = torch.tensor(int(decision), device=self.lightning_module.device)
decision = torch.tensor(int(decision), device=self.root_device)
decision = self.reduce(decision, reduce_op=ReduceOp.SUM)
decision = bool(decision == self.world_size)
return decision