Skip to content

ShallowFBCSPNet split_first_layer=False is broken by unconditional CombinedConv init/remapping #1211

Description

@lindicaphxag-tech

Summary

ShallowFBCSPNet(split_first_layer=False) still constructs the historical unsplit first layer as self.conv_time, but the post-CombinedConv initialization and legacy checkpoint mapping assume self.conv_time_spat exists unconditionally.

This makes the documented non-split path fail during construction, and legacy conv_time.* checkpoint keys are remapped to a module that does not exist.

Regression

In Braindecode v0.7.0, the unsplit path initialized self.conv_time directly:

init.xavier_uniform_(self.conv_time.weight, gain=1)
if self.split_first_layer or (not self.batch_norm):
    init.constant_(self.conv_time.bias, 0)

The current implementation creates conv_time_spat = CombinedConv(...) only when split_first_layer=True, but later does:

init.xavier_uniform_(self.conv_time_spat.conv_time.weight, gain=1)

regardless of the mode. The current compatibility mapping similarly rewrites conv_time.* -> conv_time_spat.conv_time.* even for the unsplit model.

Expected behavior

  • split_first_layer=True: keep the current CombinedConv initialization and legacy key migration.
  • split_first_layer=False: initialize the direct conv_time layer and leave legacy conv_time.* keys on that module.
  • classifier key migration remains unchanged in both modes.

Proposed regression coverage

  1. construct and run ShallowFBCSPNet(..., split_first_layer=False);
  2. verify the unsplit model owns conv_time and not conv_time_spat;
  3. load a legacy-style state dict where conv_time.* remains unsplit while conv_classifier.* migrates to final_layer.conv_classifier.*.

I have a focused patch prepared that only branches the CombinedConv-specific initialization/remapping and leaves the default split-first-layer behavior unchanged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions