abracudabra.device.conversion ============================= .. py:module:: abracudabra.device.conversion .. autoapi-nested-parse:: Move an array, series, or tensor to a device. Functions --------- .. autoapisummary:: abracudabra.device.conversion.to_cupy_array abracudabra.device.conversion.array_to_device abracudabra.device.conversion.frame_to_device abracudabra.device.conversion.tensor_to_device abracudabra.device.conversion.to_device Module Contents --------------- .. py:function:: to_cupy_array(sequence: object, /, device_idx: int | None = None) -> object Convert a sequence to a cupy array. .. py:function:: array_to_device(array: object, /, device: abracudabra.device.base.Device | str) -> abracudabra.annotations.Array Move a numpy/cupy array to a device. .. py:function:: frame_to_device(frame: abracudabra.annotations.Index, /, device_type: Literal['cpu']) -> pandas.Index frame_to_device(frame: abracudabra.annotations.Index, /, device_type: Literal['cuda']) -> cudf.Index frame_to_device(frame: abracudabra.annotations.Series, /, device_type: Literal['cpu']) -> pandas.Series frame_to_device(frame: abracudabra.annotations.Series, /, device_type: Literal['cuda']) -> cudf.Series frame_to_device(frame: abracudabra.annotations.DataFrame, /, device_type: Literal['cpu']) -> pandas.DataFrame frame_to_device(frame: abracudabra.annotations.DataFrame, /, device_type: Literal['cuda']) -> cudf.DataFrame frame_to_device(frame: object, /, device_type: abracudabra.device.base.DeviceType) -> abracudabra.annotations.Index | abracudabra.annotations.Series | abracudabra.annotations.DataFrame Move a pandas/cudf series or dataframe to a device. :param frame: The series or dataframe to move. :param device_type: The device type to move the frame to. :returns: The series or dataframe on the specified device. .. py:function:: tensor_to_device(tensor: object, /, device: abracudabra.device.base.Device | str) -> torch.Tensor Move a torch tensor to a device. .. py:function:: to_device(sequence: abracudabra.annotations.Array | abracudabra.annotations.Series | torch.Tensor, /, device: abracudabra.device.base.Device | str) -> abracudabra.annotations.Array | abracudabra.annotations.Series | torch.Tensor Move an array, series, or tensor to a device. Call the appropriate function to move the element to the device: * :py:func:`array_to_device` for numpy/cupy arrays. * :py:func:`series_to_device` for pandas/cudf series. * :py:func:`tensor_to_device` for torch tensors.