class_docstr: SPOS trainer.
  
  Parameters
  ----------
  n_warmup : int
      Number of epochs for training super network.
  model_lr : float
      Learning rate for super network.
  model_wd : float
      Weight decay for super network.
  
  Other parameters see Evolution
class_docstr_tok: ["SPOS","trainer",".","Parameters","--","--","--","--","--","n_warmup",":","int","Number","of","epochs","for","training","super","network",".","model_lr",":","float","Learning","rate","for","super","network",".","model_wd",":","float","Weight","decay","for","super","network",".","Other","parameters","see","Evolution"]
code: def _prepare(self):
      # replace choice
      self.nas_modules = []
      k2o = get_module_order(self.model)
      replace_layer_choice(
          self.model, PathSamplingLayerChoice, self.nas_modules
      )
      replace_input_choice(
          self.model, PathSamplingInputChoice, self.nas_modules
      )
      self.nas_modules = sort_replaced_module(k2o, self.nas_modules)
      # to device
      self.model = self.model.to(self.device)
      self.model_optim = torch.optim.Adam(
          self.model.parameters(),
          lr=self.model_lr,
          weight_decay=self.model_wd,
      )
      # controller
      self.controller = UniformSampler(self.nas_modules)
  
      # Evolution
      self.evolve = Evolution(
          optimize_mode="maximize",
          population_size=self.population_size,
          sample_size=self.sample_size,
          cycles=self.cycles,
          mutation_prob=self.mutation_prob,
          disable_progress=self.disable_progress,
      )
  
imports: import copy
  from logging import Logger
  from numpy.core.fromnumeric import sort
  import torch
  import torch.nn
  import torch.nn.functional
  from .None import register_nas_algo
  from .base import BaseNAS
  from ..space import BaseSpace
  from ..utils import AverageMeterGroup, replace_layer_choice, replace_input_choice, get_module_order, sort_replaced_module, PathSamplingLayerChoice, PathSamplingInputChoice
  from tqdm import tqdm, trange
  from ....utils import get_logger
  import numpy
  import collections
  import dataclasses
  import random
label_desc: Use image node_id 2 for calling the Spos obj's underlying member method code with example usage: obj._prepare() without return types