code: def mlp_definition(features, nn, num_classes):
      """Defines layers in tensorflow neural network, using info from nn python structure."""
      # Define input layer, cast data as tensor
      features = features["x"]
      layers = [
          tf.reshape(tf.cast(features, tf.float32), features.shape)
      ]  ### NEED TO VERIFY FLOAT32
  
      # Loop over layers and build tensorflow network
      for lidx in range(1, nn.num_internal_layers + 1):
          plist = get_layer_parents(nn.conn_mat.viewkeys(), lidx)
          # Define or concatenate parents
          parent_layers = [layers[i] for i in plist]
          input_layer = tf.concat(
              parent_layers, 1
          )  ### NEED TO VERIFY CONCAT ALONG AXIS 1
          # Get number of hidden units
          num_units = nn.num_units_in_each_layer[lidx]
          if num_units == None:
              num_units = 1
          # Define activation function
          act_str = nn.layer_labels[lidx]
          # define next layer
          layers.append(
              tf.layers.dense(
                  input_layer,
                  num_units,
                  use_bias=True,
                  activation=activation_dict[act_str],
              )
          )
  
      # Define output layer
      plist = get_layer_parents(nn.conn_mat.viewkeys(), lidx + 1)
      parent_layers = [layers[i] for i in plist]
      # scalar_mult = tf.Variable(1./(len(plist)+1),tf.float32) ### NEED TO VERIFY FLOAT 32
      scalar_mult = tf.Variable(
          1.0 / len(plist), tf.float32
      )  ### NEED TO VERIFY FLOAT 32
      input_layer = tf.scalar_mul(scalar_mult, tf.add_n(parent_layers))
      # For regression
      if nn.class_or_reg == "reg":
          op_layer = tf.layers.dense(
              input_layer, 1, use_bias=True, activation=None
          )
      # For classification
      elif nn.class_or_reg == "class":
          op_layer = tf.layers.dense(
              input_layer,
              num_classes,
              use_bias=True,
              activation=tf.nn.softmax,
          )
      else:
          pass
      return op_layer
  
file_path: dragonfly/examples/nas/cg/run_tensorflow_testset.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import numpy
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: mlp_definition(features, nn, num_classes) and returns: op_layer