移动到设备#

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][来源]#

将对象移动到设备。

Parameters:
  • x (字典列表张量) – 要移动到设备的张量对象(例如字典)

  • device (Union[str, torch.DeviceObjType]) – 设备,例如“cpu”

Returns:

在目标设备上的 x