neural_compressor.experimental.nas.search_algorithms

Search algorithms for NAS.

Module Contents

Classes

Searcher

Base class for defining the common methods of different search algorithms.

GridSearcher

Grid search.

RandomSearcher

Random search.

BayesianOptimizationSearcher

Bayesian Optimization.

class neural_compressor.experimental.nas.search_algorithms.Searcher(search_space)

Bases: object

Base class for defining the common methods of different search algorithms.

Parameters:

search_space (dict) – A dictionary for defining the search space.

abstract suggest()

Suggest the model architecture.

get_feedback(metric)

Get metric feedback for the search algorithm.

params_vec2params_dict(para_vec)

Convert the parameters vector to parameters dictionary.

Where parameters vector and parameters dictionary both define the model architecture.

Returns:

Parameters dictionary defining the model architecture.

class neural_compressor.experimental.nas.search_algorithms.GridSearcher(search_space)

Bases: Searcher

Grid search.

Search the whole search space exhaustively.

Parameters:

search_space (dict) – A dictionary for defining the search space.

suggest()

Suggest the model architecture.

Returns:

The model architecture.

class neural_compressor.experimental.nas.search_algorithms.RandomSearcher(search_space, seed=42)

Bases: Searcher

Random search.

Search the whole search space randomly.

Parameters:

search_space (dict) – A dictionary for defining the search space.

suggest()

Suggest the model architecture.

Returns:

The model architecture.

class neural_compressor.experimental.nas.search_algorithms.BayesianOptimizationSearcher(search_space, seed=42)

Bases: Searcher

Bayesian Optimization.

Search the search space with Bayesian Optimization.

Parameters:

search_space (dict) – A dictionary for defining the search space.

suggest()

Suggest the model architecture.

Returns:

The model architecture.

get_feedback(metric)

Get metric feedback and register this metric.

indices2params_vec(indices)

Convert indices to parameters vector.