code: def from_str(s):
      """generate genotype from string
      e.g. "Genotype(
              normal=[[('sep_conv_3x3', 0), ('sep_conv_3x3', 1)],
                      [('sep_conv_3x3', 1), ('dil_conv_3x3', 2)],
                      [('sep_conv_3x3', 1), ('sep_conv_3x3', 2)],
                      [('sep_conv_3x3', 1), ('dil_conv_3x3', 4)]],
              normal_concat=range(2, 6),
              reduce=[[('max_pool_3x3', 0), ('max_pool_3x3', 1)],
                      [('max_pool_3x3', 0), ('skip_connect', 2)],
                      [('max_pool_3x3', 0), ('skip_connect', 2)],
                      [('max_pool_3x3', 0), ('skip_connect', 2)]],
              reduce_concat=range(2, 6))"
      """
  
      genotype = eval(s)
  
      return genotype
  
file_path: nni/examples/nas/legacy/cdarts/genotypes.py
imports: from collections import namedtuple
  import torch
  import torch.nn
  import torch.nn.functional
  import ops
  from ops import PRIMITIVES
label_desc: Use image node_id 2 for calling a global function with example usage: from_str(s) and returns: genotype