check_models

selfeeg.utils.utils.check_models(model1: Module, model2: Module) bool[source]

checks that two nn.Modules are equal.

Parameters:
  • model1 (nn.Module) – The first model to compare.

  • model2 (nn.Module) – The second model to compare.

Returns:

equals (bool) – A boolean stating if the models are equal or not.

Example

>>> import selfeeg.models
>>> model1 = models.EEGNet(4,8,512)
>>> model2 = models.EEGNet(4,8,512)
>>> print( utils.utils.check_models(model1,model2)) # Should return False
>>> model2.load_state_dict(model1.state_dict())
>>> utils.check_models(model1,model2)  # Should return False