Gumbel-Softmax#

Architecture Trainer#

class archai.supergraph.algos.gumbelsoftmax.gs_arch_trainer.GsArchTrainer(conf_train: Config, model: Module, checkpoint: CheckPoint | None)[source]#
create_optimizer(conf_optim: Config, params) Optimizer[source]#
pre_step(x: Tensor, y: Tensor) None[source]#

Experiment Runner#

class archai.supergraph.algos.gumbelsoftmax.gs_exp_runner.GsExperimentRunner(config_filename: str, base_name: str, clean_expdir=False)[source]#
model_desc_builder() GsModelDescBuilder[source]#
trainer_class() Type[ArchTrainer] | None[source]#
finalizers() Finalizers[source]#

Finalizers#

class archai.supergraph.algos.gumbelsoftmax.gs_finalizers.GsFinalizers[source]#
finalize_node(node: ModuleList, node_index: int, node_desc: NodeDesc, max_final_edges: int, *args, **kwargs) NodeDesc[source]#

Model Description Builder#

class archai.supergraph.algos.gumbelsoftmax.gs_model_desc_builder.GsModelDescBuilder[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.gumbelsoftmax.gs_op.GsOp(op_desc: OpDesc, arch_params: ArchParams | None, affine: bool)[source]#

The output of GsOp 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']#
set_op_sampled_weights(sampled_weights: Tensor)[source]#

Sets the weight for each op

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(sampled_weights) Tuple[OpDesc, float | None][source]#

for trainable op, return final op and its rank

can_drop_path() bool[source]#
ops() Iterator[Tuple[Op, float]][source]#

Return contituent ops, if this op is primitive just return self

training: bool#