format_data#
- adata_query._core._formatter.format_data(data: ndarray | Tensor, torch: bool = False, device: device = device(type='cpu')) ndarray | Tensor[source]#
Format data to interface with numpy or torch, on a specified device.
- Parameters:
data (
Union[np.ndarray, torch.Tensor]) – Inputdatato be formatted. Typically annp.ndarray,torch.Tensor, orArrayView.torch (
Optional[bool]) –Toggle whether data should be formatted as
torch.Tensorornp.ndarray.Default:
False
device (
Optional[torch.device]) –If
torch==True, the device (e.g.:"cpu","cuda:0","mps:0") may be set. The default value,autodevice.AutoDevice()will indicate the use of GPU, if available.Default:
autodevice.AutoDevice()
- Returns:
formatted_data- Return type:
Union[np.ndarray, torch.Tensor]