62555a6f72e014341a1d85fccba799e7f35b4d63,OpenNMT/train.py,,memoryEfficientLoss,#Any#Any#Any#Any#Any#,124

Before Change


    outputs_rewrapped = Variable(outputs.data, requires_grad=(not eval), volatile=eval)

    batch_size = outputs.size(1)
    chunks = int(math.ceil(targets.size(0) / opt.max_generator_batches))
    outputs_chunked = torch.chunk(outputs_rewrapped, chunks)
    targets_chunked = torch.chunk(targets, chunks)
    for out_t, targ_t in zip(outputs_chunked, targets_chunked):
        out_t = out_t.view(-1, out_t.size(2))
        pred_t = generator(out_t)

After Change


    outputs= Variable(outputs.data, requires_grad=(not eval), volatile=eval)

    batch_size = outputs.size(1)
    outputs_split = torch.split(outputs, opt.max_generator_batches)
    targets_split = torch.split(targets, opt.max_generator_batches)
    for out_t, targ_t in zip(outputs_split, targets_split):
        out_t = out_t.view(-1, out_t.size(2))
        pred_t = generator(out_t)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: pytorch/examples
Commit Name: 62555a6f72e014341a1d85fccba799e7f35b4d63
Time: 2017-01-11
Author: alerer@fb.com
File Name: OpenNMT/train.py
Class Name:
Method Name: memoryEfficientLoss


Project Name: dmlc/dgl
Commit Name: 91cb347719da745fe0bd309607ce1c272604acdb
Time: 2021-03-09
Author: lygztq@gmail.com
File Name: examples/pytorch/diffpool/model/dgl_layers/gnn.py
Class Name: DiffPoolBatchedGraphLayer
Method Name: forward