Skip to content

somap and coord are not registered as buffers or parameters #17

@mdaquin

Description

@mdaquin

somap is stored as a plain tensor in SOM.__init__ rather than being registered via register_buffer() or as an nn.Parameter. The same applies to coord.

This means:

  • model.to(device) won't move somap/coord automatically (the manual .to() override works around this but is fragile)
  • model.state_dict() won't include somap, so saving/loading a trained model loses the trained map
  • model.load_state_dict() can't restore the map

Suggested fix

Use self.register_buffer('somap', ...) for somap and self.register_buffer('coord', ...) for coord. This would also allow removing the manual .to() overrides in SOM, WSOM, and MCWSOM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions