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]
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: 4
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: ncullen93/torchsample
Commit Name: 6ddf825a4aa1bcf3a35bba8d36bc433fe5ebaa39
Time: 2017-04-24
Author: ncullen@Nicks-MacBook-Pro.local
File Name: torchsample/utils.py
Class Name:
Method Name: th_nearest_interp_2d
Project Name: ncullen93/torchsample
Commit Name: 6ddf825a4aa1bcf3a35bba8d36bc433fe5ebaa39
Time: 2017-04-24
Author: ncullen@Nicks-MacBook-Pro.local
File Name: torchsample/utils.py
Class Name:
Method Name: th_nearest_interp_3d