f466871be6ee80533c997cf6c958aa41a697936f,trainer.py,Trainer,train_one_epoch,#Trainer#Any#,137

Before Change


            img, target = Variable(img), Variable(target)

            // initialize location and hidden state vectors
            h_t = torch.zeros(self.batch_size, self.hidden_size)
            l_t = torch.Tensor(self.batch_size, 2).uniform_(-1, 1)
            h_t, l_t = Variable(h_t), Variable(l_t)

            for t in range(self.num_glimpses - 1):
                // forward pass through model
                h_t, l_t = self.model(img, l_t, h_t)

                // bookeeping for later plotting
                self.locs.append(l_t)

            // last iteration
            probas = self.model(img, l_t, h_t, last=True)

            // to be continued

After Change


            )

            // calculate reward
            R = (torch.max(log_probas, 1)[1] == y)

            // compute losses for differentiable modules
            self.loss_action = F.nll_loss(log_probas, y)
            self.loss_baseline = F.mse_loss(R, b_t)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: kevinzakka/recurrent-visual-attention
Commit Name: f466871be6ee80533c997cf6c958aa41a697936f
Time: 2018-01-22
Author: kevinarmandzakka@gmail.com
File Name: trainer.py
Class Name: Trainer
Method Name: train_one_epoch


Project Name: explosion/thinc
Commit Name: b8b71c4fbab9bd9e6a34a18a65474cc1035699de
Time: 2017-01-07
Author: honnibal+gh@gmail.com
File Name: thinc/neural/ops.py
Class Name: Ops
Method Name: softmax


Project Name: AIRLab-POLIMI/mushroom
Commit Name: 76b6bcace9245a57f439d39deac653e2384a645b
Time: 2017-07-20
Author: carlo.deramo@gmail.com
File Name: PyPi/utils/dataset.py
Class Name:
Method Name: max_QA