noether.core.factory.utils

Attributes

Functions

all_ctor_kwarg_names(cls)

Returns all names of kwargs in of a type (including the kwargs of all parent classes).

class_constructor_from_class_path(class_path)

Creates a callable that constructs an object from a classpath. This callable is either a type (if no further

Module Contents

noether.core.factory.utils.logger
noether.core.factory.utils.all_ctor_kwarg_names(cls)

Returns all names of kwargs in of a type (including the kwargs of all parent classes).

Parameters:

cls (type) – Type from which to retrieve the names of kwargs.

Returns:

A list of names of kwargs of the type.

Return type:

set[str]

noether.core.factory.utils.class_constructor_from_class_path(class_path)

Creates a callable that constructs an object from a classpath. This callable is either a type (if no further kwargs are needed to be passed) or a partial otherwise. This is equivalent to Hydra instantiation with _target_, which is also based on class paths.

Parameters:

class_path (str) – Fully specified module path of the object. For example: “torch.optim.SGD” or “noether.core.callbacks.CheckpointCallback”.

Returns:

A callable that constructs the object.

Return type:

collections.abc.Callable[Ellipsis, Any]