braindecode.augmentation.functional.smooth_time_mask(X, y, mask_start_per_sample, mask_len_samples)[source]#

Smoothly replace a contiguous part of all channels by zeros.

Originally proposed in [1] and [2]

  • X (torch.Tensor) – EEG input example or batch.

  • y (torch.Tensor) – EEG labels for the example or batch.

  • mask_start_per_sample (torch.tensor) – Tensor of integers containing the position (in last dimension) where to start masking the signal. Should have the same size as the first dimension of X (i.e. one start position per example in the batch).

  • mask_len_samples (int) – Number of consecutive samples to zero out.


  • torch.Tensor – Transformed inputs.

  • torch.Tensor – Transformed labels.



Cheng, J. Y., Goh, H., Dogrusoz, K., Tuzel, O., & Azemi, E. (2020). Subject-aware contrastive learning for biosignals. arXiv preprint arXiv:2007.04871.


Mohsenvand, M. N., Izadi, M. R., & Maes, P. (2020). Contrastive Representation Learning for Electroencephalogram Classification. In Machine Learning for Health (pp. 238-253). PMLR.