code: def build_graph(self, image, label):
      image = tf.expand_dims(image * 2 - 1, 3)
  
      with argscope(
          Conv2D, kernel_shape=3, nl=tf.nn.relu, out_channel=32
      ):
          c0 = Conv2D("conv0", image)
          p0 = MaxPooling("pool0", c0, 2)
          c1 = Conv2D("conv1", p0)
          c2 = Conv2D("conv2", c1)
          p1 = MaxPooling("pool1", c2, 2)
          c3 = Conv2D("conv3", p1)
          fc1 = FullyConnected("fc0", c3, 512, nl=tf.nn.relu)
          fc1 = Dropout("dropout", fc1, 0.5)
          logits = FullyConnected(
              "fc1", fc1, out_dim=10, nl=tf.identity
          )
  
      with tf.name_scope("visualizations"):
          visualize_conv_weights(c0.variables.W, "conv0")
          visualize_conv_activations(c0, "conv0")
          visualize_conv_weights(c1.variables.W, "conv1")
          visualize_conv_activations(c1, "conv1")
          visualize_conv_weights(c2.variables.W, "conv2")
          visualize_conv_activations(c2, "conv2")
          visualize_conv_weights(c3.variables.W, "conv3")
          visualize_conv_activations(c3, "conv3")
  
          tf.summary.image("input", (image + 1.0) * 128.0, 3)
  
      cost = tf.nn.sparse_softmax_cross_entropy_with_logits(
          logits=logits, labels=label
      )
      cost = tf.reduce_mean(cost, name="cross_entropy_loss")
  
      tf.reduce_mean(
          tf.cast(tf.nn.in_top_k(logits, label, 1), tf.float32),
          name="accuracy",
      )
  
      wd_cost = tf.multiply(
          1e-5,
          regularize_cost("fc.*/W", tf.nn.l2_loss),
          name="regularize_loss",
      )
      return tf.add_n([wd_cost, cost], name="total_cost")
  
file_path: tensorpack/examples/basics/mnist-visualizations.py
imports: from tensorpack import tfv1
  from tensorpack import *
  from tensorpack.dataflow import dataset
label_desc: Use image node_id 2 for calling the Model obj's underlying member method code with example usage: obj.build_graph(image, label) and returns: tf