move_to_device#

pytorch_forecasting.utils.move_to_device(x: Dict[str, Tensor | List[Tensor] | Tuple[Tensor]] | Tensor | List[Tensor] | Tuple[Tensor], device: str | DeviceObjType) Dict[str, Tensor | List[Tensor] | Tuple[Tensor]] | Tensor | List[Tensor] | Tuple[Tensor][source]#

Move object to device.

Parameters:
  • x (dictionary of list of tensors) – object (e.g. dictionary) of tensors to move to device

  • device (Union[str, torch.DeviceObjType]) – device, e.g. “cpu”

Returns:

x on targeted device