braindecode 1.8.1.dev169274909__tar.gz → 1.8.1.dev170227516__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/NOTICE.txt +6 -5
- {braindecode-1.8.1.dev169274909/braindecode.egg-info → braindecode-1.8.1.dev170227516}/PKG-INFO +3 -3
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/base.py +4 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datautil/serialization.py +4 -1
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/functional/__init__.py +2 -6
- braindecode-1.8.1.dev170227516/braindecode/functional/_real_dft.py +138 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/functional/functions.py +32 -99
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/__init__.py +10 -0
- braindecode-1.8.1.dev170227516/braindecode/models/barista.py +699 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/base.py +25 -2
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/bendr.py +2 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/biot.py +1 -0
- braindecode-1.8.1.dev170227516/braindecode/models/brainbert.py +448 -0
- braindecode-1.8.1.dev170227516/braindecode/models/brant.py +477 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/cbramod.py +3 -0
- braindecode-1.8.1.dev170227516/braindecode/models/diver1.py +945 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegdino.py +2 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegpt.py +1 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/labram.py +1 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/luna.py +3 -1
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/meta_neuromotor.py +1 -0
- braindecode-1.8.1.dev170227516/braindecode/models/mirepnet.py +368 -0
- braindecode-1.8.1.dev170227516/braindecode/models/mscformer.py +502 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/mvpformer.py +13 -6
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/reve.py +18 -82
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/signal_jepa.py +30 -11
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/steegformer.py +66 -19
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/summary.csv +6 -1
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/util.py +267 -28
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/zuna.py +26 -39
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/__init__.py +0 -2
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/attention.py +7 -1
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/blocks.py +52 -69
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/filter.py +33 -7
- braindecode-1.8.1.dev170227516/braindecode/modules/parametrization.py +62 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/preprocessing/windowers.py +31 -7
- braindecode-1.8.1.dev170227516/braindecode/version.py +1 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516/braindecode.egg-info}/PKG-INFO +3 -3
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode.egg-info/SOURCES.txt +6 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode.egg-info/requires.txt +2 -2
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/api.rst +11 -4
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/install/install.rst +4 -1
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/whats_new.rst +156 -2
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/pyproject.toml +2 -3
- braindecode-1.8.1.dev169274909/braindecode/models/barista.py +0 -1168
- braindecode-1.8.1.dev169274909/braindecode/modules/parametrization.py +0 -38
- braindecode-1.8.1.dev169274909/braindecode/version.py +0 -1
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/LICENSE.txt +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/MANIFEST.in +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/README.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/augmentation/transforms.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/classifier.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/_notebook_viewer.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/brainmodule.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/codebrain.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/config.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/dance.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/deep4.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/dgcnn.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegconformer.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/emg2qwerty.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/interpolated.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/medformer.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/neuropose.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/sensingdynamics.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/sstdpn.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/tcformer.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/tcn.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/tidnet.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/usleep.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/vemg2pose.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/dance_modules.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/interpolation.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/layers.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/stats.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/regressor.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/samplers/base.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/training/losses.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/training/scoring.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/util.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/visualization/activations.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/visualization/topology.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/Makefile +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/cite.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/conf.py +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/help.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/index.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/models.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/setup.cfg +0 -0
|
@@ -42,6 +42,7 @@ The following components are licensed under the MIT License:
|
|
|
42
42
|
- `braindecode/models/medformer.py`
|
|
43
43
|
- `braindecode/models/tcformer.py`
|
|
44
44
|
- `braindecode/models/ifnet.py`
|
|
45
|
+
- `braindecode/models/mirepnet.py`
|
|
45
46
|
|
|
46
47
|
### Apache-2.0 Licensed Files
|
|
47
48
|
|
|
@@ -50,16 +51,16 @@ The following components are licensed under the Apache License 2.0:
|
|
|
50
51
|
- `braindecode/models/mvpformer.py`
|
|
51
52
|
- `braindecode/models/zuna.py`
|
|
52
53
|
- `braindecode/models/luna.py`
|
|
54
|
+
- `braindecode/models/brant.py`
|
|
55
|
+
- `braindecode/models/diver1.py`
|
|
56
|
+
- `braindecode/models/mscformer.py`
|
|
53
57
|
|
|
54
58
|
### USC Academic License Files
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
the University of Southern California under an academic license that permits
|
|
58
|
-
use, copying, modification and distribution for educational, research and
|
|
59
|
-
non-profit purposes only. Commercial use requires an agreement with the USC
|
|
60
|
-
Stevens Center for Innovation.
|
|
60
|
+
[License](https://github.com/ShanechiLab/BaRISTA/blob/master/LICENSE.md)
|
|
61
61
|
|
|
62
62
|
- `braindecode/models/barista.py`
|
|
63
|
+
- `docs/_static/model/barista.jpeg`
|
|
63
64
|
|
|
64
65
|
## License Links
|
|
65
66
|
|
{braindecode-1.8.1.dev169274909/braindecode.egg-info → braindecode-1.8.1.dev170227516}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.8.1.
|
|
3
|
+
Version: 1.8.1.dev170227516
|
|
4
4
|
Summary: Deep learning software to decode EEG, ECG or MEG signals
|
|
5
5
|
Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Alexandre Gramfort <agramfort@meta.com>
|
|
6
6
|
Maintainer-email: Alexandre Gramfort <agramfort@meta.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Robin Tibor Schirrmeister <robintibor@gmail.com>
|
|
@@ -22,8 +22,8 @@ Requires-Python: >=3.11
|
|
|
22
22
|
Description-Content-Type: text/x-rst
|
|
23
23
|
License-File: LICENSE.txt
|
|
24
24
|
License-File: NOTICE.txt
|
|
25
|
-
Requires-Dist: torch>=2.
|
|
26
|
-
Requires-Dist: torchaudio>=2.
|
|
25
|
+
Requires-Dist: torch>=2.4
|
|
26
|
+
Requires-Dist: torchaudio>=2.4
|
|
27
27
|
Requires-Dist: mne>=1.11.0
|
|
28
28
|
Requires-Dist: mne_bids>=0.18
|
|
29
29
|
Requires-Dist: h5py
|
{braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/datasets/base.py
RENAMED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# Simon Brandt <simonbrandt@protonmail.com>
|
|
6
6
|
# David Sabbagh <dav.sabbagh@gmail.com>
|
|
7
7
|
# Robin Schirrmeister <robintibor@gmail.com>
|
|
8
|
+
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
8
9
|
#
|
|
9
10
|
# License: BSD (3-clause)
|
|
10
11
|
|
|
@@ -1398,6 +1399,9 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1398
1399
|
df = ds._windows.metadata
|
|
1399
1400
|
else:
|
|
1400
1401
|
df = ds.metadata
|
|
1402
|
+
if isinstance(df, pd.DataFrame):
|
|
1403
|
+
# copy so the description columns stay out of the dataset
|
|
1404
|
+
df = df.copy()
|
|
1401
1405
|
for k, v in ds.description.items():
|
|
1402
1406
|
df[k] = v
|
|
1403
1407
|
all_dfs.append(df)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Convenience functions for storing and loading of windows datasets."""
|
|
2
2
|
|
|
3
3
|
# Authors: Lukas Gemein <l.gemein@gmail.com>
|
|
4
|
+
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
4
5
|
#
|
|
5
6
|
# License: BSD (3-clause)
|
|
6
7
|
|
|
@@ -270,7 +271,9 @@ def _load_parallel(path, i, preload, is_raw, has_stored_windows):
|
|
|
270
271
|
else:
|
|
271
272
|
window_kwargs = _load_kwargs_json("window_kwargs", sub_dir)
|
|
272
273
|
windows_ds_kwargs = [
|
|
273
|
-
kwargs[1]
|
|
274
|
+
kwargs[1]
|
|
275
|
+
for kwargs in window_kwargs
|
|
276
|
+
if kwargs[0] in ("WindowsDataset", "EEGWindowsDataset")
|
|
274
277
|
]
|
|
275
278
|
windows_ds_kwargs = windows_ds_kwargs[0] if len(windows_ds_kwargs) == 1 else {}
|
|
276
279
|
if is_raw:
|
{braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/functional/__init__.py
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from .functions import (
|
|
2
2
|
_get_gaussian_kernel1d,
|
|
3
|
-
apply_rotary,
|
|
4
3
|
daubechies_filters,
|
|
5
4
|
drop_path,
|
|
6
5
|
dwt_max_level,
|
|
@@ -9,8 +8,7 @@ from .functions import (
|
|
|
9
8
|
iou_1d,
|
|
10
9
|
pairwise_iou_1d,
|
|
11
10
|
plv_time,
|
|
12
|
-
|
|
13
|
-
rotate_half,
|
|
11
|
+
rotate_pairs,
|
|
14
12
|
safe_log,
|
|
15
13
|
sinusoidal_positional_encoding,
|
|
16
14
|
square,
|
|
@@ -20,7 +18,6 @@ from .initialization import glorot_weight_zero_bias, rescale_parameter
|
|
|
20
18
|
|
|
21
19
|
__all__ = [
|
|
22
20
|
"_get_gaussian_kernel1d",
|
|
23
|
-
"apply_rotary",
|
|
24
21
|
"daubechies_filters",
|
|
25
22
|
"drop_path",
|
|
26
23
|
"dwt_max_level",
|
|
@@ -29,8 +26,7 @@ __all__ = [
|
|
|
29
26
|
"iou_1d",
|
|
30
27
|
"pairwise_iou_1d",
|
|
31
28
|
"plv_time",
|
|
32
|
-
"
|
|
33
|
-
"rotate_half",
|
|
29
|
+
"rotate_pairs",
|
|
34
30
|
"safe_log",
|
|
35
31
|
"sinusoidal_positional_encoding",
|
|
36
32
|
"square",
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""Real-valued DFT helpers for accelerators without complex tensors.
|
|
2
|
+
|
|
3
|
+
Intel Gaudi (HPU) has no complex dtype, so ``torch.fft`` with complex outputs
|
|
4
|
+
cannot run there. These helpers express the one-sided DFT, and the inverse
|
|
5
|
+
transforms built on top of it, as matmuls against a cosine/sine basis. Under
|
|
6
|
+
bfloat16 autocast those matmuls would run in bfloat16, whereas ``torch.fft`` is
|
|
7
|
+
never downcast, so callers wrap the numerically sensitive parts with
|
|
8
|
+
:func:`fp32_island`.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# Authors: Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
12
|
+
#
|
|
13
|
+
# License: BSD (3-clause)
|
|
14
|
+
import functools
|
|
15
|
+
|
|
16
|
+
import torch
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def needs_real_dft(x: torch.Tensor) -> bool:
|
|
20
|
+
"""Whether ``x`` lives on a device without complex-tensor FFT support."""
|
|
21
|
+
return x.device.type == "hpu"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def fp32_island(fn):
|
|
25
|
+
"""Run ``fn`` with autocast disabled, in at least float32 precision.
|
|
26
|
+
|
|
27
|
+
Any bfloat16/float16 tensor argument is upcast to float32 before ``fn``
|
|
28
|
+
runs; float32 and float64 arguments are left untouched, so the same code
|
|
29
|
+
path can also be checked against a float64 ``torch.fft`` reference.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
@functools.wraps(fn)
|
|
33
|
+
def wrapped(*args, **kwargs):
|
|
34
|
+
ref = next(a for a in args if isinstance(a, torch.Tensor))
|
|
35
|
+
with torch.autocast(device_type=ref.device.type, enabled=False):
|
|
36
|
+
args = tuple(
|
|
37
|
+
a.float()
|
|
38
|
+
if isinstance(a, torch.Tensor)
|
|
39
|
+
and a.is_floating_point()
|
|
40
|
+
and torch.finfo(a.dtype).bits < 32
|
|
41
|
+
else a
|
|
42
|
+
for a in args
|
|
43
|
+
)
|
|
44
|
+
return fn(*args, **kwargs)
|
|
45
|
+
|
|
46
|
+
return wrapped
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def real_dft_basis(n, *, device, dtype):
|
|
50
|
+
"""One-sided cosine/sine basis of an ``n``-point DFT, shape ``(n // 2 + 1, n)``.
|
|
51
|
+
|
|
52
|
+
The phase index is reduced modulo ``n`` in integers before scaling, so the
|
|
53
|
+
DC row is exact (``sin`` is exactly zero there); the Nyquist row (present
|
|
54
|
+
for even ``n``) is exact to floating-point precision.
|
|
55
|
+
"""
|
|
56
|
+
if n <= 0:
|
|
57
|
+
raise ValueError("n must be positive")
|
|
58
|
+
if (n // 2) * (n - 1) >= 2**31:
|
|
59
|
+
# The int32 phase index below would overflow and give wrong phases.
|
|
60
|
+
raise ValueError(f"n={n} exceeds the 65536 samples of the real-valued DFT")
|
|
61
|
+
freqs = torch.arange(n // 2 + 1, device=device, dtype=torch.int32)
|
|
62
|
+
samples = torch.arange(n, device=device, dtype=torch.int32)
|
|
63
|
+
phase_index = (freqs[:, None] * samples[None, :]) % n
|
|
64
|
+
angles = 2 * torch.pi * phase_index.to(dtype) / n
|
|
65
|
+
return angles.cos(), angles.sin()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def real_rfft(x):
|
|
69
|
+
"""Real and imaginary parts of ``torch.fft.rfft(x, dim=-1)`` without complex tensors."""
|
|
70
|
+
n = x.shape[-1]
|
|
71
|
+
cosine, sine = real_dft_basis(n, device=x.device, dtype=x.dtype)
|
|
72
|
+
return x @ cosine.transpose(0, 1), -(x @ sine.transpose(0, 1))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def real_irfft(real, imag, *, n):
|
|
76
|
+
"""``torch.fft.irfft(torch.complex(real, imag), n=n, dim=-1)`` without complex tensors."""
|
|
77
|
+
if real.shape[-1] != n // 2 + 1:
|
|
78
|
+
raise ValueError(
|
|
79
|
+
f"expected {n // 2 + 1} one-sided bins for n={n}, got {real.shape[-1]}"
|
|
80
|
+
)
|
|
81
|
+
cosine, sine = real_dft_basis(n, device=real.device, dtype=real.dtype)
|
|
82
|
+
output = real[..., :1] @ cosine[:1, :]
|
|
83
|
+
if n % 2 == 0:
|
|
84
|
+
interior = slice(1, -1)
|
|
85
|
+
output = output + real[..., -1:] @ cosine[-1:, :]
|
|
86
|
+
else:
|
|
87
|
+
interior = slice(1, None)
|
|
88
|
+
if real.shape[-1] > (2 if n % 2 == 0 else 1):
|
|
89
|
+
output = output + 2 * (
|
|
90
|
+
real[..., interior] @ cosine[interior, :]
|
|
91
|
+
- imag[..., interior] @ sine[interior, :]
|
|
92
|
+
)
|
|
93
|
+
return output / n
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def real_analytic_ifft(real, imag, *, n):
|
|
97
|
+
"""Inverse ``n``-point FFT of a one-sided spectrum, without complex tensors.
|
|
98
|
+
|
|
99
|
+
``real``/``imag`` hold the bins ``0 .. n // 2`` of a length-``n`` spectrum
|
|
100
|
+
whose remaining (negative-frequency) bins are zero, so this is a plain
|
|
101
|
+
(non-Hermitian) inverse DFT, not :func:`real_irfft`. Returns the real and
|
|
102
|
+
imaginary parts of the generally complex time-domain signal, each of shape
|
|
103
|
+
``(..., n)``. This is the last step of :func:`hilbert_freq_real`.
|
|
104
|
+
"""
|
|
105
|
+
if real.shape[-1] != n // 2 + 1:
|
|
106
|
+
raise ValueError(
|
|
107
|
+
f"expected {n // 2 + 1} one-sided bins for n={n}, got {real.shape[-1]}"
|
|
108
|
+
)
|
|
109
|
+
cosine, sine = real_dft_basis(n, device=real.device, dtype=real.dtype)
|
|
110
|
+
out_real = (real @ cosine - imag @ sine) / n
|
|
111
|
+
out_imag = (real @ sine + imag @ cosine) / n
|
|
112
|
+
return out_real, out_imag
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@torch.jit.unused
|
|
116
|
+
def hilbert_freq_real(x: torch.Tensor, forward_fourier: bool) -> torch.Tensor:
|
|
117
|
+
"""Real-valued equivalent of :func:`braindecode.functional.hilbert_freq`.
|
|
118
|
+
|
|
119
|
+
Lives here rather than in ``functions.py`` because ``torch.jit.unused`` needs
|
|
120
|
+
real annotations, and ``functions.py`` uses ``from __future__ import annotations``.
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
@fp32_island
|
|
124
|
+
def compute(x):
|
|
125
|
+
if forward_fourier:
|
|
126
|
+
seq_len = x.shape[-1]
|
|
127
|
+
real, imag = real_rfft(x)
|
|
128
|
+
else:
|
|
129
|
+
seq_len = 2 * (x.shape[-2] - 1)
|
|
130
|
+
real, imag = x[..., 0], x[..., 1]
|
|
131
|
+
scale = torch.full((real.shape[-1],), 2.0, dtype=real.dtype, device=real.device)
|
|
132
|
+
scale[0] = 1.0 # Don't multiply the DC-term by 2
|
|
133
|
+
if forward_fourier and seq_len % 2 == 0:
|
|
134
|
+
scale[-1] = 1.0 # Nor the Nyquist term, which only exists for even lengths
|
|
135
|
+
out_real, out_imag = real_analytic_ifft(real * scale, imag * scale, n=seq_len)
|
|
136
|
+
return torch.stack((out_real, out_imag), dim=-1)
|
|
137
|
+
|
|
138
|
+
return compute(x)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Authors: Robin Schirrmeister <robintibor@gmail.com>
|
|
2
2
|
# Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
3
3
|
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
4
|
-
# Julien Gadonneix <juliengado.2001@gmail.com>
|
|
5
4
|
#
|
|
6
5
|
# License: BSD (3-clause)
|
|
7
6
|
|
|
@@ -13,6 +12,8 @@ import numpy as np
|
|
|
13
12
|
import torch
|
|
14
13
|
import torch.nn.functional as F
|
|
15
14
|
|
|
15
|
+
from . import _real_dft
|
|
16
|
+
|
|
16
17
|
|
|
17
18
|
def square(x):
|
|
18
19
|
return x * x
|
|
@@ -166,18 +167,40 @@ def hilbert_freq(x: torch.Tensor, forward_fourier: bool = True) -> torch.Tensor:
|
|
|
166
167
|
https://github.com/scipy/scipy/blob/v1.14.1/scipy/signal/_signaltools.py#L2287-L2394
|
|
167
168
|
|
|
168
169
|
"""
|
|
170
|
+
if _real_dft.needs_real_dft(x):
|
|
171
|
+
return _real_dft.hilbert_freq_real(x, forward_fourier).to(x.dtype)
|
|
172
|
+
|
|
173
|
+
input_dtype = x.dtype
|
|
174
|
+
# ``view_as_complex`` does not accept bfloat16 real/imaginary pairs. The
|
|
175
|
+
# HPU path can produce bfloat16 Fourier coefficients under autocast, so do
|
|
176
|
+
# the complex-valued part in float32 and restore the real-valued contract
|
|
177
|
+
# at the boundary. Promoting before the FFT also covers backends that do
|
|
178
|
+
# not implement bfloat16 FFT kernels.
|
|
179
|
+
if input_dtype == torch.bfloat16:
|
|
180
|
+
x = x.float()
|
|
181
|
+
|
|
169
182
|
if forward_fourier:
|
|
183
|
+
seq_len = x.shape[-1]
|
|
170
184
|
x = torch.fft.rfft(x, norm=None, dim=-1)
|
|
171
185
|
x = torch.view_as_real(x)
|
|
186
|
+
else:
|
|
187
|
+
# The one-sided spectrum does not record whether the signal length
|
|
188
|
+
# was odd or even, so assume an even length here.
|
|
189
|
+
seq_len = 2 * (x.shape[-2] - 1)
|
|
172
190
|
x = x * 2.0
|
|
173
191
|
x[..., 0, :] = x[..., 0, :] / 2.0 # Don't multiply the DC-term by 2
|
|
192
|
+
if forward_fourier and seq_len % 2 == 0:
|
|
193
|
+
# Nor the Nyquist term, which only exists for even lengths
|
|
194
|
+
x[..., -1, :] = x[..., -1, :] / 2.0
|
|
174
195
|
x = F.pad(
|
|
175
|
-
x, [0, 0, 0, x.shape[-2]
|
|
196
|
+
x, [0, 0, 0, seq_len - x.shape[-2]]
|
|
176
197
|
) # Fill Fourier coefficients to retain shape
|
|
177
198
|
x = torch.view_as_complex(x)
|
|
178
199
|
x = torch.fft.ifft(x, norm=None, dim=-1) # returns complex signal
|
|
179
200
|
x = torch.view_as_real(x)
|
|
180
201
|
|
|
202
|
+
if input_dtype == torch.bfloat16:
|
|
203
|
+
x = x.to(input_dtype)
|
|
181
204
|
return x
|
|
182
205
|
|
|
183
206
|
|
|
@@ -449,109 +472,19 @@ def sinusoidal_positional_encoding(n_positions: int, dim: int) -> torch.Tensor:
|
|
|
449
472
|
return pe[:, :dim].contiguous()
|
|
450
473
|
|
|
451
474
|
|
|
452
|
-
def
|
|
453
|
-
|
|
454
|
-
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
455
|
-
r"""Cosine and sine tables of a half-split rotary embedding (RoPE).
|
|
456
|
-
|
|
457
|
-
RoPE [Su2021]_ encodes position by rotating each attention head in the
|
|
458
|
-
:math:`d/2` planes formed by pairing up its dimensions, the plane of index
|
|
459
|
-
:math:`j` turning by :math:`p \cdot base^{-2j/d}` at position :math:`p`.
|
|
460
|
-
|
|
461
|
-
Pairs are formed *half-split*, as :math:`(x_j, x_{j + d/2})`, which is the
|
|
462
|
-
convention of GPT-NeoX, Llama and the transformers library, rather than the
|
|
463
|
-
*interleaved* :math:`(x_{2j}, x_{2j+1})` of the original paper. The two
|
|
464
|
-
differ only by a fixed permutation of the head dimension, so a model trained
|
|
465
|
-
from scratch is indifferent, but a pre-trained checkpoint is not. Use
|
|
466
|
-
:func:`apply_rotary`, whose pairing matches.
|
|
467
|
-
|
|
468
|
-
Each of the :math:`d/2` angles is therefore tabulated twice, at ``j`` and at
|
|
469
|
-
``j + head_dim // 2``, so the tables broadcast against a full-width head.
|
|
470
|
-
|
|
471
|
-
Parameters
|
|
472
|
-
----------
|
|
473
|
-
n_positions : int
|
|
474
|
-
Number of positions to tabulate.
|
|
475
|
-
head_dim : int
|
|
476
|
-
Dimension of an attention head. Must be even.
|
|
477
|
-
base : float, default=10000.0
|
|
478
|
-
Base of the geometric progression of frequencies. Larger values lengthen
|
|
479
|
-
the wavelengths, extending the range of positions that stay
|
|
480
|
-
distinguishable.
|
|
481
|
-
|
|
482
|
-
Returns
|
|
483
|
-
-------
|
|
484
|
-
tuple of torch.Tensor
|
|
485
|
-
Two ``(n_positions, head_dim)`` float tables, the cosines and the sines.
|
|
486
|
-
Callers index them with their own positions and add broadcast axes.
|
|
487
|
-
|
|
488
|
-
References
|
|
489
|
-
----------
|
|
490
|
-
.. [Su2021] Su, J., Lu, Y., Pan, S., Murtadha, A., Wen, B., & Liu, Y.
|
|
491
|
-
(2021). RoFormer: Enhanced Transformer with Rotary Position Embedding.
|
|
492
|
-
arXiv preprint arXiv:2104.09864.
|
|
493
|
-
|
|
494
|
-
Examples
|
|
495
|
-
--------
|
|
496
|
-
>>> import torch
|
|
497
|
-
>>> from braindecode.functional import rotary_positional_encoding
|
|
498
|
-
>>> cos, sin = rotary_positional_encoding(n_positions=16, head_dim=8)
|
|
499
|
-
>>> cos.shape
|
|
500
|
-
torch.Size([16, 8])
|
|
501
|
-
"""
|
|
502
|
-
if head_dim % 2:
|
|
503
|
-
raise ValueError(
|
|
504
|
-
f"head_dim must be even to pair up its dimensions, got {head_dim}."
|
|
505
|
-
)
|
|
506
|
-
inv_freq = 1.0 / torch.pow(
|
|
507
|
-
base, torch.arange(0, head_dim, 2, dtype=torch.float32) / head_dim
|
|
508
|
-
)
|
|
509
|
-
angles = torch.outer(torch.arange(n_positions, dtype=torch.float32), inv_freq)
|
|
510
|
-
# Concatenating rather than interleaving is what places the angle of plane j
|
|
511
|
-
# at j and j + head_dim // 2, which is the pairing rotate_half applies.
|
|
512
|
-
angles = torch.cat((angles, angles), dim=-1)
|
|
513
|
-
return angles.cos(), angles.sin()
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
def rotate_half(x: torch.Tensor) -> torch.Tensor:
|
|
517
|
-
"""Swap the two halves of the last axis of ``x``, negating the second one.
|
|
518
|
-
|
|
519
|
-
The companion of :func:`rotary_positional_encoding`: pairing dimension
|
|
520
|
-
:math:`j` with :math:`j + d/2` makes this the quarter-turn that
|
|
521
|
-
:func:`apply_rotary` mixes into the unrotated tensor.
|
|
522
|
-
|
|
523
|
-
Parameters
|
|
524
|
-
----------
|
|
525
|
-
x : torch.Tensor
|
|
526
|
-
Tensor whose last axis is even.
|
|
527
|
-
|
|
528
|
-
Returns
|
|
529
|
-
-------
|
|
530
|
-
torch.Tensor
|
|
531
|
-
Tensor of the same shape, holding ``(-x[..., d/2:], x[..., :d/2])``.
|
|
532
|
-
"""
|
|
533
|
-
first, second = x.chunk(2, dim=-1)
|
|
534
|
-
return torch.cat((-second, first), dim=-1)
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
def apply_rotary(x: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor) -> torch.Tensor:
|
|
538
|
-
r"""Rotate ``x`` by the angles of a half-split rotary embedding.
|
|
539
|
-
|
|
540
|
-
Computes :math:`x \cos\theta + \mathrm{rotate\_half}(x) \sin\theta`, which
|
|
541
|
-
turns each pair :math:`(x_j, x_{j + d/2})` by :math:`\theta_j` in its own
|
|
542
|
-
plane. Being a rotation, it leaves the norm of every head unchanged.
|
|
475
|
+
def rotate_pairs(x: torch.Tensor) -> torch.Tensor:
|
|
476
|
+
"""Rotate adjacent feature pairs from ``(a, b)`` to ``(-b, a)``.
|
|
543
477
|
|
|
544
478
|
Parameters
|
|
545
479
|
----------
|
|
546
480
|
x : torch.Tensor
|
|
547
|
-
|
|
548
|
-
cos, sin : torch.Tensor
|
|
549
|
-
Tables from :func:`rotary_positional_encoding`, indexed by the positions
|
|
550
|
-
of ``x`` and carrying whatever axes are needed to broadcast against it.
|
|
481
|
+
Tensor of shape ``(..., features)`` with an even final dimension.
|
|
551
482
|
|
|
552
483
|
Returns
|
|
553
484
|
-------
|
|
554
485
|
torch.Tensor
|
|
555
|
-
|
|
486
|
+
Same shape, device and dtype as ``x``. Frequencies, positional indexing
|
|
487
|
+
and mixed-precision policy are left to the caller.
|
|
556
488
|
"""
|
|
557
|
-
|
|
489
|
+
pairs = x.unflatten(-1, (-1, 2))
|
|
490
|
+
return torch.stack((-pairs[..., 1], pairs[..., 0]), dim=-1).flatten(-2)
|
{braindecode-1.8.1.dev169274909 → braindecode-1.8.1.dev170227516}/braindecode/models/__init__.py
RENAMED
|
@@ -7,7 +7,9 @@ from .barista import BaRISTA
|
|
|
7
7
|
from .base import EEGModuleMixin
|
|
8
8
|
from .bendr import BENDR, InterpolatedBENDR
|
|
9
9
|
from .biot import BIOT, InterpolatedBIOT
|
|
10
|
+
from .brainbert import BrainBERT
|
|
10
11
|
from .brainmodule import BrainModule
|
|
12
|
+
from .brant import Brant
|
|
11
13
|
from .cbramod import CBraMod
|
|
12
14
|
from .codebrain import CodeBrain
|
|
13
15
|
from .contrawr import ContraWR
|
|
@@ -16,6 +18,7 @@ from .dance import DANCE
|
|
|
16
18
|
from .deep4 import Deep4Net
|
|
17
19
|
from .deepsleepnet import DeepSleepNet
|
|
18
20
|
from .dgcnn import DGCNN
|
|
21
|
+
from .diver1 import DIVER1
|
|
19
22
|
from .eegconformer import EEGConformer
|
|
20
23
|
from .eegdino import EEGDINO
|
|
21
24
|
from .eeginception_erp import EEGInceptionERP
|
|
@@ -39,6 +42,8 @@ from .labram import InterpolatedLaBraM, Labram
|
|
|
39
42
|
from .luna import LUNA
|
|
40
43
|
from .medformer import MEDFormer
|
|
41
44
|
from .meta_neuromotor import MetaNeuromotorHand
|
|
45
|
+
from .mirepnet import MIRepNet
|
|
46
|
+
from .mscformer import MSCFormer
|
|
42
47
|
from .msvtnet import MSVTNet
|
|
43
48
|
from .mvpformer import MVPFormer
|
|
44
49
|
from .neuropose import NeuroPose
|
|
@@ -89,6 +94,7 @@ __all__ = [
|
|
|
89
94
|
"EEGModuleMixin",
|
|
90
95
|
"BIOT",
|
|
91
96
|
"BENDR",
|
|
97
|
+
"BrainBERT",
|
|
92
98
|
"CBraMod",
|
|
93
99
|
"CodeBrain",
|
|
94
100
|
"ContraWR",
|
|
@@ -96,7 +102,9 @@ __all__ = [
|
|
|
96
102
|
"DANCE",
|
|
97
103
|
"Deep4Net",
|
|
98
104
|
"DeepSleepNet",
|
|
105
|
+
"DIVER1",
|
|
99
106
|
"BrainModule",
|
|
107
|
+
"Brant",
|
|
100
108
|
"EEGConformer",
|
|
101
109
|
"EEGDINO",
|
|
102
110
|
"EEGPT",
|
|
@@ -131,6 +139,8 @@ __all__ = [
|
|
|
131
139
|
"extract_channel_locations_from_chs_info",
|
|
132
140
|
"positions_from_chs_info",
|
|
133
141
|
"MEDFormer",
|
|
142
|
+
"MIRepNet",
|
|
143
|
+
"MSCFormer",
|
|
134
144
|
"MSVTNet",
|
|
135
145
|
"MVPFormer",
|
|
136
146
|
"PBT",
|