(features, outputs)
return (_create_generative_metrics,
          [features["targets"], weights, outputs["logits"]])
Get eval metrics for estimator.
Get eval metrics for estimator.
Get eval metrics for estimator .
def gen_eval_metrics_fn(features, outputs):
  """Get eval metrics for estimator."""
  weights = features.get("targets_mask", None)
  if weights is None:
    weights = 1.0 - tf.cast(tf.equal(features["targets"], 0), tf.float32)
  else:
    weights = tf.cast(weights, tf.float32)
  return (_create_generative_metrics,
          [features["targets"], weights, outputs["logits"]])
def gen_eval_metrics_fn ( features , outputs ) : weights = features . get ( "targets_mask" , None ) if weights is None : weights = 1.0 - tf . cast ( tf . equal ( features [ "targets" ] , 0 ) , tf . float32 ) else : weights = tf . cast ( weights , tf . float32 ) return ( _create_generative_metrics , [ features [ "targets" ] , weights , outputs [ "logits" ] ] )