code: def setup(self):
      logger.info(
          "episode. %d start. current time: %s"
          % (
              self.episode,
              arch_search_convnet_net2net.strftime(
                  "%a, %d %b %Y %H:%M:%S",
                  arch_search_convnet_net2net.gmtime(),
              ),
          )
      )
      start_time = arch_search_convnet_net2net.time()
  
      self.nets = [
          self.arch_manager.get_start_net(copy=True)
          for _ in range(self.episode_config["batch_size"])
      ]
      self.net_configs = [net_config for net_config, _, _ in self.nets]
      logger.info(self.net_configs)
      # feed_dict for update the controller
      self.wider_decision_trajectory, self.wider_decision_mask = [], []
      self.deeper_decision_trajectory, self.deeper_decision_mask = (
          [],
          [],
      )
      self.deeper_block_layer_num = []
      self.encoder_input_seq, self.encoder_seq_len = [], []
      self.wider_seg_deeper = 0
      if self.random:
          # random search
          self.remain_wider_num = self.episode_config[
              "wider_action_num"
          ]
          self.remain_deeper_num = self.episode_config[
              "deeper_action_num"
          ]
          while self.remain_wider_num > 0 or self.remain_deeper_num > 0:
              self.rand_idx = (
                  arch_search_convnet_net2net.np.random.randint(
                      0, self.remain_wider_num + self.remain_deeper_num
                  )
              )
              if self.rand_idx < self.remain_wider_num:
                  self.wider_decision = (
                      arch_search_convnet_net2net.np.random.choice(
                          2,
                          [
                              self.episode_config["batch_size"],
                              self.encoder.num_steps,
                          ],
                      )
                  )
                  self.arch_search_convnet_net2net.apply_wider_decision(
                      self.wider_decision,
                      self.net_configs,
                      self.filter_num_list,
                      self.units_num_list,
                      self.noise_config,
                  )
                  self.remain_wider_num -= 1
              else:
                  self.block_layer_num = (
                      arch_search_convnet_net2net.get_block_layer_num(
                          self.net_configs
                      )
                  )
                  self.deeper_decision = (
                      arch_search_convnet_net2net.np.zeros(
                          [
                              self.episode_config["batch_size"],
                              self.deeper_actor.decision_num,
                          ],
                          arch_search_convnet_net2net.np.int,
                      )
                  )
                  self.deeper_decision[
                      :, 0
                  ] = arch_search_convnet_net2net.np.random.choice(
                      self.deeper_actor.out_dims[0],
                      self.deeper_decision[:, 0].shape,
                  )
                  for _k, block_decision in enumerate(
                      self.deeper_decision[:, 0]
                  ):
                      available_layer_num = self.block_layer_num[
                          _k, block_decision
                      ]
                      self.deeper_decision[
                          _k, 1
                      ] = arch_search_convnet_net2net.np.random.randint(
                          0, available_layer_num
                      )
                      self.deeper_decision[
                          :, 2
                      ] = arch_search_convnet_net2net.np.random.choice(
                          self.deeper_actor.out_dims[2],
                          self.deeper_decision[:, 2].shape,
                      )
  
                  (
                      _,
                      to_set_layers,
                  ) = arch_search_convnet_net2net.apply_deeper_decision(
                      self.deeper_decision,
                      self.net_configs,
                      self.kernel_size_list,
                      self.noise_config,
                  )
                  for _k, net_config in enumerate(self.net_configs):
                      net_config.set_identity4deepen(
                          to_set_layers[_k],
                          self.arch_manager.data_provider,
                          batch_size=64,
                          batch_num=1,
                          noise=self.noise_config,
                      )
                  self.remain_deeper_num -= 1
      else:
          # on-policy training
          for _j in range(self.episode_config["wider_action_num"]):
              (
                  self.input_seq,
                  self.seq_len,
              ) = arch_search_convnet_net2net.get_net_seq(
                  self.net_configs,
                  self.encoder.vocab,
                  self.encoder.num_steps,
              )
              (
                  self.wider_decision,
                  self.wider_probs,
              ) = self.meta_controller.sample_wider_decision(
                  self.input_seq, self.seq_len
              )
              # modify net config according to wider_decision
              self.wider_mask = (
                  arch_search_convnet_net2net.apply_wider_decision(
                      self.wider_decision,
                      self.net_configs,
                      self.filter_num_list,
                      self.units_num_list,
                      self.noise_config,
                  )
              )
  
              self.wider_decision_trajectory.append(self.wider_decision)
              self.wider_decision_mask.append(self.wider_mask)
              self.wider_seg_deeper += len(self.net_configs)
              self.encoder_input_seq.append(self.input_seq)
              self.encoder_seq_len.append(self.seq_len)
  
          self.to_set_layers = [
              [] for _ in range(self.episode_config["batch_size"])
          ]
          for _j in range(self.episode_config["deeper_action_num"]):
              (
                  self.input_seq,
                  self.seq_len,
              ) = arch_search_convnet_net2net.get_net_seq(
                  self.net_configs,
                  self.encoder.vocab,
                  self.encoder.num_steps,
              )
              self.block_layer_num = (
                  arch_search_convnet_net2net.get_block_layer_num(
                      self.net_configs
                  )
              )
              (
                  self.deeper_decision,
                  self.deeper_probs,
              ) = self.meta_controller.sample_deeper_decision(
                  self.input_seq, self.seq_len, self.block_layer_num
              )
              # modify net config according to deeper_decision
              (
                  self.deeper_mask,
                  self.to_set,
              ) = arch_search_convnet_net2net.apply_deeper_decision(
                  self.deeper_decision,
                  self.net_configs,
                  self.kernel_size_list,
                  self.noise_config,
              )
              for _k in range(self.episode_config["batch_size"]):
                  self.to_set_layers[_k] += self.to_set[_k]
  
              self.deeper_decision_trajectory.append(
                  self.deeper_decision
              )
              self.deeper_decision_mask.append(self.deeper_mask)
              self.deeper_block_layer_num.append(self.block_layer_num)
              self.encoder_input_seq.append(self.input_seq)
              self.encoder_seq_len.append(self.seq_len)
  
          for _k, self.net_config in enumerate(self.net_configs):
              self.net_config.set_identity4deepen(
                  self.to_set_layers[_k],
                  self.arch_manager.data_provider,
                  batch_size=64,
                  batch_num=1,
                  noise=self.noise_config,
              )
          # prepare feed dict
          self.encoder_input_seq = (
              arch_search_convnet_net2net.np.concatenate(
                  self.encoder_input_seq, axis=0
              )
          )
          self.encoder_seq_len = (
              arch_search_convnet_net2net.np.concatenate(
                  self.encoder_seq_len, axis=0
              )
          )
          if self.episode_config["wider_action_num"] > 0:
              self.wider_decision_trajectory = (
                  arch_search_convnet_net2net.np.concatenate(
                      self.wider_decision_trajectory, axis=0
                  )
              )
              self.wider_decision_mask = (
                  arch_search_convnet_net2net.np.concatenate(
                      self.wider_decision_mask, axis=0
                  )
              )
          else:
              self.wider_decision_trajectory = (
                  -arch_search_convnet_net2net.np.ones(
                      [1, self.meta_controller.encoder.num_steps]
                  )
              )
              self.wider_decision_mask = (
                  -arch_search_convnet_net2net.np.ones(
                      [1, self.meta_controller.encoder.num_steps]
                  )
              )
          if self.episode_config["deeper_action_num"] > 0:
              self.deeper_decision_trajectory = (
                  arch_search_convnet_net2net.np.concatenate(
                      self.deeper_decision_trajectory, axis=0
                  )
              )
              self.deeper_decision_mask = (
                  arch_search_convnet_net2net.np.concatenate(
                      self.deeper_decision_mask, axis=0
                  )
              )
              self.deeper_block_layer_num = (
                  arch_search_convnet_net2net.np.concatenate(
                      self.deeper_block_layer_num, axis=0
                  )
              )
          else:
              self.deeper_decision_trajectory = -arch_search_convnet_net2net.np.ones(
                  [1, self.meta_controller.deeper_actor.decision_num]
              )
              self.deeper_decision_mask = -arch_search_convnet_net2net.np.ones(
                  [1, self.meta_controller.deeper_actor.decision_num]
              )
              self.deeper_block_layer_num = (
                  arch_search_convnet_net2net.np.ones(
                      [1, self.meta_controller.deeper_actor.out_dims[0]]
                  )
              )
  
      self.run_configs = [self.run_config] * len(self.net_configs)
  
      self.net_str_list = self.get_net_str(self.net_configs)
  
      tasks = self.arch_manager.get_net_tasks(
          self.net_str_list, self.net_configs, self.run_configs
      )
      self.idx_to_task = {}
      self.exp_list = []
      for task in tasks:
          self.idx_to_task[task[0]] = task[1][0]
          self.exp_list.append(task[0])
  
file_path: auptimizer/src/aup/Proposer/EASProposer.py
imports: import re
  import numpy
  import logging
label_desc: Use image node_id 7 for calling the EASProposer obj's underlying member method code with example usage: obj.setup() without return types