XNAS#

Architecture Trainer#

class archai.supergraph.algos.xnas.xnas_arch_trainer.XnasArchTrainer(conf_train: Config, model: Model, checkpoint: CheckPoint | None)[source]#
create_optimizer(conf_optim: Config, params) Optimizer[source]#
pre_fit(data_loaders: DataLoaders) None[source]#
post_fit(data_loaders: DataLoaders) None[source]#
pre_epoch(data_loaders: DataLoaders) None[source]#
post_epoch(data_loaders: DataLoaders) None[source]#
pre_step(x: Tensor, y: Tensor) None[source]#
update_checkpoint(checkpoint: CheckPoint) None[source]#

Experiment Runner#

class archai.supergraph.algos.xnas.xnas_exp_runner.XnasExperimentRunner(config_filename: str, base_name: str, clean_expdir=False)[source]#
model_desc_builder() XnasModelDescBuilder[source]#
trainer_class() Type[ArchTrainer] | None[source]#

Model Description Builder#

class archai.supergraph.algos.xnas.xnas_model_desc_builder.XnasModelDescBuilder[source]#
pre_build(conf_model_desc: Config) None[source]#

hook for accomplishing any setup before build starts

build_nodes(stem_shapes: List[List[int | float]], conf_cell: Config, cell_index: int, cell_type: CellType, node_count: int, in_shape: List[int | float], out_shape: List[int | float]) Tuple[List[List[int | float]], List[NodeDesc]][source]#

Operators#

class archai.supergraph.algos.xnas.xnas_op.XnasOp(op_desc: OpDesc, arch_params: ArchParams | None, affine: bool)[source]#

The output of XnasOp is weighted output of all allowed primitives.

PRIMITIVES = ['max_pool_3x3', 'avg_pool_3x3', 'skip_connect', 'sep_conv_3x3', 'sep_conv_5x5', 'dil_conv_3x3', 'dil_conv_5x5', 'none']#
update_alphas(eta: float, current_t: int, total_t: int, grad_clip: float)[source]#
forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

finalize() Tuple[OpDesc, float | None][source]#

for trainable op, return final op and its rank

can_drop_path() bool[source]#
training: bool#