4a6ed2b3964a1a8e6679b1d864bfa84504a196ac,inferno/trainers/basic.py,Trainer,get_current_learning_rate,#Trainer#,525

Before Change


    def get_current_learning_rate(self):
        learning_rate = self.optimizer.param_groups[0].get("lr", -1.)
        if torch.is_tensor(learning_rate):
            learning_rate = learning_rate[0]
        return learning_rate

    def cuda(self, devices=None):
        

After Change


            if there"s just one.
        
        learning_rate = [param_group.get("lr", -1.)
                         for param_group in self.optimizer.param_groups]
        learning_rate = [_learning_rate[0] if thu.is_tensor(_learning_rate) else _learning_rate
                         for _learning_rate in learning_rate]
        return pyu.from_iterable(learning_rate)

    def cuda(self, devices=None):
        
        Train on the GPU.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: inferno-pytorch/inferno
Commit Name: 4a6ed2b3964a1a8e6679b1d864bfa84504a196ac
Time: 2017-07-07
Author: nasim.rahaman@iwr.uni-heidelberg.de
File Name: inferno/trainers/basic.py
Class Name: Trainer
Method Name: get_current_learning_rate


Project Name: OpenNMT/OpenNMT-py
Commit Name: bc1351d47d9fe83bc6c7830a8563ddb874953ed4
Time: 2019-01-09
Author: benzurdopeters@gmail.com
File Name: onmt/train_single.py
Class Name:
Method Name: main


Project Name: pantsbuild/pants
Commit Name: 705a3dcb90454c2d6ab2a857ac0b88dff2ef0bab
Time: 2020-08-16
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/core/goals/lint.py
Class Name:
Method Name: lint