ToTensor¶
- class torcheeg.transforms.ToTensor(apply_to_baseline: bool = False)[source][source]¶
Convert a
numpy.ndarrayto tensor. Different fromtorchvision, tensors are returned without scaling.transform = ToTensor() transform(eeg=np.random.randn(32, 128))['eeg'].shape >>> (32, 128)
- __call__(*args, eeg: ndarray, baseline: Optional[ndarray] = None, **kwargs) Dict[str, Tensor][source][source]¶
- Parameters
eeg (np.ndarray) – The input EEG signals.
baseline (np.ndarray, optional) – The corresponding baseline signal, if apply_to_baseline is set to True and baseline is passed, the baseline signal will be transformed with the same way as the experimental signal.
- Returns
If baseline is passed and apply_to_baseline is set to True, then {‘eeg’: …, ‘baseline’: …}, else {‘eeg’: …}. The output is represented by
torch.Tensor.- Return type
dict