braindecode 2.1.0.dev179580438__tar.gz → 2.1.0.dev180967944__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.
Files changed (223) hide show
  1. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/NOTICE.txt +5 -0
  2. {braindecode-2.1.0.dev179580438/braindecode.egg-info → braindecode-2.1.0.dev180967944}/PKG-INFO +1 -1
  3. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/__init__.py +1 -0
  4. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/luna.py +28 -0
  5. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/summary.csv +1 -0
  6. braindecode-2.1.0.dev180967944/braindecode/models/tccnet.py +327 -0
  7. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/util.py +7 -0
  8. braindecode-2.1.0.dev180967944/braindecode/version.py +1 -0
  9. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944/braindecode.egg-info}/PKG-INFO +1 -1
  10. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode.egg-info/SOURCES.txt +1 -0
  11. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/api.rst +1 -0
  12. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/whats_new.rst +13 -0
  13. braindecode-2.1.0.dev179580438/braindecode/version.py +0 -1
  14. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/LICENSE.txt +0 -0
  15. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/MANIFEST.in +0 -0
  16. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/README.rst +0 -0
  17. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/__init__.py +0 -0
  18. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/augmentation/__init__.py +0 -0
  19. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/augmentation/base.py +0 -0
  20. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/augmentation/functional.py +0 -0
  21. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/augmentation/transforms.py +0 -0
  22. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/classifier.py +0 -0
  23. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/__init__.py +0 -0
  24. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/_notebook_viewer.py +0 -0
  25. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/base.py +0 -0
  26. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bbci.py +0 -0
  27. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bcicomp.py +0 -0
  28. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bids/__init__.py +0 -0
  29. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bids/datasets.py +0 -0
  30. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bids/hub.py +0 -0
  31. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bids/hub_format.py +0 -0
  32. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bids/hub_io.py +0 -0
  33. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bids/hub_validation.py +0 -0
  34. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/bids/iterable.py +0 -0
  35. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/chb_mit.py +0 -0
  36. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/collate.py +0 -0
  37. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/mne.py +0 -0
  38. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/moabb.py +0 -0
  39. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/nmt.py +0 -0
  40. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/registry.py +0 -0
  41. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/siena.py +0 -0
  42. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
  43. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/sleep_physionet.py +0 -0
  44. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/tuh.py +0 -0
  45. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/utils.py +0 -0
  46. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datasets/xy.py +0 -0
  47. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datautil/__init__.py +0 -0
  48. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datautil/channel_utils.py +0 -0
  49. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datautil/hub_formats.py +0 -0
  50. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datautil/serialization.py +0 -0
  51. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/datautil/util.py +0 -0
  52. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/eegneuralnet.py +0 -0
  53. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/functional/__init__.py +0 -0
  54. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/functional/_lfilter.py +0 -0
  55. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/functional/_real_dft.py +0 -0
  56. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/functional/attention.py +0 -0
  57. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/functional/channel_mask.py +0 -0
  58. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/functional/functions.py +0 -0
  59. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/functional/initialization.py +0 -0
  60. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/functional/patches.py +0 -0
  61. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/atcnet.py +0 -0
  62. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/attentionbasenet.py +0 -0
  63. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/attn_sleep.py +0 -0
  64. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/axon.py +0 -0
  65. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/barista.py +0 -0
  66. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/base.py +0 -0
  67. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/bbl.py +0 -0
  68. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/bendr.py +0 -0
  69. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/biot.py +0 -0
  70. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/brainbert.py +0 -0
  71. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/brainmodule.py +0 -0
  72. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/brainomni.py +0 -0
  73. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/brant.py +0 -0
  74. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/cbramod.py +0 -0
  75. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/codebrain.py +0 -0
  76. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/config.py +0 -0
  77. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/contrawr.py +0 -0
  78. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/corteg.py +0 -0
  79. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/csbrain.py +0 -0
  80. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/ctnet.py +0 -0
  81. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/dance.py +0 -0
  82. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/deep4.py +0 -0
  83. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/deepsleepnet.py +0 -0
  84. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/dgcnn.py +0 -0
  85. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/diver1.py +0 -0
  86. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/duin.py +0 -0
  87. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eeg_clip.py +0 -0
  88. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegconformer.py +0 -0
  89. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegdino.py +0 -0
  90. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eeginception_erp.py +0 -0
  91. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eeginception_mi.py +0 -0
  92. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegitnet.py +0 -0
  93. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegminer.py +0 -0
  94. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegnet.py +0 -0
  95. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegnex.py +0 -0
  96. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegpt.py +0 -0
  97. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegsimpleconv.py +0 -0
  98. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegsym.py +0 -0
  99. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/eegtcnet.py +0 -0
  100. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/emg2qwerty.py +0 -0
  101. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/epint.py +0 -0
  102. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/fbcnet.py +0 -0
  103. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/fblightconvnet.py +0 -0
  104. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/fbmsnet.py +0 -0
  105. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/gcnsnet.py +0 -0
  106. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/guetschel2026.py +0 -0
  107. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/hybrid.py +0 -0
  108. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/ifnet.py +0 -0
  109. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/labram.py +0 -0
  110. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/mapa.py +0 -0
  111. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/medformer.py +0 -0
  112. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/meggpt.py +0 -0
  113. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/megxl.py +0 -0
  114. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/meta_neuromotor.py +0 -0
  115. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/mirepnet.py +0 -0
  116. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/model.html.jinja +0 -0
  117. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/mscformer.py +0 -0
  118. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/msvtnet.py +0 -0
  119. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/mvpformer.py +0 -0
  120. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/neuropose.py +0 -0
  121. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/neurorvq.py +0 -0
  122. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/neurorvq_tokenizer.py +0 -0
  123. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/nice.py +0 -0
  124. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/patchedtransformer.py +0 -0
  125. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/popt.py +0 -0
  126. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/reve.py +0 -0
  127. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/sccnet.py +0 -0
  128. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/seizure_transformer.py +0 -0
  129. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/sensingdynamics.py +0 -0
  130. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/shallow_fbcsp.py +0 -0
  131. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/signal_jepa.py +0 -0
  132. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/sinc_shallow.py +0 -0
  133. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
  134. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
  135. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/sleepfm.py +0 -0
  136. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/sparcnet.py +0 -0
  137. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/sstdpn.py +0 -0
  138. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/steegformer.py +0 -0
  139. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/syncnet.py +0 -0
  140. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/tcformer.py +0 -0
  141. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/tcn.py +0 -0
  142. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/tfm_tokenizer.py +0 -0
  143. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/tidnet.py +0 -0
  144. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/tmsanet.py +0 -0
  145. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/tsinception.py +0 -0
  146. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/usleep.py +0 -0
  147. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/vemg2pose.py +0 -0
  148. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/models/zuna.py +0 -0
  149. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/__init__.py +0 -0
  150. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/activation.py +0 -0
  151. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/attention.py +0 -0
  152. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/blocks.py +0 -0
  153. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/channels.py +0 -0
  154. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/convolution.py +0 -0
  155. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/dance_modules.py +0 -0
  156. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/filter.py +0 -0
  157. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/layers.py +0 -0
  158. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/linear.py +0 -0
  159. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/linear_attention.py +0 -0
  160. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/parametrization.py +0 -0
  161. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/quantization.py +0 -0
  162. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/seanet.py +0 -0
  163. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/stats.py +0 -0
  164. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/util.py +0 -0
  165. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/modules/wrapper.py +0 -0
  166. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/preprocessing/__init__.py +0 -0
  167. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
  168. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/preprocessing/mne_preprocess.py +0 -0
  169. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/preprocessing/preprocess.py +0 -0
  170. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/preprocessing/util.py +0 -0
  171. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/preprocessing/windowers.py +0 -0
  172. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/regressor.py +0 -0
  173. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/samplers/__init__.py +0 -0
  174. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/samplers/base.py +0 -0
  175. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/samplers/ssl.py +0 -0
  176. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/training/__init__.py +0 -0
  177. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/training/_trial_aggregation.py +0 -0
  178. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/training/callbacks.py +0 -0
  179. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/training/losses.py +0 -0
  180. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/training/scoring.py +0 -0
  181. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/util.py +0 -0
  182. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/visualization/__init__.py +0 -0
  183. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/visualization/activations.py +0 -0
  184. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/visualization/attribution.py +0 -0
  185. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/visualization/confusion_matrices.py +0 -0
  186. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/visualization/frequency.py +0 -0
  187. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/visualization/metrics.py +0 -0
  188. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/visualization/sanity.py +0 -0
  189. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode/visualization/topology.py +0 -0
  190. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode.egg-info/dependency_links.txt +0 -0
  191. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode.egg-info/requires.txt +0 -0
  192. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/braindecode.egg-info/top_level.txt +0 -0
  193. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/Makefile +0 -0
  194. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/_templates/autosummary/class.rst +0 -0
  195. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
  196. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/_templates/autosummary/function.rst +0 -0
  197. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
  198. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/agent_docs.rst +0 -0
  199. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/cite.rst +0 -0
  200. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/conf.py +0 -0
  201. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/help.rst +0 -0
  202. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/index.rst +0 -0
  203. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/install/install.rst +0 -0
  204. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/install/install_pip.rst +0 -0
  205. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/install/install_source.rst +0 -0
  206. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/attention.rst +0 -0
  207. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/channel.rst +0 -0
  208. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/convolution.rst +0 -0
  209. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/filterbank.rst +0 -0
  210. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/gnn.rst +0 -0
  211. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/interpretable.rst +0 -0
  212. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/lbm.rst +0 -0
  213. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/recurrent.rst +0 -0
  214. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/categorization/spd.rst +0 -0
  215. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/models.rst +0 -0
  216. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/models_categorization.rst +0 -0
  217. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/models_table.rst +0 -0
  218. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/models/models_visualization.rst +0 -0
  219. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/sg_execution_times.rst +0 -0
  220. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/user_guide/channel_strategies.rst +0 -0
  221. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/docs/user_guide/cropped_inference.rst +0 -0
  222. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/pyproject.toml +0 -0
  223. {braindecode-2.1.0.dev179580438 → braindecode-2.1.0.dev180967944}/setup.cfg +0 -0
@@ -62,6 +62,8 @@ The following components are licensed under the MIT License:
62
62
  - `braindecode/models/meggpt.py`
63
63
  - `braindecode/models/megxl.py`
64
64
  - `braindecode/models/nice.py`
65
+ - `braindecode/models/tccnet.py`
66
+ - `docs/_static/model/tccnet.png`
65
67
 
66
68
  The `brainomni.py` file is a derivative of `OpenTSLab/BrainOmni` (MIT). The
67
69
  `seanet.py` module holds its SEANet codec, derived from Meta's
@@ -70,6 +72,9 @@ residual vector quantization derived from `lucidrains/vector-quantize-pytorch`
70
72
  (MIT) and the BrainOmni port.
71
73
  The `linear_attention.py` module is the part of
72
74
  `lucidrains/linear-attention-transformer` (MIT) that BIOT and TFMTokenizer run.
75
+ The `tccnet.py` file is a derivative of `DSIP-UPatras/ICASSP2019_TCN` (MIT),
76
+ whose average-over-time and context-attention layers come from
77
+ `cbaziotis/keras-utilities` (MIT).
73
78
 
74
79
  ### Apache-2.0 Licensed Files
75
80
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: braindecode
3
- Version: 2.1.0.dev179580438
3
+ Version: 2.1.0.dev180967944
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>
@@ -94,6 +94,7 @@ if TYPE_CHECKING:
94
94
  from .sstdpn import SSTDPN
95
95
  from .steegformer import STEEGFormer
96
96
  from .syncnet import SyncNet
97
+ from .tccnet import TCCNet
97
98
  from .tcformer import TCFormer
98
99
  from .tcn import BDTCN, TCN
99
100
  from .tfm_tokenizer import TFMTokenizer, TFMTokenizerOutput
@@ -290,6 +290,27 @@ class LUNA(EEGModuleMixin, nn.Module, license="apache-2.0"):
290
290
  self.apply(_init_weights)
291
291
  self.fix_init_weight()
292
292
 
293
+ def reset_head(self, n_outputs: int) -> None:
294
+ """Replace the classification head for ``n_outputs`` classes.
295
+
296
+ A reconstruction model (``n_outputs=0``) becomes a classifier: its
297
+ decoder and channel embedding are removed.
298
+ """
299
+ self._set_n_outputs(n_outputs)
300
+ self.num_classes = n_outputs
301
+ self.final_layer = _ClassificationHeadWithQueries(
302
+ input_dim=self.patch_size,
303
+ num_queries=self.num_queries,
304
+ embed_dim=self.embed_dim,
305
+ num_classes=n_outputs,
306
+ num_heads=self.num_heads,
307
+ )
308
+ self.final_layer.apply(_init_weights)
309
+ if hasattr(self, "decoder_head"):
310
+ del self.decoder_head
311
+ del self.channel_emb
312
+ self.mask_token.requires_grad = False
313
+
293
314
  def initialize_weights(self) -> None:
294
315
  """Re-run LUNA's own weight initialization.
295
316
 
@@ -621,6 +642,13 @@ class _FrequencyFeatureEmbedder(nn.Module):
621
642
  freq_representation = fft.rfft(
622
643
  spectral_input(x), dim=-1
623
644
  ) # (B, C, num_patches, patch_size // 2 + 1)
645
+ # DC and Nyquist bins are real: drop GPU rounding noise that flips
646
+ # their phase between pi and -pi.
647
+ imag = freq_representation.imag.clone()
648
+ imag[..., 0] = 0.0
649
+ if self.patch_size % 2 == 0:
650
+ imag[..., -1] = 0.0
651
+ freq_representation = torch.complex(freq_representation.real, imag)
624
652
  magnitude = torch.abs(freq_representation)
625
653
  phase = torch.angle(freq_representation)
626
654
 
@@ -50,6 +50,7 @@ FBCNet,Motor Imagery,Prediction,250,"n_chans, n_outputs, n_times, sfreq",11812,"
50
50
  FBMSNet,Motor Imagery,Prediction,250,"n_chans, n_outputs, n_times, sfreq",16231,"FBMSNet(n_chans=22, n_outputs=4, n_times=1000, sfreq=250)","Convolution,FilterBank",EEG
51
51
  MetaNeuromotorHand,Handwriting (sEMG),CTC Sequence,2000,"n_chans, n_outputs, n_times, sfreq",1021284,"MetaNeuromotorHand(n_chans=16, n_outputs=100, n_times=32000, sfreq=2000)","Convolution,Attention/Transformer",sEMG
52
52
  EMG2QwertyNet,Touch typing (sEMG),CTC Sequence,2000,"n_chans, n_outputs, n_times, sfreq",5293315,"EMG2QwertyNet(n_chans=32, n_outputs=99, n_times=8000, sfreq=2000)","Convolution",sEMG
53
+ TCCNet,Gesture recognition (sEMG),Prediction,100,"n_chans, n_outputs",88757,"TCCNet(n_chans=10, n_outputs=53)","Convolution,Recurrent,Attention/Transformer",sEMG
53
54
  VEMG2Pose,Hand pose (sEMG),Sequence Regression,2000,"n_chans, n_outputs, n_times, sfreq",5980328,"VEMG2Pose(n_chans=16, n_outputs=20, n_times=11790, sfreq=2000)","Convolution,Recurrent",sEMG
54
55
  NeuroPose,Hand pose (sEMG),Sequence Regression,2000,"n_chans, n_outputs, n_times, sfreq",6354903,"NeuroPose(n_chans=16, n_outputs=20, n_times=10000, sfreq=2000)","Convolution",sEMG
55
56
  SensingDynamics,Hand pose (sEMG),Sequence Regression,2000,"n_chans, n_outputs, n_times, sfreq",1738297,"SensingDynamics(n_chans=16, n_outputs=20, n_times=480, sfreq=2000)","Convolution,Channel",sEMG
@@ -0,0 +1,327 @@
1
+ # Authors: Panagiotis Tsinganos et al. (original implementation)
2
+ # Arslan Shafique <81501094+arslan-shafique@users.noreply.github.com>
3
+ #
4
+ # License: MIT
5
+ # Adapted from https://github.com/DSIP-UPatras/ICASSP2019_TCN (MIT).
6
+ # Its MeanOverTime and AttentionWithContext layers come from
7
+ # https://github.com/cbaziotis/keras-utilities (MIT).
8
+ """TCCNet for surface electromyography gesture recognition."""
9
+
10
+ from __future__ import annotations
11
+
12
+ import math
13
+ from collections.abc import Sequence
14
+
15
+ import torch
16
+ from torch import nn
17
+
18
+ from braindecode.functional import masked_mean
19
+ from braindecode.models.base import EEGModuleMixin
20
+ from braindecode.modules import CausalConv1d
21
+
22
+
23
+ class TCCNet(EEGModuleMixin, nn.Module, license="mit"):
24
+ r"""TCCNet from Tsinganos et al. (2019) [tccnet2019]_.
25
+
26
+ :bdg-success:`Convolution` :bdg-secondary:`Recurrent`
27
+ :bdg-info:`Attention/Transformer`
28
+
29
+ .. figure:: https://braindecode.org/dev/_static/model/tccnet.png
30
+ :align: center
31
+ :alt: TCCNet architecture
32
+
33
+ "Proposed model" panel of the authors' ICASSP 2019 poster (MIT, from
34
+ [tccnetcode]_): dilated causal convolutions, read out by an average
35
+ over time (AoT) or an attention (Att) head. Braindecode returns the
36
+ logits, without the softmax.
37
+
38
+ A temporal convolutional network that classifies a whole sEMG gesture.
39
+ Residual blocks of causal convolutions, whose dilation doubles at every
40
+ layer and keeps doubling across blocks, map the gesture to a sequence of
41
+ features. An average over time (``"aot"``) or a context-vector attention
42
+ (``"att"``) pools that sequence into one vector for a linear classifier.
43
+
44
+ The paper compares four models that differ in receptive field (RF) and
45
+ head (poster Table 1; parameters counted for 10 channels and 53 classes):
46
+
47
+ ============ ================================== ====== ==========
48
+ Model ``filters`` Convs Parameters
49
+ ============ ================================== ====== ==========
50
+ AoT, 300 ms ``((32, 64), (64, 128))`` 4 60,117
51
+ AoT, 2500 ms ``((32, 32), (32, 32), (64, 64), 7 72,245
52
+ (128,))``
53
+ Att, 300 ms ``((32, 64), (64, 128))`` 4 76,629
54
+ Att, 2500 ms ``((32, 32), (32, 32), (64, 64), 7 88,757
55
+ (128,))``
56
+ ============ ================================== ====== ==========
57
+
58
+ The defaults build Att, 2500 ms, the best model of the paper (89.76 %
59
+ top-1). Pass ``classification_head="aot"`` and/or
60
+ ``filters=((32, 64), (64, 128))`` for the other three. With
61
+ ``kernel_size=3``, the RF is 31 samples (310 ms at 100 Hz) for the
62
+ 4-convolution models and 255 samples (2550 ms) for the 7-convolution ones.
63
+
64
+ Inputs are ``(batch, n_chans, n_times)`` and may have any length. The
65
+ softmax of the reference is left out, because braindecode models return
66
+ logits.
67
+
68
+ Parameters
69
+ ----------
70
+ filters : sequence of sequence of int, default=((32, 32), (32, 32), (64, 64), (128,))
71
+ Output filters of each causal convolution, one inner sequence per
72
+ residual block. It sets the number of blocks and of convolutions per
73
+ block.
74
+ kernel_size : int, default=3
75
+ Temporal kernel size of every causal convolution.
76
+ drop_prob : float, default=0.05
77
+ Channel-wise dropout after each activated convolution, as Keras
78
+ ``SpatialDropout1D``.
79
+ activation : type[nn.Module], default=nn.ReLU
80
+ Activation after each causal convolution.
81
+ classification_head : {"att", "aot"}, default="att"
82
+ ``"att"``: context-vector attention; ``"aot"``: average over the
83
+ valid time steps.
84
+ mask_value : float | None, default=-10.0
85
+ A time step where every channel equals this value is padding: it is
86
+ zeroed before every convolution and left out of the pooling, as the
87
+ reference's Keras ``Masking`` layer does. ``None`` turns masking off.
88
+
89
+ Notes
90
+ -----
91
+ Protocol of the reference code [tccnetcode]_, for all four models: one
92
+ model per subject of NinaPro DB1 (27 subjects, 10 sEMG channels at
93
+ 100 Hz, 53 classes including rest). Each channel is rectified and
94
+ low-pass filtered by a 1 Hz first-order Butterworth filter applied
95
+ forward-backward (``filtfilt``). Each whole gesture repetition is one
96
+ sample: the variable-length gestures of a batch are pre-padded with
97
+ ``-10`` to the longest one and masked. Repetitions 1, 3, 4, 6, 8, 9
98
+ and 10 train; 2, 5 and 7 test. Training uses Adam (learning rate 0.01,
99
+ epsilon 0.001) for 30 epochs, batch size 128, L2 0.0005 on convolution
100
+ and classifier kernels (use optimizer weight decay in PyTorch), class-
101
+ balanced sample weights, and 10 augmented copies of each training
102
+ gesture (time and magnitude warping 0.2, noise at 25 dB SNR). The
103
+ generator's min-max normalisation is off in the released configurations.
104
+
105
+ The masked average over time equals the reference only for pre-padding,
106
+ the reference pipeline: the reference sums every time step, padded ones
107
+ included, and divides by the number of valid steps, while this port
108
+ always leaves padded steps out; on a fully padded input it gives NaN, as
109
+ the reference does. The bias of each convolution is added only where the
110
+ convolution output is non-zero, as in the reference ``CausalConv1D``;
111
+ this only matters for bit-exact agreement with it. The attention
112
+ subtracts the row maximum before the exponential: the same values as
113
+ the reference, which overflows to NaN once the context vector grows
114
+ large. Initialisation follows Keras 2.2.4: truncated Glorot normal
115
+ kernels, zero biases, Glorot uniform attention weights.
116
+
117
+ `License <https://github.com/DSIP-UPatras/ICASSP2019_TCN/blob/cd28909ccf3696b835446cbec2f15eb60610a2af/LICENSE>`_
118
+
119
+ References
120
+ ----------
121
+ .. [tccnet2019] Tsinganos, P., Cornelis, B., Cornelis, J., Jansen, B., &
122
+ Skodras, A. (2019). Improved Gesture Recognition Based on sEMG Signals
123
+ and TCN. ICASSP 2019, 1169-1173.
124
+ https://doi.org/10.1109/ICASSP.2019.8683239
125
+ .. [tccnetcode] Tsinganos, P. et al. ICASSP2019_TCN source code.
126
+ https://github.com/DSIP-UPatras/ICASSP2019_TCN/tree/cd28909ccf3696b835446cbec2f15eb60610a2af
127
+ """
128
+
129
+ def __init__(
130
+ self,
131
+ # Signal-related parameters.
132
+ n_outputs=None,
133
+ n_chans=None,
134
+ chs_info=None,
135
+ n_times=None,
136
+ input_window_seconds=None,
137
+ sfreq=None,
138
+ # Model parameters.
139
+ filters: Sequence[Sequence[int]] = ((32, 32), (32, 32), (64, 64), (128,)),
140
+ kernel_size: int = 3,
141
+ drop_prob: float = 0.05,
142
+ activation: type[nn.Module] = nn.ReLU,
143
+ classification_head: str = "att",
144
+ mask_value: float | None = -10.0,
145
+ ) -> None:
146
+ super().__init__(
147
+ n_outputs=n_outputs,
148
+ n_chans=n_chans,
149
+ chs_info=chs_info,
150
+ n_times=n_times,
151
+ input_window_seconds=input_window_seconds,
152
+ sfreq=sfreq,
153
+ )
154
+ del n_outputs, n_chans, chs_info, n_times, input_window_seconds, sfreq
155
+
156
+ if classification_head not in ("aot", "att"):
157
+ raise ValueError(
158
+ f"classification_head must be 'aot' or 'att', got {classification_head!r}."
159
+ )
160
+ self.mask_value = mask_value
161
+
162
+ blocks = []
163
+ in_channels = self.n_chans
164
+ dilation = 1
165
+ for block_filters in filters:
166
+ # The dilation doubles at every convolution, across blocks too.
167
+ dilations = [dilation * 2**i for i in range(len(block_filters))]
168
+ dilation *= 2 ** len(block_filters)
169
+ blocks.append(
170
+ _TCCResidualBlock(
171
+ in_channels,
172
+ block_filters,
173
+ kernel_size,
174
+ dilations,
175
+ drop_prob,
176
+ activation,
177
+ )
178
+ )
179
+ in_channels = block_filters[-1]
180
+ self.feature_extractor = nn.ModuleList(blocks)
181
+
182
+ self.attention = (
183
+ _TCCContextAttention(in_channels) if classification_head == "att" else None
184
+ )
185
+ self.final_layer = nn.Linear(in_channels, self.n_outputs)
186
+ self._init_parameters()
187
+
188
+ def _init_parameters(self) -> None:
189
+ """Keras 2.2.4 initialisation of the reference (see Notes)."""
190
+ for module in self.modules():
191
+ if isinstance(module, (CausalConv1d, nn.Linear)):
192
+ _keras_glorot_normal_(module.weight)
193
+ if isinstance(module, (_MaskedCausalConv1d, nn.Linear)):
194
+ nn.init.zeros_(module.bias)
195
+
196
+ def reset_head(self, n_outputs: int) -> None:
197
+ """Swap the classifier for a new number of outputs."""
198
+ self._set_n_outputs(n_outputs)
199
+ old = self.final_layer
200
+ self.final_layer = nn.Linear(old.in_features, n_outputs).to(
201
+ device=old.weight.device, dtype=old.weight.dtype
202
+ )
203
+ _keras_glorot_normal_(self.final_layer.weight)
204
+ nn.init.zeros_(self.final_layer.bias)
205
+
206
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
207
+ """Return logits for a batch of sEMG gestures."""
208
+ valid_mask = None
209
+ if self.mask_value is not None:
210
+ # (batch, n_chans, n_times) -> (batch, n_times), True = real step
211
+ valid_mask = torch.any(x != self.mask_value, dim=1)
212
+
213
+ features = x
214
+ for block in self.feature_extractor:
215
+ # (batch, n_chans | filters, n_times) -> (batch, filters, n_times)
216
+ features = block(features, valid_mask)
217
+ # (batch, filters, n_times) -> (batch, n_times, filters)
218
+ features = features.transpose(1, 2)
219
+
220
+ if self.attention is not None:
221
+ pooled = self.attention(features, valid_mask)
222
+ else:
223
+ pooled = masked_mean(features, valid_mask, [1])
224
+ # (batch, filters) -> (batch, n_outputs)
225
+ return self.final_layer(pooled)
226
+
227
+
228
+ def _keras_glorot_normal_(weight: torch.Tensor) -> None:
229
+ """Keras 2.2.4 ``glorot_normal``: a normal truncated at 2 sigma, rescaled
230
+ by 1 / 0.8796 (the std of a standard normal truncated at 2)."""
231
+ receptive_field = weight[0][0].numel()
232
+ fan_in = weight.shape[1] * receptive_field
233
+ fan_out = weight.shape[0] * receptive_field
234
+ std = math.sqrt(2.0 / (fan_in + fan_out)) / 0.87962566103423978
235
+ nn.init.trunc_normal_(weight, std=std, a=-2 * std, b=2 * std)
236
+
237
+
238
+ class _MaskedCausalConv1d(nn.Module):
239
+ """Reference ``CausalConv1D``: zero the padded input steps, then add the
240
+ bias only where the bias-free causal convolution is non-zero."""
241
+
242
+ def __init__(
243
+ self, in_channels: int, out_channels: int, kernel_size: int, dilation: int
244
+ ):
245
+ super().__init__()
246
+ self.conv = CausalConv1d(
247
+ in_channels, out_channels, kernel_size, dilation=dilation, bias=False
248
+ )
249
+ self.bias = nn.Parameter(torch.zeros(out_channels))
250
+
251
+ def forward(self, x: torch.Tensor, valid_mask: torch.Tensor | None) -> torch.Tensor:
252
+ if valid_mask is not None:
253
+ x = x.masked_fill(~valid_mask.unsqueeze(1), 0)
254
+ # (batch, in_channels, n_times) -> (batch, out_channels, n_times)
255
+ out = self.conv(x)
256
+ return (out + self.bias.view(1, -1, 1)) * (out != 0)
257
+
258
+
259
+ class _TCCResidualBlock(nn.Module):
260
+ """TCN residual block of the reference; private because braindecode.modules
261
+ has no shared TCN residual block (ATCNet, TCFormer and TCN keep their own)."""
262
+
263
+ def __init__(
264
+ self,
265
+ in_channels: int,
266
+ filters: Sequence[int],
267
+ kernel_size: int,
268
+ dilations: Sequence[int],
269
+ drop_prob: float,
270
+ activation: type[nn.Module],
271
+ ) -> None:
272
+ super().__init__()
273
+ # Kernel-size-1 projection of the block input onto the last filters.
274
+ self.projection = _MaskedCausalConv1d(in_channels, filters[-1], 1, 1)
275
+ self.convolutions = nn.ModuleList()
276
+ self.activations = nn.ModuleList()
277
+ self.dropouts = nn.ModuleList()
278
+ for out_channels, dilation in zip(filters, dilations):
279
+ self.convolutions.append(
280
+ _MaskedCausalConv1d(in_channels, out_channels, kernel_size, dilation)
281
+ )
282
+ self.activations.append(activation())
283
+ self.dropouts.append(nn.Dropout1d(drop_prob))
284
+ in_channels = out_channels
285
+
286
+ def forward(self, x: torch.Tensor, valid_mask: torch.Tensor | None) -> torch.Tensor:
287
+ # (batch, in_channels, n_times) -> (batch, filters[-1], n_times)
288
+ residual = self.projection(x, valid_mask)
289
+ for convolution, activation, dropout in zip(
290
+ self.convolutions, self.activations, self.dropouts
291
+ ):
292
+ x = dropout(activation(convolution(x, valid_mask)))
293
+ return x + residual
294
+
295
+
296
+ class _TCCContextAttention(nn.Module):
297
+ """``AttentionWithContext(bias=False)`` of the reference; private because
298
+ braindecode.modules has no context-vector attention pooling."""
299
+
300
+ def __init__(self, n_features: int) -> None:
301
+ super().__init__()
302
+ self.weight = nn.Parameter(torch.empty(n_features, n_features))
303
+ self.context = nn.Parameter(torch.empty(n_features))
304
+ self.reset_parameters()
305
+
306
+ def reset_parameters(self) -> None:
307
+ """Keras 2.2.4 ``glorot_uniform``; for the 1-D context vector Keras
308
+ takes fan_in = fan_out = sqrt(n_features)."""
309
+ nn.init.xavier_uniform_(self.weight)
310
+ bound = math.sqrt(3.0 / math.sqrt(self.context.numel()))
311
+ nn.init.uniform_(self.context, -bound, bound)
312
+
313
+ def forward(self, x: torch.Tensor, valid_mask: torch.Tensor | None) -> torch.Tensor:
314
+ # (batch, n_times, n_features) -> (batch, n_times)
315
+ scores = torch.tanh(x @ self.weight) @ self.context
316
+ if valid_mask is not None:
317
+ scores = scores.masked_fill(~valid_mask, float("-inf"))
318
+ # exp(s - m) / (sum exp(s - m) + eps * exp(-m)) is the reference's
319
+ # exp(s) / (sum exp(s) + eps) without its overflow; eps = 1e-7 is
320
+ # keras.backend.epsilon(). m >= 0 also covers fully padded rows.
321
+ shift = scores.amax(dim=1, keepdim=True).clamp_min(0.0).detach()
322
+ attention = torch.exp(scores - shift)
323
+ attention = attention / (
324
+ attention.sum(dim=1, keepdim=True) + 1e-7 * torch.exp(-shift)
325
+ )
326
+ # (batch, n_times, n_features) -> (batch, n_features)
327
+ return torch.sum(x * attention.unsqueeze(-1), dim=1)
@@ -699,6 +699,13 @@ models_mandatory_parameters: list[
699
699
  ("EEGSym", ["chs_info", "n_chans", "n_outputs", "n_times", "sfreq"], None),
700
700
  ("TSception", ["n_chans", "n_outputs", "n_times", "sfreq"], {"sfreq": 200.0}),
701
701
  ("EEGTCNet", ["n_chans", "n_outputs", "n_times"], None),
702
+ (
703
+ "TCCNet",
704
+ ["n_chans", "n_outputs"],
705
+ # NinaPro DB1: 10 channels at 100 Hz. TCCNet takes whole gestures of
706
+ # any length; 300 samples is only a test length.
707
+ {"n_chans": 10, "n_times": 300, "sfreq": 100.0},
708
+ ),
702
709
  ("SyncNet", ["n_chans", "n_outputs", "n_times"], None),
703
710
  ("MSVTNet", ["n_chans", "n_outputs", "n_times"], None),
704
711
  ("NICE", ["n_chans", "n_outputs", "n_times"], None),
@@ -0,0 +1 @@
1
+ __version__ = "2.1.0.dev180967944"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: braindecode
3
- Version: 2.1.0.dev179580438
3
+ Version: 2.1.0.dev180967944
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>
@@ -138,6 +138,7 @@ braindecode/models/sstdpn.py
138
138
  braindecode/models/steegformer.py
139
139
  braindecode/models/summary.csv
140
140
  braindecode/models/syncnet.py
141
+ braindecode/models/tccnet.py
141
142
  braindecode/models/tcformer.py
142
143
  braindecode/models/tcn.py
143
144
  braindecode/models/tfm_tokenizer.py
@@ -228,6 +228,7 @@ interface for all EEG models and can derive variable names when needed.
228
228
  SSTDPN
229
229
  STEEGFormer
230
230
  SyncNet
231
+ TCCNet
231
232
  TFMTokenizer
232
233
  TFMTokenizerOutput
233
234
  TCFormer
@@ -31,10 +31,16 @@ Enhancements
31
31
  - :class:`braindecode.models.LUNA` takes ``return_features=True``, like the other
32
32
  foundation models: it returns the normed encoder output before the head,
33
33
  ``(batch, n_patches, num_queries * embed_dim)``, as ``"features"`` (:gh:`1565` by `Hamza Abdelhedi`_).
34
+ - :class:`braindecode.models.LUNA` implements ``reset_head``, so
35
+ ``from_pretrained`` can load it with a new ``n_outputs``; a reconstruction
36
+ model (``n_outputs=0``) becomes a classifier (:gh:`1568` by `Hamza Abdelhedi`_).
34
37
  - Add :class:`braindecode.models.BBL`, the MEG encoder of *The Brain's Bitter Lesson* (Jayalath et al., ICML 2025): a dataset-conditional convolutional projector, a :class:`~braindecode.modules.SEANetEncoder` and a subject embedding, with optional ``subject_index``/``dataset_index`` and the paper's mean-subject-embedding fallback. It accepts ``ch_mask``: padded channels become the zero sensor slots of the reference collator, so each recording of a padded batch gives its output alone; as the projector mixes all sensors, ``return_features`` has no per-channel ``tokens``. Opt-in ``temporal_mask`` hides raw time samples before any convolution/context, while ``return_temporal_features=True`` with ``return_features=True`` exposes the actual pre-pool sequence and stride/valid-time/context metadata for downstream SSL objectives (no pretraining task heads). The released CamCAN checkpoint, converted to the port's keys, is on the Hugging Face Hub at ``braindecode/bbl-pretrained`` and gives the authors' features, logits and gradients bit for bit on CPU in float32 (by `Bruno Aristimunha`_)
35
38
  - Add :class:`braindecode.models.MEGGPT` (MEG-GPT, Huang et al., Imaging Neuroscience 2026), a source-space MEG foundation model: the EphysTokenizer encoder turns each parcel into discrete tokens and a causal time-attention GPT with patched keys and values embeds them; the released Cam-CAN checkpoint, converted without the session embedding the paper discards for downstream use, is on the Hugging Face Hub at ``braindecode/meggpt-pretrained``; ``return_features=True`` also returns the per-channel ``"tokens"`` ``(batch, n_chans, n_segments * n_last_steps, embed_dim)`` and takes a ``ch_mask`` of padded channels, whose features and tokens are zero (the flattened head is tied to ``n_chans``, so logits refuse ``ch_mask``); optional ``token_mask`` hides clean token embeddings before the causal decoder, and ``encode_tokens`` supplies cached-ID encoding with shifted next-token targets, retained-tail indices and valid/selected loss masks for a separate vocabulary head (by `Bruno Aristimunha`_).
36
39
  - Add :class:`braindecode.models.MEGXL`, the MEG-XL brain-to-text foundation model (Jayalath and Parker Jones, ICML 2026): a frozen BioCodec tokenizer and a criss-cross transformer pretrained on 150 s MEG windows; the released ``meg-xl-med-v2.ckpt``, converted to the port's keys, is on the Hugging Face Hub at ``braindecode/megxl-pretrained`` and matches the authors' code on CPU. Its ``forward`` refuses ``ch_mask`` with a ``ValueError`` (the head flattens ``n_chans * latent_dim`` features and the sensor geometry is the ``chs_info`` montage), and ``return_features`` gives the pooled ``"features"`` only, no ``"tokens"``. The opt-in ``encode``/``encode_codes`` mask replaces projected code content before sensor metadata and attention, returning real temporal hidden states for caller-owned masked-RVQ-code prediction; it adds no default parameters and expects equal valid-length full-montage windows (by `Bruno Aristimunha`_).
37
40
  - Add :class:`braindecode.modules.SEANetEncoder` and :class:`~braindecode.modules.SEANetDecoder` (EnCodec's SEANet, with :class:`~braindecode.modules.SEANetConv1d`, :class:`~braindecode.modules.SEANetConvTranspose1d`, :class:`~braindecode.modules.SEANetLSTM` and :class:`~braindecode.modules.SEANetResBlock`), moved from :class:`braindecode.models.BrainOmni`, whose parameters and outputs are unchanged. They take ``in_channels``/``out_channels``, ``n_residual_layers``, ``dilation_base``, ``compress``, ``true_skip`` and ``causal`` (by `Bruno Aristimunha`_)
41
+ - Add :class:`braindecode.models.TCCNet`, a causal temporal-convolution model
42
+ for sEMG gesture recognition with average-over-time and context-attention
43
+ classification heads (:gh:`1562` by `Arslan Shafique`_).
38
44
  - A model loaded with :meth:`~braindecode.models.EEGModuleMixin.from_pretrained` shows where its weights come from: in a notebook (``model`` as the last line of a cell) a panel lists the input geometry, the Hub repository and commit, the licence, the base model and the datasets of the model card (linked to NEMAR, OpenNeuro or the Hub), and a module table with each block marked as loaded from the checkpoint or initialised here, e.g. a head rebuilt for a new ``n_outputs``; ``print(model)`` adds the same facts below the torchinfo table. Both ask users, and AI agents reading the output, to cite Braindecode with its `Zenodo DOI <https://doi.org/10.5281/zenodo.17699192>`__. The card offers BibTeX/APA downloads and selectable citation text, and links training datasets to NEMAR, EEGDash catalogue searches and documented braindecode readers. ``from_pretrained`` now warns when no parameter of the model was loaded from the checkpoint, which happened silently when the checkpoint's keys did not match the model (:gh:`1558` by `Bruno Aristimunha`_).
39
45
  - Add :class:`braindecode.models.CORTEG`, an ST-EEGFormer adapted to
40
46
  intracranial ECoG: a spatial adapter places each electrode by its 3D position
@@ -91,6 +97,12 @@ Requirements
91
97
  Bug fixes
92
98
  ==========
93
99
 
100
+ - :class:`braindecode.models.LUNA` gives the phase of the DC bin, and of the
101
+ Nyquist bin of an even ``patch_size``, as ``0`` or ``pi`` on every device.
102
+ CUDA and MPS FFTs leave rounding noise of either sign in the imaginary part of
103
+ these real bins, so a negative bin got ``pi`` or ``-pi`` at random; on MPS
104
+ this moved the outputs of the released weights on random-walk input by 7 %
105
+ from the CPU ones. CPU outputs are unchanged (:gh:`1566` by `Hamza Abdelhedi`_).
94
106
  - The Eldele et al. (2021) sleep staging tutorial (``plot_sleep_staging_eldele2021.py``) splits train and validation by subject, as its text says; ``split`` took the ids as recording indices, so it trained on subjects 0-1 and validated on subject 2 while subjects 3-5 were loaded and unused (:gh:`1559` by `Bruno Aristimunha`_).
95
107
  - :class:`braindecode.models.ZUNA` defaults to ``pos_bins=100``, the value ZUNA1.1 was trained with (paper Table II and Zyphra's configs); the old default ``50`` was ZUNA1's and gave the released encoder outputs up to 5.2 away from the original. The ``braindecode/ZUNA`` checkpoint now holds the ZUNA1.1 encoder in braindecode's parameter names (the earlier ZUNA1 file loaded no parameter into the class) and sets ``pos_bins`` in its config (:gh:`1557` by `Bruno Aristimunha`_).
96
108
  - ``from_pretrained`` of :class:`braindecode.models.Brant` loads a checkpoint at
@@ -2892,6 +2904,7 @@ Authors
2892
2904
  ========
2893
2905
 
2894
2906
  .. _Arnaud Delorme: https://github.com/arnodelorme
2907
+ .. _Arslan Shafique: https://github.com/arslan-shafique
2895
2908
  .. _Anton Soloviev: https://github.com/antonsoo
2896
2909
  .. _Hubert Banville: https://github.com/hubertjb
2897
2910
  .. _Robin Tibor Schirrmeister: https://github.com/robintibor
@@ -1 +0,0 @@
1
- __version__ = "2.1.0.dev179580438"