code: def to_skip_connection_graph(graph):
      """skip connection graph"""
      # The last conv layer cannot be widen since wider operator cannot be done
      # over the two sides of flatten.
      weighted_layer_ids = graph.skip_connection_layer_ids()
      valid_connection = []
      for skip_type in sorted(
          [
              NetworkDescriptor.ADD_CONNECT,
              NetworkDescriptor.CONCAT_CONNECT,
          ]
      ):
          for index_a in range(len(weighted_layer_ids)):
              for index_b in range(len(weighted_layer_ids))[
                  index_a + 1 :
              ]:
                  valid_connection.append((index_a, index_b, skip_type))
  
      if not valid_connection:
          return graph
      for index_a, index_b, skip_type in sample(valid_connection, 1):
          a_id = weighted_layer_ids[index_a]
          b_id = weighted_layer_ids[index_b]
          if skip_type == NetworkDescriptor.ADD_CONNECT:
              graph.to_add_skip_model(a_id, b_id)
          else:
              graph.to_concat_skip_model(a_id, b_id)
      return graph
  
file_path: nni/nni/algorithms/hpo/networkmorphism_tuner/graph_transformer.py
imports: from copy import deepcopy
  from random import randrange, sample
  from .graph import NetworkDescriptor
  from .layers import StubDense, StubReLU, get_batch_norm_class, get_conv_class, get_dropout_class, get_pooling_class, is_layer
  from .utils import Constant
label_desc: Use image node_id 2 for calling a global function with example usage: to_skip_connection_graph(graph) and returns: graph, graph