xnn.common.models.registry.register_model#

xnn.common.models.registry.register_model(name)[source]#

Return a class decorator that registers a model under name.

Parameters:

name (str) – The name under which to register the decorated class. Lookups are case-insensitive (the name is lowercased internally).

Returns:

A decorator that registers the class it wraps and returns it unchanged.

Return type:

Callable[[Type], Type]

Raises:

KeyError – When applied, if name is already registered to a different class.

Examples

>>> @register_model("mymodel")
... class MyModel(InteratomicPotential):
...     ...