DataModule.transform
- DataModule.transform(x: ndarray | torch.Tensor, y: ndarray | torch.Tensor, out_type: str = 'numpy') Tuple[ndarray | torch.Tensor, ndarray | torch.Tensor] [source]
Transform the input and output data. Takes care of the case where x and y are numpy arrays or torch tensors.
- Parameters:
x (Union[np.ndarray, torch.Tensor]) – Input data to be transformed, either a numpy array or a torch tensor.
y (Union[np.ndarray, torch.Tensor]) – Output data to be transformed, either a numpy array or a torch tensor.
out_type (str, optional) – The type of the output. Can be “numpy”, “torch”, or “same”. The default is “numpy”.
- Returns:
Tuple[Union[np.ndarray, torch.Tensor], Union[np.ndarray, torch.Tensor]] – A tuple containing the transformed input and output data.