parameters: (self, logits, target, features)
docstring: Returns loss tensor for this head.
  
      Args:
        logits: logits, a float tensor.
        target: either a tensor for labels or in multihead case, a dict of string
          to target tensor.
        features: features dict.
  
      Returns:
        Loss tensor.
docstring_summary: Returns loss tensor for this head.
docstring_tokens: Returns loss tensor for this head .
function: def loss(self, logits, target, features):
      """Returns loss tensor for this head.
  
      Args:
        logits: logits, a float tensor.
        target: either a tensor for labels or in multihead case, a dict of string
          to target tensor.
        features: features dict.
  
      Returns:
        Loss tensor.
      """
      target = target[self.name] if isinstance(target, dict) else target
      loss_unweighted = self._loss_fn(logits, target)
  
      weight_tensor = self.get_weight_tensor(features)
      if weight_tensor is None:
        return math_ops.reduce_mean(loss_unweighted, name="loss")
      else:
        loss_unweighted = array_ops.reshape(loss_unweighted, shape=(-1,))
        loss_weighted = math_ops.mul(
            loss_unweighted,
            array_ops.reshape(weight_tensor, shape=(-1,)))
        return math_ops.div(
            math_ops.reduce_sum(loss_weighted),
            math_ops.to_float(math_ops.reduce_sum(weight_tensor)),
            name="loss")
function_tokens: def loss ( self , logits , target , features ) : target = target [ self . name ] if isinstance ( target , dict ) else target loss_unweighted = self . _loss_fn ( logits , target ) weight_tensor = self . get_weight_tensor ( features ) if weight_tensor is None : return math_ops . reduce_mean ( loss_unweighted , name = "loss" ) else : loss_unweighted = array_ops . reshape ( loss_unweighted , shape = ( - 1 , ) ) loss_weighted = math_ops . mul ( loss_unweighted , array_ops . reshape ( weight_tensor , shape = ( - 1 , ) ) ) return math_ops . div ( math_ops . reduce_sum ( loss_weighted ) , math_ops . to_float ( math_ops . reduce_sum ( weight_tensor ) ) , name = "loss" )