a0cf5566d88533c5caa7a490beb6eb0760eee9b4,torch/optim/sgd.py,SGD,step,#SGD#Any#,76

Before Change


                if momentum != 0:
                    param_state = self.state[p]
                    if "momentum_buffer" not in param_state:
                        buf = param_state["momentum_buffer"] = torch.clone(d_p).detach()
                    else:
                        buf = param_state["momentum_buffer"]
                        buf.mul_(momentum).add_(d_p, alpha=1 - dampening)

After Change



        for group in self.param_groups:
            params_with_grad = []
            d_p_list = []
            momentum_buffer_list = []
            weight_decay = group["weight_decay"]
            momentum = group["momentum"]
            dampening = group["dampening"]
            nesterov = group["nesterov"]
            lr = group["lr"]

            for p in group["params"]:
                if p.grad is not None:
                    params_with_grad.append(p)
                    d_p_list.append(p.grad)

                    state = self.state[p]
                    if "momentum_buffer" not in state:
                        momentum_buffer_list.append(None)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pytorch/pytorch
Commit Name: a0cf5566d88533c5caa7a490beb6eb0760eee9b4
Time: 2021-01-21
Author: wanchaol@users.noreply.github.com
File Name: torch/optim/sgd.py
Class Name: SGD
Method Name: step


Project Name: LxMLS/lxmls-toolkit
Commit Name: c369f370ecc1d424782c12fa1310049a70c7f330
Time: 2018-01-30
Author: ramon@astudillo.com
File Name: lxmls/deep_learning/pytorch_models/rnn.py
Class Name: PytorchRNN
Method Name: _log_forward


Project Name: Theano/Theano
Commit Name: 996d737eaad2a85cda13954efa5b066ade1e678d
Time: 2017-02-09
Author: nouiz@nouiz.org
File Name: theano/scan_module/scan_utils.py
Class Name:
Method Name: forced_replace