move_to_device

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