nvalchemi.training.move_to_devices#
- nvalchemi.training.move_to_devices(models, devices, *, non_blocking=False)[source]#
Move one model or named models to device(s), preserving input shape.
- Parameters:
models (torch.nn.Module | dict[str, torch.nn.Module] | torch.nn.ModuleDict) – Single module or named modules. Named modules are assigned devices in insertion order.
devices (Sequence[torch.device]) – One device broadcasts to all models; otherwise length must match the number of models.
non_blocking (bool, optional) – Forwarded to
torch.nn.Module.to().
- Returns:
The same input shape after in-place
.to(...)calls.- Return type:
torch.nn.Module | dict[str, torch.nn.Module] | torch.nn.ModuleDict
- Raises:
ValueError – If
deviceshas length other than1or the number of models.