code: def _build_graph(self, only_forward=False):
      _input = self.images
      output = _input
  
      output = self.net_config.layer_cascade.build(
          output, self, store_output_op=only_forward
      )
  
      if not only_forward:
          logits = output
          with tf.variable_scope("L2_Loss"):
              l2_loss = tf.add_n(
                  [
                      tf.nn.l2_loss(var)
                      for var in tf.trainable_variables()
                  ]
              )
  
          prediction = tf.nn.softmax(logits)
  
          # losses
          cross_entropy = tf.reduce_mean(
              tf.nn.softmax_cross_entropy_with_logits(
                  logits=logits, labels=self.labels
              )
          )
          self.cross_entropy = cross_entropy
  
          # optimizer and train step
          optimizer = self.build_optimizer(
              self.learning_rate,
              self.run_config.opt_config[0],
              self.run_config.opt_config[1],
          )
          self.train_step = optimizer.minimize(
              cross_entropy + l2_loss * self.net_config.weight_decay
          )
          correct_prediction = tf.equal(
              tf.argmax(prediction, 1), tf.argmax(self.labels, 1)
          )
          self.accuracy = tf.reduce_mean(
              tf.cast(correct_prediction, tf.float32)
          )
  
imports: from .basic_model import BasicModel
  from ..data_providers.base_provider import DataProvider
  from .layers import ConvLayer, PoolLayer, FCLayer
  from .layer_cascade import LayerCascade
  import tensorflow
  import numpy
label_desc: Use image node_id 1 for calling the SimpleConvnet obj's underlying member method code with example usage: obj._build_graph(only_forward) without return types