914192dda940237aaf47130e5511bb929cd776b7,torchsample/utils.py,,th_gather_nd,#Any#Any#,252
Before Change
if coords.size(1) != x.dim():
raise ValueError("Coords must have column for each image dim")
inds = coords[:,0 ]*x.size(1)
for i in range(x.dim()-2):
inds += coords[:,i +1]*x.size(i+2)
inds += coords[:,-1]
x_gather = torch.index_select(th_flatten(x), 0, inds)
return x_gather
After Change
def th_gather_nd(x, coords):
inds = coords.mv(torch.LongTensor(x.stride()))
x_gather = torch.index_select(th_flatten(x), 0, inds)
return x_gather
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances Project Name: ncullen93/torchsample
Commit Name: 914192dda940237aaf47130e5511bb929cd776b7
Time: 2017-04-23
Author: ncullen@Nicks-MacBook-Pro.local
File Name: torchsample/utils.py
Class Name:
Method Name: th_gather_nd
Project Name: markovmodel/PyEMMA
Commit Name: 6379ad6fad9cd3c944390538faf945fdc8662b35
Time: 2017-12-15
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/serialization/tests/_test_classes.py
Class Name: test_cls_v3
Method Name: test_cls_v3_1
Project Name: markovmodel/PyEMMA
Commit Name: 6379ad6fad9cd3c944390538faf945fdc8662b35
Time: 2017-12-15
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/serialization/tests/_test_classes.py
Class Name: test_cls_v2
Method Name: test_cls_v2_1