d95f630a7b7f88621bc4abb4ac92692647f03781,main.py,,train,#,213

Before Change


        // measure data loading time
        data_time.update(time.time() - end)
        target = target.cuda(async=True)
        input = [j.cuda() for j in input]
        input_var = torch.autograd.Variable(torch.cat(input,1))
        target_var = torch.autograd.Variable(target)

        // compute output
        output = model(input_var)
        if args.sparse:
            // Since Target pooling is not very precise when sparse,
            // take the highest resolution prediction and upsample it instead of downsampling target
            h, w = target_var.size()[-2:]
            output = [torch.nn.functional.upsample(output[0], (h,w)), *output[1:]]

        loss = multiscaleEPE(output, target_var, weights=args.multiscale_weights, sparse=args.sparse)
        flow2_EPE = args.div_flow * realEPE(output[0], target_var, sparse=args.sparse)
        // record loss and EPE
        losses.update(loss.data[0], target.size(0))
        train_writer.add_scalar("train_loss", loss.data[0], n_iter)
        flow2_EPEs.update(flow2_EPE.data[0], target.size(0))

        // compute gradient and do optimization step

After Change


        flow2_EPE = args.div_flow * realEPE(output[0], target, sparse=args.sparse)
        // record loss and EPE
        losses.update(loss.item(), target.size(0))
        train_writer.add_scalar("train_loss", loss.item(), n_iter)
        flow2_EPEs.update(flow2_EPE.item(), target.size(0))

        // compute gradient and do optimization step
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: ClementPinard/FlowNetPytorch
Commit Name: d95f630a7b7f88621bc4abb4ac92692647f03781
Time: 2018-08-23
Author: clement.pinard@parrot.com
File Name: main.py
Class Name:
Method Name: train


Project Name: ClementPinard/FlowNetPytorch
Commit Name: d95f630a7b7f88621bc4abb4ac92692647f03781
Time: 2018-08-23
Author: clement.pinard@parrot.com
File Name: main.py
Class Name:
Method Name: train


Project Name: bearpaw/pytorch-pose
Commit Name: 585303417c3f4641f61ac5a916a51505a67cc507
Time: 2019-01-24
Author: platero.yang@gmail.com
File Name: example/mscoco.py
Class Name:
Method Name: train


Project Name: bearpaw/pytorch-pose
Commit Name: 7ce6642f777e9da6249bd5b05330d57fa09ea37a
Time: 2019-01-07
Author: platero.yang@gmail.com
File Name: example/mpii.py
Class Name:
Method Name: train