0e8ec93b28ecd86898b3668d48d346f510e95167,pl_examples/domain_templates/computer_vision_fine_tuning.py,TransferLearningModel,validation_epoch_end,#TransferLearningModel#Any#,308

Before Change


                                     for output in outputs]).mean()
        val_acc_mean = torch.stack([output["num_correct"]
                                    for output in outputs]).sum().float()
        val_acc_mean /= (len(outputs) * self.batch_size)
        return {"log": {"val_loss": val_loss_mean,
                        "val_acc": val_acc_mean,
                        "step": self.current_epoch}}

    def configure_optimizers(self):
        optimizer = optim.Adam(filter(lambda p: p.requires_grad,
                                      self.parameters()),

After Change


        Compute and log validation loss and accuracy at the epoch level.

        val_loss_mean = torch.stack([output["val_loss"] for output in outputs]).mean()
        train_acc_mean = self.valid_acc.compute()
        log_dict = {"val_loss": val_loss_mean, "val_acc": train_acc_mean}
        self.log_dict(log_dict, prog_bar=True)
        self.log_dict({"step": self.current_epoch})
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: williamFalcon/pytorch-lightning
Commit Name: 0e8ec93b28ecd86898b3668d48d346f510e95167
Time: 2021-01-06
Author: jspaezp@users.noreply.github.com
File Name: pl_examples/domain_templates/computer_vision_fine_tuning.py
Class Name: TransferLearningModel
Method Name: validation_epoch_end


Project Name: mlflow/mlflow
Commit Name: cb480110539e737e3e1537905e69245ceda7a3db
Time: 2021-02-03
Author: 51693147+ankan94@users.noreply.github.com
File Name: tests/pytorch/iris.py
Class Name: IrisClassification
Method Name: test_step


Project Name: williamFalcon/pytorch-lightning
Commit Name: 0e8ec93b28ecd86898b3668d48d346f510e95167
Time: 2021-01-06
Author: jspaezp@users.noreply.github.com
File Name: pl_examples/domain_templates/computer_vision_fine_tuning.py
Class Name: TransferLearningModel
Method Name: training_epoch_end