code: def gen_childnet(arch_list, arch_def, **kwargs):
      # arch_list = [[0], [], [], [], [], [0]]
      choices = {"kernel_size": [3, 5, 7], "exp_ratio": [4, 6]}
      choices_list = [
          [x, y]
          for x in choices["kernel_size"]
          for y in choices["exp_ratio"]
      ]
  
      num_features = 1280
  
      # act_layer = HardSwish
      act_layer = Swish
  
      new_arch = []
      # change to child arch_def
      for i, (layer_choice, layer_arch) in enumerate(
          zip(arch_list, arch_def)
      ):
          if len(layer_arch) == 1:
              new_arch.append(layer_arch)
              continue
          else:
              new_layer = []
              for j, (block_choice, block_arch) in enumerate(
                  zip(layer_choice, layer_arch)
              ):
                  kernel_size, exp_ratio = choices_list[block_choice]
                  elements = block_arch.split("_")
                  block_arch = block_arch.replace(
                      elements[2], "k{}".format(str(kernel_size))
                  )
                  block_arch = block_arch.replace(
                      elements[4], "e{}".format(str(exp_ratio))
                  )
                  new_layer.append(block_arch)
              new_arch.append(new_layer)
  
      model_kwargs = dict(
          block_args=decode_arch_def(new_arch),
          num_features=num_features,
          stem_size=16,
          norm_kwargs=resolve_bn_args(kwargs),
          act_layer=act_layer,
          se_kwargs=dict(
              act_layer=nn.ReLU,
              gate_fn=hard_sigmoid,
              reduce_mid=True,
              divisor=8,
          ),
          **kwargs,
      )
      model = ChildNet(**model_kwargs)
      return model
  
file_path: nni/examples/nas/legacy/cream/lib/models/structures/childnet.py
imports: from lib.utils.builder_util import *
  from lib.models.builders.build_childnet import *
  from timm.models.layers import SelectAdaptivePool2d
  from timm.models.layers.activations import hard_sigmoid
label_desc: Use image node_id 1 for calling a global function with example usage: gen_childnet(arch_list, arch_def) and returns: model