3d054be72e81af7acb1109028d7be4fceebae720,train.py,,train,#,18

Before Change


                S2 = S2.cuda()
                labels = labels.cuda()
            // Wrap to autograd.Variable
            X, S1 = Variable(X), Variable(S1)
            S2, labels = Variable(S2), Variable(labels)
            // Zero the parameter gradients
            optimizer.zero_grad()

After Change


            if X.size()[0] != config.batch_size:
                continue  // Drop those data, if not enough for a batch
            // Automaticlly select device to make the code device agnostic 
            device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
            X = X.to(device)
            S1 = S1.to(device)
            S2 = S2.to(device)
            labels = labels.to(device)
            net = net.to(device)
            // Zero the parameter gradients
            optimizer.zero_grad()
            // Forward pass
            outputs, predictions = net(X, S1, S2, config)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: kentsommer/pytorch-value-iteration-networks
Commit Name: 3d054be72e81af7acb1109028d7be4fceebae720
Time: 2019-12-31
Author: kelvinson@foxmail.com
File Name: train.py
Class Name:
Method Name: train


Project Name: eriklindernoren/PyTorch-YOLOv3
Commit Name: ac7bb33dd978e2bf6ecb0cf055dd6bf6c9c1ea05
Time: 2019-04-19
Author: eriklindernoren@live.se
File Name: train.py
Class Name:
Method Name:


Project Name: kentsommer/pytorch-value-iteration-networks
Commit Name: 3d054be72e81af7acb1109028d7be4fceebae720
Time: 2019-12-31
Author: kelvinson@foxmail.com
File Name: train.py
Class Name:
Method Name: test