utils

Utilities for optimization.

Functions

get_hparam

Get the hparam with the given name.

is_configurable

Check if the model is configurable.

is_dynamic

Check if the model is dynamic.

named_dynamic_modules

Recursively yield the name and instance of all dynamic modules.

named_hparams

Recursively yield the name and instance of all hparams.

search_space_size

Return the size of the search space.

get_hparam(model, name)

Get the hparam with the given name.

Parameters:
  • model (Module) –

  • name (str) –

Return type:

Hparam

is_configurable(model)

Check if the model is configurable.

Parameters:

model (Module) –

Return type:

bool

is_dynamic(model)

Check if the model is dynamic.

Parameters:

model (Module) –

Return type:

bool

named_dynamic_modules(model)

Recursively yield the name and instance of all dynamic modules.

Parameters:

model (Module) –

Return type:

Generator[Tuple[str, DynamicModule], None, None]

named_hparams(model, configurable=None)

Recursively yield the name and instance of all hparams.

Parameters:
  • model (Module) –

  • configurable (bool | None) –

Return type:

Generator[Tuple[str, Hparam], None, None]

search_space_size(model)

Return the size of the search space.

Parameters:

model (Module) –

Return type:

int