braindecode.modules.ChannelInterpolationLayer#
- class braindecode.modules.ChannelInterpolationLayer(src_chs_info, tgt_chs_info, mode='always', method='spline', trainable=False)[source]#
Projects an input from one channel set to another via a fixed (or learnable) matrix.
Warning
Experimental. Public API may change without a deprecation cycle.
- Parameters:
src_chs_info (
list[dict]) – Source (user) channel info; each dict must have"ch_name"and"loc"keys (MNE-style).tgt_chs_info (
list[dict]) – Target channel info; same structure.mode (
Literal['always','name_match']) –How the matrix is built. Default
"always"."always": every row ofWis computed viamne.io.Raw.interpolate_to()using the 3D positions."name_match": for each target channel whosech_name(case-insensitive) also appears insrc_chs_info, the corresponding row ofWis a one-hot vector selecting that source channel (its 3D position is ignored). Remaining rows, if any, are filled via MNE. If every target name has a source match, MNE is not invoked and no"loc"is required.
method (
str) – Forwarded tomne.Raw.interpolate_tomethodargument when an MNE-based matrix is needed. Default"spline".trainable (
bool) – IfTruethe matrix is annn.Parameter(stored instate_dict). IfFalseit is a non-persistent buffer (recomputed fromchs_infoat every__init__).
Methods
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
Examples using braindecode.modules.ChannelInterpolationLayer#
Loading Pretrained Foundation Models on Arbitrary Channel Sets