Braindecode 1.8.1.dev170227516__tar.gz → 1.8.1.dev170248173__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 (192) hide show
  1. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/NOTICE.txt +0 -12
  2. {braindecode-1.8.1.dev170227516/braindecode.egg-info → braindecode-1.8.1.dev170248173}/PKG-INFO +3 -3
  3. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/base.py +0 -4
  4. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datautil/serialization.py +1 -4
  5. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/functional/__init__.py +0 -2
  6. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/functional/functions.py +1 -43
  7. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/__init__.py +0 -12
  8. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/base.py +2 -25
  9. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/bendr.py +0 -2
  10. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/biot.py +0 -1
  11. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/cbramod.py +0 -3
  12. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegdino.py +0 -2
  13. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegpt.py +0 -1
  14. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/labram.py +0 -1
  15. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/luna.py +1 -3
  16. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/meta_neuromotor.py +0 -1
  17. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/mvpformer.py +6 -13
  18. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/reve.py +82 -18
  19. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/signal_jepa.py +11 -30
  20. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/steegformer.py +19 -66
  21. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/summary.csv +0 -6
  22. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/util.py +28 -289
  23. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/zuna.py +39 -26
  24. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/attention.py +1 -7
  25. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/blocks.py +6 -57
  26. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/filter.py +7 -33
  27. braindecode-1.8.1.dev170248173/braindecode/modules/parametrization.py +38 -0
  28. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/preprocessing/windowers.py +7 -31
  29. braindecode-1.8.1.dev170248173/braindecode/version.py +1 -0
  30. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173/braindecode.egg-info}/PKG-INFO +3 -3
  31. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode.egg-info/SOURCES.txt +0 -7
  32. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode.egg-info/requires.txt +2 -2
  33. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/api.rst +0 -12
  34. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/install/install.rst +1 -4
  35. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/whats_new.rst +1 -162
  36. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/pyproject.toml +3 -2
  37. braindecode-1.8.1.dev170227516/braindecode/functional/_real_dft.py +0 -138
  38. braindecode-1.8.1.dev170227516/braindecode/models/barista.py +0 -699
  39. braindecode-1.8.1.dev170227516/braindecode/models/brainbert.py +0 -448
  40. braindecode-1.8.1.dev170227516/braindecode/models/brant.py +0 -477
  41. braindecode-1.8.1.dev170227516/braindecode/models/diver1.py +0 -945
  42. braindecode-1.8.1.dev170227516/braindecode/models/mirepnet.py +0 -368
  43. braindecode-1.8.1.dev170227516/braindecode/models/mscformer.py +0 -502
  44. braindecode-1.8.1.dev170227516/braindecode/modules/parametrization.py +0 -62
  45. braindecode-1.8.1.dev170227516/braindecode/version.py +0 -1
  46. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/LICENSE.txt +0 -0
  47. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/MANIFEST.in +0 -0
  48. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/README.rst +0 -0
  49. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/__init__.py +0 -0
  50. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/augmentation/__init__.py +0 -0
  51. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/augmentation/base.py +0 -0
  52. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/augmentation/functional.py +0 -0
  53. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/augmentation/transforms.py +0 -0
  54. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/classifier.py +0 -0
  55. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/__init__.py +0 -0
  56. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/_notebook_viewer.py +0 -0
  57. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bbci.py +0 -0
  58. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bcicomp.py +0 -0
  59. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bids/__init__.py +0 -0
  60. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bids/datasets.py +0 -0
  61. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bids/format.py +0 -0
  62. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bids/hub.py +0 -0
  63. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bids/hub_format.py +0 -0
  64. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bids/hub_io.py +0 -0
  65. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bids/hub_validation.py +0 -0
  66. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/bids/iterable.py +0 -0
  67. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/chb_mit.py +0 -0
  68. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/collate.py +0 -0
  69. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/mne.py +0 -0
  70. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/moabb.py +0 -0
  71. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/nmt.py +0 -0
  72. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/registry.py +0 -0
  73. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/siena.py +0 -0
  74. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
  75. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/sleep_physionet.py +0 -0
  76. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/tuh.py +0 -0
  77. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/utils.py +0 -0
  78. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datasets/xy.py +0 -0
  79. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datautil/__init__.py +0 -0
  80. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datautil/channel_utils.py +0 -0
  81. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datautil/hub_formats.py +0 -0
  82. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/datautil/util.py +0 -0
  83. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/eegneuralnet.py +0 -0
  84. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/functional/initialization.py +0 -0
  85. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/atcnet.py +0 -0
  86. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/attentionbasenet.py +0 -0
  87. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/attn_sleep.py +0 -0
  88. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/brainmodule.py +0 -0
  89. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/codebrain.py +0 -0
  90. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/config.py +0 -0
  91. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/contrawr.py +0 -0
  92. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/ctnet.py +0 -0
  93. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/dance.py +0 -0
  94. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/deep4.py +0 -0
  95. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/deepsleepnet.py +0 -0
  96. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/dgcnn.py +0 -0
  97. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegconformer.py +0 -0
  98. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eeginception_erp.py +0 -0
  99. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eeginception_mi.py +0 -0
  100. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegitnet.py +0 -0
  101. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegminer.py +0 -0
  102. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegnet.py +0 -0
  103. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegnex.py +0 -0
  104. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegsimpleconv.py +0 -0
  105. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegsym.py +0 -0
  106. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/eegtcnet.py +0 -0
  107. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/emg2qwerty.py +0 -0
  108. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/fbcnet.py +0 -0
  109. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/fblightconvnet.py +0 -0
  110. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/fbmsnet.py +0 -0
  111. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/hybrid.py +0 -0
  112. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/ifnet.py +0 -0
  113. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/interpolated.py +0 -0
  114. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/medformer.py +0 -0
  115. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/msvtnet.py +0 -0
  116. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/neuropose.py +0 -0
  117. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/patchedtransformer.py +0 -0
  118. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/sccnet.py +0 -0
  119. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/sensingdynamics.py +0 -0
  120. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/shallow_fbcsp.py +0 -0
  121. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/sinc_shallow.py +0 -0
  122. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
  123. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
  124. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/sparcnet.py +0 -0
  125. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/sstdpn.py +0 -0
  126. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/syncnet.py +0 -0
  127. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/tcformer.py +0 -0
  128. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/tcn.py +0 -0
  129. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/tidnet.py +0 -0
  130. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/tsinception.py +0 -0
  131. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/usleep.py +0 -0
  132. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/models/vemg2pose.py +0 -0
  133. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/__init__.py +0 -0
  134. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/activation.py +0 -0
  135. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/convolution.py +0 -0
  136. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/dance_modules.py +0 -0
  137. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/interpolation.py +0 -0
  138. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/layers.py +0 -0
  139. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/linear.py +0 -0
  140. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/stats.py +0 -0
  141. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/util.py +0 -0
  142. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/modules/wrapper.py +0 -0
  143. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/preprocessing/__init__.py +0 -0
  144. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
  145. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/preprocessing/mne_preprocess.py +0 -0
  146. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/preprocessing/preprocess.py +0 -0
  147. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/preprocessing/util.py +0 -0
  148. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/regressor.py +0 -0
  149. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/samplers/__init__.py +0 -0
  150. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/samplers/base.py +0 -0
  151. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/samplers/ssl.py +0 -0
  152. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/training/__init__.py +0 -0
  153. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/training/callbacks.py +0 -0
  154. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/training/losses.py +0 -0
  155. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/training/scoring.py +0 -0
  156. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/util.py +0 -0
  157. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/visualization/__init__.py +0 -0
  158. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/visualization/activations.py +0 -0
  159. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/visualization/attribution.py +0 -0
  160. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/visualization/confusion_matrices.py +0 -0
  161. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/visualization/frequency.py +0 -0
  162. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/visualization/metrics.py +0 -0
  163. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/visualization/sanity.py +0 -0
  164. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode/visualization/topology.py +0 -0
  165. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode.egg-info/dependency_links.txt +0 -0
  166. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/braindecode.egg-info/top_level.txt +0 -0
  167. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/Makefile +0 -0
  168. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/_templates/autosummary/class.rst +0 -0
  169. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
  170. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/_templates/autosummary/function.rst +0 -0
  171. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
  172. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/cite.rst +0 -0
  173. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/conf.py +0 -0
  174. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/help.rst +0 -0
  175. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/index.rst +0 -0
  176. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/install/install_pip.rst +0 -0
  177. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/install/install_source.rst +0 -0
  178. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/attention.rst +0 -0
  179. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/channel.rst +0 -0
  180. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/convolution.rst +0 -0
  181. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/filterbank.rst +0 -0
  182. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/gnn.rst +0 -0
  183. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/interpretable.rst +0 -0
  184. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/lbm.rst +0 -0
  185. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/recurrent.rst +0 -0
  186. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/categorization/spd.rst +0 -0
  187. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/models.rst +0 -0
  188. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/models_categorization.rst +0 -0
  189. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/models_table.rst +0 -0
  190. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/models/models_visualization.rst +0 -0
  191. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/docs/sg_execution_times.rst +0 -0
  192. {braindecode-1.8.1.dev170227516 → braindecode-1.8.1.dev170248173}/setup.cfg +0 -0
@@ -42,7 +42,6 @@ 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`
46
45
 
47
46
  ### Apache-2.0 Licensed Files
48
47
 
@@ -51,16 +50,6 @@ The following components are licensed under the Apache License 2.0:
51
50
  - `braindecode/models/mvpformer.py`
52
51
  - `braindecode/models/zuna.py`
53
52
  - `braindecode/models/luna.py`
54
- - `braindecode/models/brant.py`
55
- - `braindecode/models/diver1.py`
56
- - `braindecode/models/mscformer.py`
57
-
58
- ### USC Academic License Files
59
-
60
- [License](https://github.com/ShanechiLab/BaRISTA/blob/master/LICENSE.md)
61
-
62
- - `braindecode/models/barista.py`
63
- - `docs/_static/model/barista.jpeg`
64
53
 
65
54
  ## License Links
66
55
 
@@ -69,7 +58,6 @@ The following components are licensed under the Apache License 2.0:
69
58
  - [CC BY-NC-SA 4.0 License](https://creativecommons.org/licenses/by-nc-sa/4.0/)
70
59
  - [MIT License](https://opensource.org/licenses/MIT)
71
60
  - [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0)
72
- - [USC Academic License](https://github.com/ShanechiLab/BaRISTA/blob/master/LICENSE.md)
73
61
 
74
62
  ## Note
75
63
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: braindecode
3
- Version: 1.8.1.dev170227516
3
+ Version: 1.8.1.dev170248173
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.4
26
- Requires-Dist: torchaudio>=2.4
25
+ Requires-Dist: torch>=2.0
26
+ Requires-Dist: torchaudio>=2.0
27
27
  Requires-Dist: mne>=1.11.0
28
28
  Requires-Dist: mne_bids>=0.18
29
29
  Requires-Dist: h5py
@@ -5,7 +5,6 @@
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>
9
8
  #
10
9
  # License: BSD (3-clause)
11
10
 
@@ -1399,9 +1398,6 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
1399
1398
  df = ds._windows.metadata
1400
1399
  else:
1401
1400
  df = ds.metadata
1402
- if isinstance(df, pd.DataFrame):
1403
- # copy so the description columns stay out of the dataset
1404
- df = df.copy()
1405
1401
  for k, v in ds.description.items():
1406
1402
  df[k] = v
1407
1403
  all_dfs.append(df)
@@ -1,7 +1,6 @@
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>
5
4
  #
6
5
  # License: BSD (3-clause)
7
6
 
@@ -271,9 +270,7 @@ def _load_parallel(path, i, preload, is_raw, has_stored_windows):
271
270
  else:
272
271
  window_kwargs = _load_kwargs_json("window_kwargs", sub_dir)
273
272
  windows_ds_kwargs = [
274
- kwargs[1]
275
- for kwargs in window_kwargs
276
- if kwargs[0] in ("WindowsDataset", "EEGWindowsDataset")
273
+ kwargs[1] for kwargs in window_kwargs if kwargs[0] == "WindowsDataset"
277
274
  ]
278
275
  windows_ds_kwargs = windows_ds_kwargs[0] if len(windows_ds_kwargs) == 1 else {}
279
276
  if is_raw:
@@ -8,7 +8,6 @@ from .functions import (
8
8
  iou_1d,
9
9
  pairwise_iou_1d,
10
10
  plv_time,
11
- rotate_pairs,
12
11
  safe_log,
13
12
  sinusoidal_positional_encoding,
14
13
  square,
@@ -26,7 +25,6 @@ __all__ = [
26
25
  "iou_1d",
27
26
  "pairwise_iou_1d",
28
27
  "plv_time",
29
- "rotate_pairs",
30
28
  "safe_log",
31
29
  "sinusoidal_positional_encoding",
32
30
  "square",
@@ -12,8 +12,6 @@ import numpy as np
12
12
  import torch
13
13
  import torch.nn.functional as F
14
14
 
15
- from . import _real_dft
16
-
17
15
 
18
16
  def square(x):
19
17
  return x * x
@@ -167,40 +165,18 @@ def hilbert_freq(x: torch.Tensor, forward_fourier: bool = True) -> torch.Tensor:
167
165
  https://github.com/scipy/scipy/blob/v1.14.1/scipy/signal/_signaltools.py#L2287-L2394
168
166
 
169
167
  """
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
-
182
168
  if forward_fourier:
183
- seq_len = x.shape[-1]
184
169
  x = torch.fft.rfft(x, norm=None, dim=-1)
185
170
  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)
190
171
  x = x * 2.0
191
172
  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
195
173
  x = F.pad(
196
- x, [0, 0, 0, seq_len - x.shape[-2]]
174
+ x, [0, 0, 0, x.shape[-2] - 2]
197
175
  ) # Fill Fourier coefficients to retain shape
198
176
  x = torch.view_as_complex(x)
199
177
  x = torch.fft.ifft(x, norm=None, dim=-1) # returns complex signal
200
178
  x = torch.view_as_real(x)
201
179
 
202
- if input_dtype == torch.bfloat16:
203
- x = x.to(input_dtype)
204
180
  return x
205
181
 
206
182
 
@@ -470,21 +446,3 @@ def sinusoidal_positional_encoding(n_positions: int, dim: int) -> torch.Tensor:
470
446
  # ``.contiguous()`` so an odd-``dim`` truncation owns tight storage -- a
471
447
  # non-contiguous view over the padded width breaks safetensors buffer saving.
472
448
  return pe[:, :dim].contiguous()
473
-
474
-
475
- def rotate_pairs(x: torch.Tensor) -> torch.Tensor:
476
- """Rotate adjacent feature pairs from ``(a, b)`` to ``(-b, a)``.
477
-
478
- Parameters
479
- ----------
480
- x : torch.Tensor
481
- Tensor of shape ``(..., features)`` with an even final dimension.
482
-
483
- Returns
484
- -------
485
- torch.Tensor
486
- Same shape, device and dtype as ``x``. Frequencies, positional indexing
487
- and mixed-precision policy are left to the caller.
488
- """
489
- pairs = x.unflatten(-1, (-1, 2))
490
- return torch.stack((-pairs[..., 1], pairs[..., 0]), dim=-1).flatten(-2)
@@ -3,13 +3,10 @@
3
3
  from .atcnet import ATCNet
4
4
  from .attentionbasenet import AttentionBaseNet
5
5
  from .attn_sleep import AttnSleep
6
- from .barista import BaRISTA
7
6
  from .base import EEGModuleMixin
8
7
  from .bendr import BENDR, InterpolatedBENDR
9
8
  from .biot import BIOT, InterpolatedBIOT
10
- from .brainbert import BrainBERT
11
9
  from .brainmodule import BrainModule
12
- from .brant import Brant
13
10
  from .cbramod import CBraMod
14
11
  from .codebrain import CodeBrain
15
12
  from .contrawr import ContraWR
@@ -18,7 +15,6 @@ from .dance import DANCE
18
15
  from .deep4 import Deep4Net
19
16
  from .deepsleepnet import DeepSleepNet
20
17
  from .dgcnn import DGCNN
21
- from .diver1 import DIVER1
22
18
  from .eegconformer import EEGConformer
23
19
  from .eegdino import EEGDINO
24
20
  from .eeginception_erp import EEGInceptionERP
@@ -42,8 +38,6 @@ from .labram import InterpolatedLaBraM, Labram
42
38
  from .luna import LUNA
43
39
  from .medformer import MEDFormer
44
40
  from .meta_neuromotor import MetaNeuromotorHand
45
- from .mirepnet import MIRepNet
46
- from .mscformer import MSCFormer
47
41
  from .msvtnet import MSVTNet
48
42
  from .mvpformer import MVPFormer
49
43
  from .neuropose import NeuroPose
@@ -90,11 +84,9 @@ __all__ = [
90
84
  "ATCNet",
91
85
  "AttnSleep",
92
86
  "AttentionBaseNet",
93
- "BaRISTA",
94
87
  "EEGModuleMixin",
95
88
  "BIOT",
96
89
  "BENDR",
97
- "BrainBERT",
98
90
  "CBraMod",
99
91
  "CodeBrain",
100
92
  "ContraWR",
@@ -102,9 +94,7 @@ __all__ = [
102
94
  "DANCE",
103
95
  "Deep4Net",
104
96
  "DeepSleepNet",
105
- "DIVER1",
106
97
  "BrainModule",
107
- "Brant",
108
98
  "EEGConformer",
109
99
  "EEGDINO",
110
100
  "EEGPT",
@@ -139,8 +129,6 @@ __all__ = [
139
129
  "extract_channel_locations_from_chs_info",
140
130
  "positions_from_chs_info",
141
131
  "MEDFormer",
142
- "MIRepNet",
143
- "MSCFormer",
144
132
  "MSVTNet",
145
133
  "MVPFormer",
146
134
  "PBT",
@@ -537,31 +537,12 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
537
537
  if n_outputs <= 0:
538
538
  raise ValueError(f"n_outputs must be positive; got {n_outputs}.")
539
539
  self._n_outputs = n_outputs
540
- self._update_init_kwargs(n_outputs=n_outputs)
541
-
542
- def _update_init_kwargs(self, **init_kwargs) -> None:
543
- """Record constructor arguments that change after construction.
544
-
545
- Helper for :meth:`reset_head` implementations that also change a
546
- constructor argument, for example turning a feature extractor into a
547
- classifier. Keeps the braindecode init kwargs and the Hugging Face hub
548
- config in sync, so :meth:`get_config` and ``save_pretrained`` rebuild
549
- the architecture the model actually has.
550
-
551
- Parameters
552
- ----------
553
- **init_kwargs
554
- Constructor argument names mapped to their new values.
555
- """
556
540
  for config in (
557
541
  getattr(self, "_braindecode_init_kwargs", None),
558
542
  getattr(self, "_hub_mixin_config", None),
559
543
  ):
560
- if config is None:
561
- continue
562
- for name, value in init_kwargs.items():
563
- if name in config:
564
- config[name] = value
544
+ if config is not None and "n_outputs" in config:
545
+ config["n_outputs"] = n_outputs
565
546
 
566
547
  def reset_head(self, n_outputs):
567
548
  """Replace the classification head for a new number of outputs.
@@ -569,10 +550,6 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
569
550
  This is called automatically by :meth:`from_pretrained` when the
570
551
  user passes an ``n_outputs`` that differs from the saved config.
571
552
  Override in subclasses that need a model-specific head structure.
572
- Implementations keep changed constructor arguments in sync with
573
- ``self._update_init_kwargs``, so that a saved model can be loaded
574
- back. Implementations requiring positive outputs can also use
575
- ``self._set_n_outputs`` to validate and record the new value.
576
553
 
577
554
  Parameters
578
555
  ----------
@@ -355,9 +355,7 @@ class BENDR(EEGModuleMixin, nn.Module):
355
355
 
356
356
  def reset_head(self, n_outputs):
357
357
  self._n_outputs = n_outputs
358
- self._update_init_kwargs(n_outputs=n_outputs)
359
358
  self.include_final_layer = True
360
- self._update_init_kwargs(final_layer=True)
361
359
  self._build_head(n_outputs)
362
360
 
363
361
  def forward(self, x, return_features=False):
@@ -237,7 +237,6 @@ class BIOT(EEGModuleMixin, nn.Module):
237
237
 
238
238
  def reset_head(self, n_outputs):
239
239
  self._n_outputs = n_outputs
240
- self._update_init_kwargs(n_outputs=n_outputs)
241
240
  self.final_layer = _ClassificationHead(
242
241
  emb_size=self.embed_dim,
243
242
  n_outputs=n_outputs,
@@ -224,9 +224,6 @@ class CBraMod(EEGModuleMixin, nn.Module):
224
224
 
225
225
  def reset_head(self, n_outputs):
226
226
  self._n_outputs = n_outputs
227
- self._update_init_kwargs(n_outputs=n_outputs)
228
- # A head implies a classifier, also when built with return_encoder_output.
229
- self._update_init_kwargs(return_encoder_output=False)
230
227
  if self._n_times is not None and self._n_chans is not None:
231
228
  n_patch = self._n_times // self._patch_size
232
229
  flat_dim = self._n_chans * n_patch * self._emb_dim
@@ -260,9 +260,7 @@ class EEGDINO(EEGModuleMixin, nn.Module):
260
260
  mirroring :meth:`braindecode.models.CBraMod.reset_head`.
261
261
  """
262
262
  self._n_outputs = n_outputs
263
- self._update_init_kwargs(n_outputs=n_outputs)
264
263
  self.return_encoder_output = False
265
- self._update_init_kwargs(return_encoder_output=False)
266
264
  self.final_layer = self._make_head()
267
265
 
268
266
  def forward(self, x, return_features: bool | None = None):
@@ -371,7 +371,6 @@ class EEGPT(EEGModuleMixin, nn.Module):
371
371
 
372
372
  def reset_head(self, n_outputs):
373
373
  self._n_outputs = n_outputs
374
- self._update_init_kwargs(n_outputs=n_outputs)
375
374
  self.final_layer = _LinearConstraintProbe(
376
375
  **self.get_probe_params(),
377
376
  n_outputs=n_outputs,
@@ -823,7 +823,6 @@ class Labram(EEGModuleMixin, nn.Module):
823
823
 
824
824
  def reset_head(self, n_outputs):
825
825
  self._n_outputs = n_outputs
826
- self._update_init_kwargs(n_outputs=n_outputs)
827
826
  self.reset_classifier(n_outputs)
828
827
 
829
828
  def _adj_temporal_embedding(self, num_ch, batch_size, dim_embed=None):
@@ -22,7 +22,6 @@ import torch.nn as nn
22
22
  import torch.nn.functional as F
23
23
  from einops import rearrange
24
24
 
25
- from braindecode.functional import rotate_pairs
26
25
  from braindecode.models.base import EEGModuleMixin
27
26
  from braindecode.models.util import extract_channel_locations_from_chs_info
28
27
  from braindecode.modules.layers import DropPath
@@ -552,9 +551,8 @@ class _RotarySelfAttentionBlock(nn.Module):
552
551
  positions = torch.arange(seq_len, device=tensor.device, dtype=tensor.dtype)
553
552
  freqs = self.rotary_emb(positions)
554
553
 
555
- # Keep the full-head reshape (including its empty-input boundary).
556
554
  pairs = tensor.reshape(*tensor.shape[:-1], -1, 2)
557
- rotated = rotate_pairs(pairs.flatten(-2))
555
+ rotated = torch.stack((-pairs[..., 1], pairs[..., 0]), dim=-1).flatten(-2)
558
556
  transformed = tensor * freqs.cos() + rotated * freqs.sin()
559
557
  return transformed.to(tensor.dtype)
560
558
 
@@ -486,7 +486,6 @@ class MetaNeuromotorHand(EEGModuleMixin, nn.Module, license="cc-by-nc-4.0"):
486
486
  """Replace the classification head for a new number of outputs."""
487
487
  self.final_layer = nn.Linear(self.final_layer.in_features, n_outputs)
488
488
  self._n_outputs = n_outputs
489
- self._update_init_kwargs(n_outputs=n_outputs)
490
489
 
491
490
  def compute_output_lengths(self, input_lengths: torch.Tensor) -> torch.Tensor:
492
491
  """Compute the valid emission length for each input sequence.
@@ -305,7 +305,6 @@ class MVPFormer(EEGModuleMixin, nn.Module, license="apache-2.0"):
305
305
 
306
306
  def reset_head(self, n_outputs):
307
307
  self._n_outputs = n_outputs
308
- self._update_init_kwargs(n_outputs=n_outputs)
309
308
  head_in = (
310
309
  self.d_model if self.pooling == "mean" else self.n_chans * self.d_model
311
310
  )
@@ -467,11 +466,9 @@ class _MVPAttention(nn.Module):
467
466
  # -- shape helpers (segment = "time"/position axis, channel axis) ----------
468
467
  @staticmethod
469
468
  def _repeat_kv(x, n_rep):
470
- # grouped-query attention: replicate each kv head into ``n_rep`` query heads.
471
- # Repeat a contiguous copy: on Intel Gaudi (HPU) the einops repeat of the
472
- # permuted singleton-axis relative keys returns scrambled values.
469
+ # grouped-query attention: replicate each kv head into ``n_rep`` query heads
473
470
  return repeat(
474
- x.contiguous(),
471
+ x,
475
472
  "batch kv_head segment channel head_dim "
476
473
  "-> batch (kv_head group) segment channel head_dim",
477
474
  group=n_rep,
@@ -508,11 +505,8 @@ class _MVPAttention(nn.Module):
508
505
 
509
506
  @staticmethod
510
507
  def _rel_shift_chan(x):
511
- # Relative shift along the channel axis (symmetric distance), as a single
512
- # ``torch.gather`` whose backward is a ``scatter_add``. Advanced indexing
513
- # would backpropagate through ``index_put_(accumulate=True)``, which Intel
514
- # Gaudi (HPU) runs on the host, slowly and with wrong gradients. Index
515
- # tensors are built on x.device with long dtype.
508
+ # Relative shift along the channel axis (symmetric distance). Index
509
+ # tensors are built on x.device with long dtype for GPU-safe indexing.
516
510
  device = x.device
517
511
  chan_size = x.shape[-1]
518
512
  if chan_size > 1:
@@ -533,9 +527,8 @@ class _MVPAttention(nn.Module):
533
527
  shifting_idxes = (chan_size - 1 - shifting_idxes).repeat(
534
528
  x.shape[-2] // chan_size, 1
535
529
  )
536
- return torch.gather(
537
- x, -1, shifting_idxes.expand(*x.shape[:-2], *shifting_idxes.shape)
538
- )
530
+ rows = torch.arange(x.size(-2), device=device).unsqueeze(1)
531
+ return x[..., rows, shifting_idxes]
539
532
 
540
533
  def _split_heads(self, tensor, num_heads):
541
534
  return rearrange(
@@ -16,7 +16,16 @@ import torch.nn.functional as F
16
16
  from einops import rearrange
17
17
  from mne.datasets.utils import _get_path
18
18
  from torch import nn
19
- from torch.nn import RMSNorm
19
+
20
+ # Safe import for older PyTorch versions (Support for Intel-based Macs)
21
+ try:
22
+ from torch.nn.attention import SDPBackend, sdpa_kernel
23
+
24
+ HAS_SDPA = True
25
+ except ImportError:
26
+ HAS_SDPA = False
27
+ SDPBackend = None
28
+ sdpa_kernel = None
20
29
 
21
30
  from braindecode.models.base import EEGModuleMixin
22
31
 
@@ -347,7 +356,6 @@ class REVE(EEGModuleMixin, nn.Module):
347
356
 
348
357
  def reset_head(self, n_outputs):
349
358
  self._n_outputs = n_outputs
350
- self._update_init_kwargs(n_outputs=n_outputs)
351
359
  self._build_head(n_outputs)
352
360
 
353
361
  def get_positions(self, channel_names: list[str]) -> torch.Tensor:
@@ -513,11 +521,25 @@ class GEGLU(nn.Module):
513
521
  return F.gelu(gates) * x
514
522
 
515
523
 
524
+ class RMSNorm(torch.nn.Module):
525
+ def __init__(self, dim: int, eps: float = 1e-6):
526
+ super().__init__()
527
+ self.eps = eps
528
+ self.weight = nn.Parameter(torch.ones(dim))
529
+
530
+ def _norm(self, x: torch.Tensor) -> torch.Tensor:
531
+ return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
532
+
533
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
534
+ output = self._norm(x.float()).type_as(x)
535
+ return output * self.weight
536
+
537
+
516
538
  class FeedForward(nn.Module):
517
539
  def __init__(self, dim: int, hidden_dim: int, geglu: bool):
518
540
  super().__init__()
519
541
  self.net = nn.Sequential(
520
- RMSNorm(dim, eps=1e-6),
542
+ RMSNorm(dim),
521
543
  nn.Linear(dim, hidden_dim * 2 if geglu else hidden_dim, bias=False),
522
544
  GEGLU() if geglu else nn.GELU(),
523
545
  nn.Linear(hidden_dim, dim, bias=False),
@@ -532,6 +554,59 @@ class FeedForward(nn.Module):
532
554
  #################################################################################
533
555
 
534
556
 
557
+ class ClassicalAttention(nn.Module):
558
+ def __init__(self, heads: int, use_sdpa: bool | None = None):
559
+ super().__init__()
560
+ self.heads = heads
561
+
562
+ if use_sdpa is None:
563
+ self.use_sdpa = HAS_SDPA
564
+ elif use_sdpa is True and not HAS_SDPA:
565
+ logger.warning(
566
+ "SDPA (Scaled Dot Product Attention) was requested, but it is not "
567
+ "available in your current PyTorch version. Falling back to naive "
568
+ "implementation. Please upgrade to PyTorch >= 2.2 for SDPA support."
569
+ )
570
+ self.use_sdpa = False
571
+ else:
572
+ self.use_sdpa = use_sdpa
573
+
574
+ def forward(self, qkv: torch.Tensor) -> torch.Tensor:
575
+ # Split concatenated QKV into separate tensors
576
+ # qkv shape: (batch, seq_len, 3 * heads * head_dim)
577
+ q, k, v = qkv.chunk(3, dim=-1)
578
+
579
+ # Reshape for multi-head attention: split last dim into (heads, head_dim)
580
+ # (batch, seq_len, heads * head_dim) -> (batch, heads, seq_len, head_dim)
581
+ q, k, v = (
582
+ rearrange(
583
+ t,
584
+ "batch seq (heads dim) -> batch heads seq dim",
585
+ heads=self.heads,
586
+ )
587
+ for t in (q, k, v)
588
+ )
589
+
590
+ if self.use_sdpa: # SDPA Implementation
591
+ with sdpa_kernel(
592
+ [
593
+ SDPBackend.FLASH_ATTENTION,
594
+ SDPBackend.EFFICIENT_ATTENTION,
595
+ SDPBackend.MATH,
596
+ ]
597
+ ):
598
+ out = F.scaled_dot_product_attention(q, k, v)
599
+ else: # Naive Implementation
600
+ _, _, scale = q.shape[-2], q.device, q.shape[-1] ** -0.5
601
+ dots = torch.matmul(q, k.transpose(-1, -2)) * scale
602
+ attn = nn.Softmax(dim=-1)(dots)
603
+ out = torch.matmul(attn, v)
604
+
605
+ # Merge heads back: (batch, heads, seq_len, head_dim) -> (batch, seq_len, heads * head_dim)
606
+ out = rearrange(out, "batch heads seq dim -> batch seq (heads dim)")
607
+ return out
608
+
609
+
535
610
  class Attention(nn.Module):
536
611
  """
537
612
  Multi-head self-attention layer with RMSNorm.
@@ -541,21 +616,16 @@ class Attention(nn.Module):
541
616
  super().__init__()
542
617
  inner_dim = head_dim * heads
543
618
  self.heads = heads
544
- self.norm = RMSNorm(dim, eps=1e-6)
619
+ self.norm = RMSNorm(dim)
545
620
  self.to_qkv = nn.Linear(dim, inner_dim * 3, bias=False)
546
621
  self.to_out = nn.Linear(inner_dim, dim, bias=False)
547
622
 
623
+ self.attend = ClassicalAttention(self.heads, use_sdpa=True)
624
+
548
625
  def forward(self, x):
549
626
  x = self.norm(x)
550
627
  qkv = self.to_qkv(x)
551
- q, k, v = (
552
- rearrange(
553
- t, "batch seq (heads dim) -> batch heads seq dim", heads=self.heads
554
- )
555
- for t in qkv.chunk(3, dim=-1)
556
- )
557
- out = F.scaled_dot_product_attention(q, k, v)
558
- out = rearrange(out, "batch heads seq dim -> batch seq (heads dim)")
628
+ out = self.attend(qkv)
559
629
  return self.to_out(out)
560
630
 
561
631
 
@@ -633,12 +703,6 @@ class FourierEmb4D(nn.Module):
633
703
  self.margin = margin
634
704
 
635
705
  def forward(self, positions_: torch.Tensor) -> torch.Tensor:
636
- # In float32 with autocast off: Intel Gaudi (HPU) autocast also downcasts
637
- # the position * frequency products to bf16 before sin/cos (~3 % off).
638
- with torch.autocast(device_type=positions_.device.type, enabled=False):
639
- return self._embed(positions_.float()).to(positions_.dtype)
640
-
641
- def _embed(self, positions_: torch.Tensor) -> torch.Tensor:
642
706
  positions = positions_.clone()
643
707
  positions[:, :, -1] *= self.increment_time
644
708
  input_shape = positions.shape
@@ -643,7 +643,6 @@ class SignalJEPA_Contextual(_BaseSignalJEPA):
643
643
 
644
644
  def reset_head(self, n_outputs):
645
645
  self._n_outputs = n_outputs
646
- self._update_init_kwargs(n_outputs=n_outputs)
647
646
  self.final_layer = _get_separable_clf_layer(
648
647
  conv_layers_spec=self._clf_conv_layers_spec,
649
648
  n_chans=self.n_chans,
@@ -888,7 +887,6 @@ class SignalJEPA_PostLocal(_BaseSignalJEPA):
888
887
 
889
888
  def reset_head(self, n_outputs):
890
889
  self._n_outputs = n_outputs
891
- self._update_init_kwargs(n_outputs=n_outputs)
892
890
  self.final_layer = _get_separable_clf_layer(
893
891
  conv_layers_spec=self._clf_conv_layers_spec,
894
892
  n_chans=self.n_chans,
@@ -1122,7 +1120,6 @@ class SignalJEPA_PreLocal(_BaseSignalJEPA):
1122
1120
 
1123
1121
  def reset_head(self, n_outputs):
1124
1122
  self._n_outputs = n_outputs
1125
- self._update_init_kwargs(n_outputs=n_outputs)
1126
1123
  self.final_layer = nn.Sequential(
1127
1124
  nn.Flatten(start_dim=1),
1128
1125
  nn.Linear(self._out_emb_dim, n_outputs),
@@ -1429,14 +1426,8 @@ class _PosEncoder(nn.Module):
1429
1426
  "default_ch_idxs", ch_idxs.to(torch.long), persistent=False
1430
1427
  )
1431
1428
 
1432
- # Pre-computed tensor for positional encoding on the time dimension, a
1433
- # non-persistent buffer so that it follows ``.to(device)``:
1434
- self.encoding_time: torch.Tensor
1435
- self.register_buffer(
1436
- "encoding_time",
1437
- torch.zeros(0, dtype=torch.float32, requires_grad=False),
1438
- persistent=False,
1439
- )
1429
+ # Pre-computed tensor for positional encoding on the time dimension:
1430
+ self.encoding_time = torch.zeros(0, dtype=torch.float32, requires_grad=False)
1440
1431
 
1441
1432
  def _check_encoding_time(self, n_times: int):
1442
1433
  if self.encoding_time.size(0) < n_times:
@@ -1474,30 +1465,20 @@ class _PosEncoder(nn.Module):
1474
1465
  assert n_chans_times % n_chans == 0
1475
1466
  n_times = n_chans_times // n_chans
1476
1467
 
1477
- # Built with torch.cat rather than strided in-place writes into a
1478
- # new_empty buffer, which Intel Gaudi (HPU) silently dropped.
1479
- # Channel pos. encoding
1480
- spat_encoding = self.pos_encoder_spat(ch_idxs)[:, :, None, :].expand(
1481
- batch_size_chs, n_chans, n_times, self.spat_dim
1468
+ pos_encoding = local_features.new_empty(
1469
+ (batch_size_chs, n_chans, n_times, emb_dim)
1482
1470
  )
1471
+ # Channel pos. encoding
1472
+ pos_encoding[:, :, :, : self.spat_dim] = self.pos_encoder_spat(ch_idxs)[
1473
+ :, :, None, :
1474
+ ]
1483
1475
  # Temporal pos. encoding
1484
1476
  self._check_encoding_time(n_times)
1485
- time_encoding = self.encoding_time[:n_times].to(
1486
- device=local_features.device, dtype=local_features.dtype
1487
- )
1488
- time_encoding = time_encoding[None, None].expand(
1489
- batch_size_chs, n_chans, n_times, self.time_dim
1477
+ _ = pos_encoding[:, :, :, self.spat_dim : self.spat_dim + self.time_dim].copy_(
1478
+ self.encoding_time[None, None, :n_times, :],
1490
1479
  )
1491
- parts = [spat_encoding.to(local_features.dtype), time_encoding]
1492
- n_rest = emb_dim - self.spat_dim - self.time_dim
1493
- if n_rest > 0:
1494
- # Entries new_empty used to leave uninitialised.
1495
- parts.append(
1496
- local_features.new_zeros(batch_size_chs, n_chans, n_times, n_rest)
1497
- )
1498
- pos_encoding = torch.cat(parts, dim=-1)
1499
1480
 
1500
- return pos_encoding.reshape(batch_size, n_chans_times, emb_dim)
1481
+ return pos_encoding.view(batch_size, n_chans_times, emb_dim)
1501
1482
 
1502
1483
 
1503
1484
  def _n_times_out(conv_layers_spec, n_times):