braindecode.training.TimeSeriesLoss¶
- class braindecode.training.TimeSeriesLoss(loss_function)¶
Compute Loss between timeseries targets and predictions. Assumes predictions are in shape: n_batch size x n_classes x n_predictions (in time) Assumes targets are in shape: n_batch size x n_classes x window_len (in time) If the targets contain NaNs, the NaNs will be masked out and the loss will be only computed for predictions valid corresponding to valid target values.
Methods
- forward(preds, targets)¶
Forward pass.
- Parameters
- preds: torch.Tensor
Model’s prediction with shape (batch_size, n_classes, n_times).
- targets: torch.Tensor
Target labels with shape (batch_size, n_classes, n_times).