code: def _make_loss_fn(weights_feature_name=None):
      """Make a fake loss function."""
  
      def _loss_fn(labels, logits, features):
          """A fake loss function."""
          logits = tf.convert_to_tensor(value=logits)
          labels = tf.cast(labels, dtype=tf.float32)
          weights = (
              features[weights_feature_name]
              if weights_feature_name is not None
              else 1.0
          )
          loss = tf.reduce_sum(
              input_tensor=logits - labels
          ) * tf.reduce_sum(input_tensor=weights)
          return loss
  
      return _loss_fn
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow import estimator
  from tensorflow_ranking.python import head
  from tensorflow_ranking.python import metrics
label_desc: Use image node_id 2 for calling a global function with example usage: _make_loss_fn(weights_feature_name) and returns: _loss_fn, loss