move_to_device#

pytorch_forecasting.utils._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