utils — Model Optimizer 0.29.0 (original) (raw)

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:

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:

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