class_docstr: Wrapper around tensorflow optimizer.
class_docstr_tok: ["Wrapper","around","tensorflow","optimizer","."]
docstr: Minimizes the loss with respect to entity and relation embeddings and other trainable variables.
  
  Parameters
  ----------
  loss: tf.Tensor
      Model Loss.
  ent_emb: tf.Variable
      Entity embedding.
  rel_emb: tf.Variable
      Relation embedding.
  gradient tape: tf.GradientTape
      Gradient tape under which the loss computation was tracked.
  other_vars: list
      List of all the other trainable variables.
docstr_tok: ["Minimizes","the","loss","with","respect","to","entity","and","relation","embeddings","and","other","trainable","variables",".","Parameters","--","--","--","--","--","loss",":","tf.Tensor","Model","Loss",".","ent_emb",":","tf.Variable","Entity","embedding",".","rel_emb",":","tf.Variable","Relation","embedding",".","gradient","tape",":","tf.GradientTape","Gradient","tape","under","which","the","loss","computation","was","tracked",".","other_vars",":","list","List","of","all","the","other","trainable","variables","."]
code: def minimize(
      self, loss, ent_emb, rel_emb, gradient_tape, other_vars=[]
  ):
      """Minimizes the loss with respect to entity and relation embeddings and other trainable variables.
  
      Parameters
      ----------
      loss: tf.Tensor
          Model Loss.
      ent_emb: tf.Variable
          Entity embedding.
      rel_emb: tf.Variable
          Relation embedding.
      gradient tape: tf.GradientTape
          Gradient tape under which the loss computation was tracked.
      other_vars: list
          List of all the other trainable variables.
      """
      all_trainable_vars = [ent_emb, rel_emb]
      all_trainable_vars.extend(other_vars)
      # Total number of trainable variables in the graph
      self.num_optimized_vars = len(all_trainable_vars)
  
      if self.gpu_workaround:
          # workaround - see the issue:
          # https://github.com/tensorflow/tensorflow/issues/28090
          with gradient_tape:
              loss += 0.0000 * (
                  tf.reduce_sum(ent_emb) + tf.reduce_sum(rel_emb)
              )
  
      # Compute gradient of loss wrt trainable vars
      gradients = gradient_tape.gradient(loss, all_trainable_vars)
      # update the trainable params
      self.optimizer.apply_gradients(zip(gradients, all_trainable_vars))
  
file_path: AmpliGraph/ampligraph/latent_features/optimizers.py
imports: import abc
  import logging
  import six
  import tensorflow
label_desc: Use image node_id 4 for calling the OptimizerWrapper obj's underlying member method code with example usage: obj.minimize(loss, ent_emb, rel_emb, gradient_tape, other_vars) without return types