d495e481d8985ab0eedd17ebf6ced417fa6f03f2,official/nlp/tasks/tagging.py,TaggingTask,process_metrics,#TaggingTask#Any#Any#Any#,120

Before Change



  def process_metrics(self, metrics, labels, model_outputs):
    // `ignore_label_id` will not contribute to metrics.
    sample_weight = tf.cast(
        tf.not_equal(labels, self.task_config.ignore_label_id),
        dtype=tf.float32)
    for metric in metrics:
      metric.update_state(labels, model_outputs, sample_weight)

  def process_compiled_metrics(self, compiled_metrics, labels, model_outputs):

After Change


    return [tf.keras.metrics.SparseCategoricalAccuracy(name="accuracy")]

  def process_metrics(self, metrics, labels, model_outputs):
    masked_labels, masked_weights = _masked_labels_and_weights(labels)
    for metric in metrics:
      metric.update_state(masked_labels, model_outputs, masked_weights)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 6

Non-data size: 8

Instances


Project Name: tensorflow/models
Commit Name: d495e481d8985ab0eedd17ebf6ced417fa6f03f2
Time: 2020-06-24
Author: chendouble@google.com
File Name: official/nlp/tasks/tagging.py
Class Name: TaggingTask
Method Name: process_metrics


Project Name: tensorflow/models
Commit Name: d495e481d8985ab0eedd17ebf6ced417fa6f03f2
Time: 2020-06-24
Author: chendouble@google.com
File Name: official/nlp/tasks/tagging.py
Class Name: TaggingTask
Method Name: process_compiled_metrics


Project Name: tensorflow/models
Commit Name: d495e481d8985ab0eedd17ebf6ced417fa6f03f2
Time: 2020-06-24
Author: chendouble@google.com
File Name: official/nlp/tasks/tagging.py
Class Name: TaggingTask
Method Name: build_losses


Project Name: tensorflow/models
Commit Name: a5ec92c72595a7ee16c17cfda9b058b235fe0fca
Time: 2020-06-24
Author: chendouble@google.com
File Name: official/nlp/tasks/tagging.py
Class Name: TaggingTask
Method Name: build_losses


Project Name: tensorflow/models
Commit Name: a5ec92c72595a7ee16c17cfda9b058b235fe0fca
Time: 2020-06-24
Author: chendouble@google.com
File Name: official/nlp/tasks/tagging.py
Class Name: TaggingTask
Method Name: process_compiled_metrics


Project Name: tensorflow/models
Commit Name: a5ec92c72595a7ee16c17cfda9b058b235fe0fca
Time: 2020-06-24
Author: chendouble@google.com
File Name: official/nlp/tasks/tagging.py
Class Name: TaggingTask
Method Name: process_metrics