class_docstr: Interface for the head/top of a ranking model.
class_docstr_tok: ["Interface","for","the","head\/top","of","a","ranking","model","."]
docstr: Returns a loss Tensor from provided logits.
  
  This function is designed to be used by framework developers.  Almost all
  users should use create_estimator_spec(), which calls this internally.
  `mode` and `features` are most likely not used, but some Head
  implementations may require them.
  
  Args:
    features: Input `dict` of `Tensor` objects.
    mode: Estimator's `ModeKeys`.
    logits: logits `Tensor` to be used for loss construction.
    labels: Labels `Tensor`, or `dict` of same.
  
  Returns:
    A LossSpec object.
docstr_tok: ["Returns","a","loss","Tensor","from","provided","logits",".","This","function","is","designed","to","be","used","by","framework","developers",".","Almost","all","users","should","use","create_estimator_spec","(",")",",","which","calls","this","internally",".","`","mode","`","and","`","features","`","are","most","likely","not","used",",","but","some","Head","implementations","may","require","them",".","Args",":","features",":","Input","`","dict","`","of","`","Tensor","`","objects",".","mode",":","Estimator","'s","`","ModeKeys","`",".","logits",":","logits","`","Tensor","`","to","be","used","for","loss","construction",".","labels",":","Labels","`","Tensor","`",",","or","`","dict","`","of","same",".","Returns",":","A","LossSpec","object","."]
code: def create_loss(self, features, mode, logits, labels):
      """Returns a loss Tensor from provided logits.
  
      This function is designed to be used by framework developers.  Almost all
      users should use create_estimator_spec(), which calls this internally.
      `mode` and `features` are most likely not used, but some Head
      implementations may require them.
  
      Args:
        features: Input `dict` of `Tensor` objects.
        mode: Estimator's `ModeKeys`.
        logits: logits `Tensor` to be used for loss construction.
        labels: Labels `Tensor`, or `dict` of same.
  
      Returns:
        A LossSpec object.
      """
      del mode  # Unused for this head.
      logits = tf.convert_to_tensor(value=logits)
      if isinstance(labels, dict):
          for name, label in six.iteritems(labels):
              labels[name] = tf.cast(label, dtype=tf.float32)
      else:
          labels = tf.cast(labels, dtype=tf.float32)
  
      training_loss = self._loss_fn(labels, logits, features)
  
      return training_loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import six
  import tensorflow
  from tensorflow import estimator
label_desc: Use image node_id 3 for calling the _RankingHead obj's underlying member method code with example usage: obj.create_loss(features, mode, logits, labels) and returns: training_loss