class_docstr: Base class for models
class_docstr_tok: ["Base","class","for","models"]
docstr: Construct gradient descent based optimization step
  In this step, we provide gradient clipping option. Sometimes we what to clip the gradients
  when their absolute values are too large to avoid gradient explosion.
  
  Returns:
      object: An operation that applies the specified optimization step.
docstr_tok: ["Construct","gradient","descent","based","optimization","step","In","this","step",",","we","provide","gradient","clipping","option",".","Sometimes","we","what","to","clip","the","gradients","when","their","absolute","values","are","too","large","to","avoid","gradient","explosion",".","Returns",":","object",":","An","operation","that","applies","the","specified","optimization","step","."]
code: def _build_train_opt(self):
      """Construct gradient descent based optimization step
      In this step, we provide gradient clipping option. Sometimes we what to clip the gradients
      when their absolute values are too large to avoid gradient explosion.
  
      Returns:
          object: An operation that applies the specified optimization step.
      """
      train_step = self._train_opt()
      gradients, variables = zip(
          *train_step.compute_gradients(self.loss)
      )
      if self.hparams.is_clip_norm:
          gradients = [
              None
              if gradient is None
              else tf.clip_by_norm(gradient, self.hparams.max_grad_norm)
              for gradient in gradients
          ]
      return train_step.apply_gradients(zip(gradients, variables))
  
imports: from os.path import join
  import abc
  import time
  import os
  import numpy
  import tensorflow
  from recommenders.models.deeprec.deeprec_utils import cal_metric
label_desc: Use image node_id 13 for calling the BaseModel obj's underlying member method code with example usage: obj._build_train_opt() and returns: train_step