3e6bb1698d48305eb714f3b994317cd171e72b56,src/allennlp_mods/correlation.py,Correlation,__call__,#Correlation#Any#Any#,34

Before Change


        if isinstance(predictions, np.ndarray):
            predictions = predictions.tolist()
        if isinstance(labels, np.ndarray):
            labels = labels.tolist()

        if hasattr(self, "_per_batch_history"):
            batch_corr = self._correlation(labels, predictions)
            self._per_batch_history.append(batch_corr)

After Change


        if isinstance(predictions, torch.Tensor):
            predictions = predictions.cpu().numpy()
        if isinstance(labels, torch.Tensor):
            labels = labels.cpu().numpy()

        // Verify shape match
        assert predictions.shape == labels.shape, ("Predictions and labels must"
                                                   " have matching shape. Got:"
                                                   " preds=%s, labels=%s" % (
                                                       str(predictions.shape),
                                                       str(labels.shape)))
        predictions = list(predictions.flatten())
        labels = list(labels.flatten())

        if hasattr(self, "_per_batch_history"):
            batch_corr = self._correlation(labels, predictions)
            self._per_batch_history.append(batch_corr)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: jsalt18-sentence-repl/jiant
Commit Name: 3e6bb1698d48305eb714f3b994317cd171e72b56
Time: 2018-07-11
Author: iftenney@gmail.com
File Name: src/allennlp_mods/correlation.py
Class Name: Correlation
Method Name: __call__


Project Name: Alexander-H-Liu/End-to-end-ASR-Pytorch
Commit Name: e6b8c6626b374b3f33f2e7eeb251ace20048f250
Time: 2019-10-07
Author: alexliu36@gmail.com
File Name: src/decode.py
Class Name: BeamDecoder
Method Name: forward


Project Name: facebookresearch/Horizon
Commit Name: e3fcbb639e115e8afe9600bd06aee81acfda6704
Time: 2020-10-13
Author: czxttkl@fb.com
File Name: reagent/training/world_model/seq2reward_trainer.py
Class Name: Seq2RewardTrainer
Method Name: train