98e790696877d8065842d83f1819ae9c989a8c98,memcnn/models/revop.py,ReversibleBlockFunction,backward,#Any#Any#,117
Before Change
z1_stop = Variable(y1.data, requires_grad=True)
G_z1 = Gm.forward(z1_stop)
x2 = y2 - G_z1
x2_stop = Variable(x2.data, requires_grad=True)
F_x2 = Fm.forward(x2_stop)
x1 = y1 - F_x2
x1_stop = Variable(x1.data, requires_grad=True)
// Compute outputs building a sub-graph
z1 = x1_stop + F_x2
y2_ = x2_stop + G_z1
y1_ = z1
// Perform full backward pass on graph...
y = torch.cat([y1_, y2_], dim=1)
dd = torch.autograd.grad(y, (x1_stop, x2_stop) + tuple(Gm.parameters()) + tuple(Fm.parameters()), grad_output, retain_graph=False)
After Change
// compute outputs building a sub-graph
x1_, x2_ = torch.chunk(x_stop, chunks=2, dim=1)
y1_ = x1_ + Fm.forward(x2_)
y2_ = x2_ + Gm.forward(y1_)
y = torch.cat([y1_, y2_], dim=1)
// perform full backward pass on graph...
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: silvandeleemput/memcnn
Commit Name: 98e790696877d8065842d83f1819ae9c989a8c98
Time: 2018-06-06
Author: sil.vandeleemput@radboudumc.nl
File Name: memcnn/models/revop.py
Class Name: ReversibleBlockFunction
Method Name: backward
Project Name: elbayadm/attn2d
Commit Name: 6e4b7e22eeb79f7e1c39d862f10ec3e61e51c979
Time: 2017-11-08
Author: myleott@fb.com
File Name: fairseq/sequence_generator.py
Class Name: SequenceGenerator
Method Name: _decode