code: def train(self):
      train_data, _, _, _, _, _ = load_data(self.dataset_filepath)
      dev = device.create_cuda_gpu_on(0)
      dev.SetRandSeed(0)
      np.random.seed(0)
  
      # sgd = opt.SGD(lr=self.learning_rate, momentum=0.9, weight_decay=1e-5)
      sgd = opt.Adam(lr=self.learning_rate)
  
      noise = tensor.Tensor(
          (self.batch_size, self.noise_size), dev, tensor.float32
      )
      real_images = tensor.Tensor(
          (self.batch_size, self.feature_size), dev, tensor.float32
      )
      real_labels = tensor.Tensor(
          (self.batch_size, 1), dev, tensor.float32
      )
      fake_labels = tensor.Tensor(
          (self.batch_size, 1), dev, tensor.float32
      )
  
      # attached model to graph
      self.model.set_optimizer(sgd)
      self.model.compile(
          [noise], is_train=True, use_graph=False, sequential=True
      )
  
      real_labels.set_value(1.0)
      fake_labels.set_value(0.0)
  
      for iteration in range(self.iterations):
          idx = np.random.randint(
              0, train_data.shape[0], self.batch_size
          )
          real_images.copy_from_numpy(train_data[idx])
  
          self.model.train()
  
          # Training the Discriminative Net
          _, d_loss_real = self.model.train_one_batch_dis(
              real_images, real_labels
          )
  
          noise.uniform(-1, 1)
          fake_images = self.model.forward_gen(noise)
          _, d_loss_fake = self.model.train_one_batch_dis(
              fake_images, fake_labels
          )
  
          d_loss = (
              tensor.to_numpy(d_loss_real)[0]
              + tensor.to_numpy(d_loss_fake)[0]
          )
  
          # Training the Generative Net
          noise.uniform(-1, 1)
          _, g_loss_tensor = self.model.train_one_batch(
              noise, real_labels
          )
  
          g_loss = tensor.to_numpy(g_loss_tensor)[0]
  
          if iteration % self.interval == 0:
              self.model.eval()
              self.save_image(iteration)
              print_log(
                  " The {} iteration, G_LOSS: {}, D_LOSS: {}".format(
                      iteration, g_loss, d_loss
                  )
              )
  
file_path: singa/examples/gan/vanilla.py
imports: from singa import device
  from singa import opt
  from singa import tensor
  import argparse
  import matplotlib.pyplot
  import numpy
  import os
  from model import gan_mlp
  from utils import load_data
  from utils import print_log
label_desc: Use image node_id 2 for calling the VANILLA obj's underlying member method code with example usage: obj.train() without return types