(self)
| 51 | |
| 52 | @property |
| 53 | def device(self) -> torch.device: |
| 54 | if hasattr(self, '_device'): |
| 55 | return self._device |
| 56 | for model in self.models.values(): |
| 57 | if hasattr(model, 'device'): |
| 58 | return model.device |
| 59 | for model in self.models.values(): |
| 60 | if hasattr(model, 'parameters'): |
| 61 | return next(model.parameters()).device |
| 62 | raise RuntimeError("No device found.") |
| 63 | |
| 64 | def to(self, device: torch.device) -> None: |
| 65 | for model in self.models.values(): |
no outgoing calls
no test coverage detected