code: def create_new_layer(layer, n_dim):
      """create  new layer for the graph"""
  
      input_shape = layer.output.shape
      dense_deeper_classes = [
          StubDense,
          get_dropout_class(n_dim),
          StubReLU,
      ]
      conv_deeper_classes = [
          get_conv_class(n_dim),
          get_batch_norm_class(n_dim),
          StubReLU,
      ]
      if is_layer(layer, "ReLU"):
          conv_deeper_classes = [
              get_conv_class(n_dim),
              get_batch_norm_class(n_dim),
          ]
          dense_deeper_classes = [StubDense, get_dropout_class(n_dim)]
      elif is_layer(layer, "Dropout"):
          dense_deeper_classes = [StubDense, StubReLU]
      elif is_layer(layer, "BatchNormalization"):
          conv_deeper_classes = [get_conv_class(n_dim), StubReLU]
  
      layer_class = None
      if len(input_shape) == 1:
          # It is in the dense layer part.
          layer_class = sample(dense_deeper_classes, 1)[0]
      else:
          # It is in the conv layer part.
          layer_class = sample(conv_deeper_classes, 1)[0]
  
      if layer_class == StubDense:
          new_layer = StubDense(input_shape[0], input_shape[0])
  
      elif layer_class == get_dropout_class(n_dim):
          new_layer = layer_class(
              Constant.DENSE_DROPOUT_RATE
          )  # pylint: disable=not-callable
  
      elif layer_class == get_conv_class(n_dim):
          new_layer = layer_class(  # pylint: disable=not-callable
              input_shape[-1],
              input_shape[-1],
              sample((1, 3, 5), 1)[0],
              stride=1,
          )
  
      elif layer_class == get_batch_norm_class(n_dim):
          new_layer = layer_class(
              input_shape[-1]
          )  # pylint: disable=not-callable
  
      elif layer_class == get_pooling_class(n_dim):
          new_layer = layer_class(
              sample((1, 3, 5), 1)[0]
          )  # pylint: disable=not-callable
  
      else:
          new_layer = layer_class()  # pylint: disable=not-callable
  
      return new_layer
  
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 3 for calling a global function with example usage: create_new_layer(layer, n_dim) and returns: new_layer