code: def build_graph_old(inputs, tree, transpose=(2, 3, 1, 0)):
      net = inputs
  
      if tree["name"] == "nn.Sequential":
          with tf.name_scope("nn.Sequential"):
              for tr in tree["children"]:
                  net = build_graph(net, tr, transpose, layers)
      elif tree["name"] == "nn.ConcatTable":
          net_table = []
          with tf.name_scope("nn.ConcatTable"):
              for tr in tree["children"]:
                  net_table.append(
                      build_graph(net, tr, transpose, layers)
                  )
          net = net_table
      elif tree["name"] == "nn.JoinTable":
          net = tf.concat(3, net)
      elif tree["name"] == "nn.CAddTable":
          net = tf.add_n(net)
      elif tree["name"] == "nn.SpatialConvolution":
          out_channel = int(tree["nOutputPlane"])
          kernal_shape = (int(tree["kH"]), int(tree["kW"]))
          stride_shape = (int(tree["dH"]), int(tree["dW"]))
          net = tf.pad(
              net,
              [
                  [0, 0],
                  [int(tree["padH"]), int(tree["padH"])],
                  [int(tree["padW"]), int(tree["padW"])],
                  [0, 0],
              ],
          )
          if "weight" in tree.keys() and "bias" in tree.keys():
              net = slim.conv2d(
                  net,
                  out_channel,
                  kernal_shape,
                  stride_shape,
                  activation_fn=None,
                  padding="VALID",
                  weights_initializer=tf.constant_initializer(
                      tree["weight"].transpose(*transpose)
                  ),
                  biases_initializer=tf.constant_initializer(
                      tree["bias"]
                  ),
              )
          else:
              net = slim.conv2d(
                  net,
                  out_channel,
                  kernal_shape,
                  stride_shape,
                  activation_fn=None,
                  padding="VALID",
              )
  
          tree["tfname"] = net.name
          tree["tfvar"] = net
      elif tree["name"] == "nn.SpatialFullConvolution":
          out_channel = int(tree["nOutputPlane"])
          kernal_shape = (int(tree["kH"]), int(tree["kW"]))
          rate = np.min(int(tree["dH"]), int(tree["dW"]))
          h, w = tf.shape(net)[1:3]
          net = tf.image.resize_bilinear(net, (h, w, out_channel))
  
          tree["tfname"] = net.name
          tree["tfvar"] = net
  
      elif tree["name"] == "nn.SpatialBatchNormalization":
          net = slim.batch_norm(net)
          tree["tfname"] = net.name
          tree["tfvar"] = net
      elif tree["name"] == "nn.ReLU":
          net = slim.nn.relu(net)
          tree["tfname"] = net.name
          tree["tfvar"] = net
      elif tree["name"] == "nn.Sigmoid":
          net = slim.nn.sigmoid(net)
          tree["tfname"] = net.name
          tree["tfvar"] = net
      elif tree["name"] == "nn.SpatialMaxPooling":
          net = slim.max_pool2d(
              tf.pad(
                  net,
                  [
                      [0, 0],
                      [int(tree["padH"]), int(tree["padH"])],
                      [int(tree["padW"]), int(tree["padW"])],
                      [0, 0],
                  ],
              ),
              (int(tree["kH"]), int(tree["kW"])),
              (int(tree["dH"]), int(tree["dW"])),
          )
          tree["tfname"] = net.name
          tree["tfvar"] = net
      elif tree["name"] == "nn.Identity":
          pass
      else:
          raise Exception(tree["name"])
  
      return net
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import menpo.io
  from menpo.image import Image
  from menpo.shape import PointCloud
  import cv2
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.contrib.framework.python.ops import variables
  from tensorflow.python.training import optimizer
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import variables
  from menpo.transform import Translation, Scale
  from menpo.shape import PointCloud
label_desc: Use image node_id 10 for calling a global function with example usage: build_graph_old(inputs, tree, transpose) and returns: net