class_docstr: KG embedding trainer object.
docstr: Compute training loss and back-propagate gradients.
  
  Args:
    model: tf.keras.Model KG embedding model.
    examples: tf.data.Dataset containing KG training triples.
  
  Returns:
    Average training loss.
docstr_tok: ["Compute","training","loss","and","back-propagate","gradients",".","Args",":","model",":","tf.keras.Model","KG","embedding","model",".","examples",":","tf.data.Dataset","containing","KG","training","triples",".","Returns",":","Average","training","loss","."]
code: def train_step(self, model, examples):
      """Compute training loss and back-propagate gradients.
  
      Args:
        model: tf.keras.Model KG embedding model.
        examples: tf.data.Dataset containing KG training triples.
  
      Returns:
        Average training loss.
      """
      total_loss = tf.keras.backend.constant(0.0)
      counter = tf.keras.backend.constant(0.0)
      for input_batch in examples:
          counter += 1.0
          with tf.GradientTape() as tape:
              loss = self.loss_fn.calculate_loss(model, input_batch)
          gradients = zip(
              tape.gradient(loss, model.trainable_variables),
              model.trainable_variables,
          )
          self.optimizer.apply_gradients(gradients)
          total_loss += loss
      return total_loss / counter
  
file_path: neural-structured-learning/research/kg_hyp_emb/learning/trainer.py
imports: from kg_hyp_emb.learning import losses
  import tensorflow
label_desc: Use image node_id 4 for calling the KGTrainer obj's underlying member method code with example usage: obj.train_step(model, examples) and returns: unknown