r"""Move internal buffers of the ExponentialMovingAverage to `device`. Args: device: like `device` argument to `torch.Tensor.to`
(self, device=None, dtype=None, non_blocking=False)
| 494 | self.shadow_params = [p.pin_memory() for p in self.shadow_params] |
| 495 | |
| 496 | def to(self, device=None, dtype=None, non_blocking=False) -> None: |
| 497 | r"""Move internal buffers of the ExponentialMovingAverage to `device`. |
| 498 | |
| 499 | Args: |
| 500 | device: like `device` argument to `torch.Tensor.to` |
| 501 | """ |
| 502 | # .to() on the tensors handles None correctly |
| 503 | self.shadow_params = [ |
| 504 | p.to(device=device, dtype=dtype, non_blocking=non_blocking) |
| 505 | if p.is_floating_point() |
| 506 | else p.to(device=device, non_blocking=non_blocking) |
| 507 | for p in self.shadow_params |
| 508 | ] |
| 509 | |
| 510 | def state_dict(self) -> dict: |
| 511 | r""" |
no outgoing calls
no test coverage detected