spark.core.registry#

Attributes#

REGISTRY

Registry singleton.

register_module

Decorator used to register a new SparkModule.

register_payload

Decorator used to register a new SparkPayload.

register_initializer

Decorator used to register a new Initializer.

register_config

Decorator used to register a new SparkConfig.

register_cfg_validator

Decorator used to register a new ConfigurationValidator.

MRO_PATH_ALIAS_MAP

INITIALIZERS_ALIAS_MAP

Classes#

RegistryEntry

Structured entry for the registry.

SubRegistry

Registry for registry_base_type.

Registry

Registry object.

Functions#

create_registry_decorator(sub_registry, ...[, ...])

Module Contents#

class spark.core.registry.RegistryEntry[source]#

Structured entry for the registry.

name: str[source]#
class_ref: type[source]#
path: list[str][source]#
class spark.core.registry.SubRegistry(registry_base_type)[source]#

Bases: collections.abc.Mapping

Registry for registry_base_type.

Parameters:

registry_base_type (str)

__built__ = False[source]#
__getitem__(key)[source]#
Parameters:

key (str)

Return type:

RegistryEntry

__iter__()[source]#
Return type:

Iterator[str]

__len__()[source]#
Return type:

int

items()[source]#

D.items() -> a set-like object providing a view on D’s items

Return type:

collections.abc.ItemsView[str, RegistryEntry]

register(name, cls, path=None)[source]#

Register new registry_base_type.

Parameters:
get(name, default=None)[source]#

Safely retrieves a component entry by name.

Parameters:
  • name (str)

  • default (Any)

Return type:

RegistryEntry | None

get_by_cls(cls)[source]#

Safely retrieves a component entry by name.

Parameters:

cls (type | None)

Return type:

RegistryEntry | None

property is_finalized: bool[source]#
Return type:

bool

class spark.core.registry.Registry[source]#

Registry object.

MODULES[source]#
PAYLOADS[source]#
INITIALIZERS[source]#
CONFIG[source]#
CFG_VALIDATORS[source]#
spark.core.registry.REGISTRY[source]#

Registry singleton.

spark.core.registry.create_registry_decorator(sub_registry, base_class_name, base_class_path, base_class_abr=None)[source]#
Parameters:
  • sub_registry (SubRegistry)

  • base_class_name (str)

  • base_class_path (str)

  • base_class_abr (str | None)

spark.core.registry.register_module[source]#

Decorator used to register a new SparkModule. Note that module must inherit from spark.nn.Module (spark.core.module.SparkModule)

spark.core.registry.register_payload[source]#

Decorator used to register a new SparkPayload. Note that module must inherit from spark.SparkPayload (spark.core.payloads.SparkPayload)

spark.core.registry.register_initializer[source]#

Decorator used to register a new Initializer. Note that module must inherit from spark.nn.initializers.base.Initializer

spark.core.registry.register_config[source]#

Decorator used to register a new SparkConfig. Note that module must inherit from spark.nn.BaseConfig (spark.core.config.BaseSparkConfig)

spark.core.registry.register_cfg_validator[source]#

Decorator used to register a new ConfigurationValidator. Note that module must inherit from spark.core.config_validation.ConfigurationValidator

spark.core.registry.MRO_PATH_ALIAS_MAP[source]#
spark.core.registry.INITIALIZERS_ALIAS_MAP[source]#