move_to_device#

pytorch_forecasting.utils.move_to_device(x: Union[Dict[str, Union[Tensor, List[Tensor], Tuple[Tensor]]], Tensor, List[Tensor], Tuple[Tensor]], device: Union[str, DeviceObjType]) Union[Dict[str, Union[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