def oov_metric(self, word_ids):
    """Metric for checking the OOV rate.

    Args:
      word_ids: int32 Tensor of arbitrary shape with word indices.

    Returns:
      metric: A metric computing the OOV rate. For use with tf.Estimator.
    """
    return tf.metrics.mean(tf.to_float(tf.greater(
        word_ids, len(self._idx2str) - 1)))
Metric for checking the OOV rate.

    Args:
      word_ids: int32 Tensor of arbitrary shape with word indices.

    Returns:
      metric: A metric computing the OOV rate. For use with tf.Estimator.
    
language/common/inputs/embedding_utils.py