code: def build_graph(self, image, label):
      image = image / 128.0
      assert tf.test.is_gpu_available()
      image = tf.transpose(image, [0, 3, 1, 2])
  
      def residual(name, l, increase_dim=False, first=False):
          shape = l.get_shape().as_list()
          in_channel = shape[1]
  
          if increase_dim:
              out_channel = in_channel * 2
              stride1 = 2
          else:
              out_channel = in_channel
              stride1 = 1
  
          with tf.variable_scope(name):
              b1 = l if first else BNReLU(l)
              c1 = Conv2D(
                  "conv1",
                  b1,
                  out_channel,
                  strides=stride1,
                  activation=BNReLU,
              )
              c2 = Conv2D("conv2", c1, out_channel)
              if increase_dim:
                  l = AvgPooling("pool", l, 2)
                  l = tf.pad(
                      l,
                      [
                          [0, 0],
                          [in_channel // 2, in_channel // 2],
                          [0, 0],
                          [0, 0],
                      ],
                  )
  
              l = c2 + l
              return l
  
      with argscope(
          [Conv2D, AvgPooling, BatchNorm, GlobalAvgPooling],
          data_format="channels_first",
      ), argscope(
          Conv2D,
          use_bias=False,
          kernel_size=3,
          kernel_initializer=tf.variance_scaling_initializer(
              scale=2.0, mode="fan_out"
          ),
      ):
          l = Conv2D("conv0", image, 16, activation=BNReLU)
          l = residual("res1.0", l, first=True)
          for k in range(1, self.n):
              l = residual("res1.{}".format(k), l)
          # 32,c=16
  
          l = residual("res2.0", l, increase_dim=True)
          for k in range(1, self.n):
              l = residual("res2.{}".format(k), l)
          # 16,c=32
  
          l = residual("res3.0", l, increase_dim=True)
          for k in range(1, self.n):
              l = residual("res3." + str(k), l)
          l = BNReLU("bnlast", l)
          # 8,c=64
          l = GlobalAvgPooling("gap", l)
  
      logits = FullyConnected("linear", l, 10)
      tf.nn.softmax(logits, name="output")
  
      cost = tf.nn.sparse_softmax_cross_entropy_with_logits(
          logits=logits, labels=label
      )
      cost = tf.reduce_mean(cost, name="cross_entropy_loss")
  
      wrong = tf.cast(
          tf.logical_not(tf.nn.in_top_k(logits, label, 1)),
          tf.float32,
          name="wrong_vector",
      )
      # monitor training error
      add_moving_summary(tf.reduce_mean(wrong, name="train_error"))
  
      # weight decay on all W of fc layers
      wd_w = tf.train.exponential_decay(
          0.0002, get_global_step_var(), 480000, 0.2, True
      )
      wd_cost = tf.multiply(
          wd_w, regularize_cost(".*/W", tf.nn.l2_loss), name="wd_cost"
      )
      add_moving_summary(cost, wd_cost)
  
      add_param_summary((".*/W", ["histogram"]))  # monitor W
      return tf.add_n([cost, wd_cost], name="cost")
  
file_path: tensorpack/examples/ResNet/cifar10-resnet.py
imports: import argparse
  import os
  from tensorpack import tfv1
  from tensorpack import *
  from tensorpack.dataflow import dataset
  from tensorpack.tfutils.summary import add_moving_summary, add_param_summary
  from tensorpack.utils.gpu import get_num_gpu
label_desc: Use image node_id 3 for calling the Model obj's underlying member method code with example usage: obj.build_graph(image, label) and returns: tf, l