code: def train_step(X_batch, y_batch):
      with tf.GradientTape() as tape:
          _out1, _out2 = model([X_batch[:, 0, :], X_batch[:, 1, :]])
          _loss = contrastive_loss(y_batch, _out1, _out2)
  
      grad = tape.gradient(_loss, train_weights)
      optimizer.apply_gradients(zip(grad, train_weights))
  
      _acc = compute_accuracy(y_batch, _out1, _out2)
      return _loss, _acc
  
file_path: TensorLayer/examples/basic_tutorials/tutorial_mnist_siamese.py
imports: import random
  import time
  import numpy
  import tensorflow
  import tensorlayer
  from tensorlayer.layers import Dense, Dropout, Flatten, Input
  from tensorlayer.models import Model
label_desc: Use image node_id 6 for calling a global function with example usage: train_step(X_batch, y_batch) and returns: _loss,  _acc