code: def train_one_batch(self, x, y, dist_option, spars):
      out = self.forward(x)
      loss = self.softmax_cross_entropy(out, y)
  
      if dist_option == "plain":
          self.optimizer(loss)
      elif dist_option == "half":
          self.optimizer.backward_and_update_half(loss)
      elif dist_option == "partialUpdate":
          self.optimizer.backward_and_partial_update(loss)
      elif dist_option == "sparseTopK":
          self.optimizer.backward_and_sparse_update(
              loss, topK=True, spars=spars
          )
      elif dist_option == "sparseThreshold":
          self.optimizer.backward_and_sparse_update(
              loss, topK=False, spars=spars
          )
      return out, loss
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/ml/model_selection/src/eva_engine/phase1/algo/singa_ms/cnn_ms/model/cnn.py
imports: from singa import layer
  from singa import model
label_desc: Use image node_id 3 for calling the CNN obj's underlying member method code with example usage: obj.train_one_batch(x, y, dist_option, spars) and returns: out,  loss