6ddf825a4aa1bcf3a35bba8d36bc433fe5ebaa39,torchsample/utils.py,,th_nearest_interp_2d,#Any#Any#,149
Before Change
yc = torch.clamp(coords[:,:,1], 0, input.size(2)-1)
// round to nearest coordinate
coords = torch.stack([xc.round().long(),
yc.round().long()], 2)
// gather image values at coordinates
mapped_vals = torch.stack([th_gather_nd(input[i], coords[i])
for i in range(input.size(0))], 0)
After Change
coords[:,1] = torch.clamp(coords[:,1], 0, input.size(2)-1).round()
stride = torch.FloatTensor(input.stride())[1:]
idx = coords.mv(stride).long()
input_flat = th_c_flatten(input)
mapped_vals = torch.stack([input_flat[i][idx]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
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: kevinzakka/recurrent-visual-attention
Commit Name: 84d32df24d9b88464ed851dadda9bdd74ad67c5a
Time: 2018-01-24
Author: kevinarmandzakka@gmail.com
File Name: tests/test_retina.py
Class Name:
Method Name: denormalize
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