afaf4383126b25be6ed427c0f3626ae09ae35b45,torchsample/utils.py,,th_meshgrid,#,61

Before Change




def th_meshgrid(*args):
    pools = (torch.range(0,i-1) for i in args)
    result = [[]]
    for pool in pools:
        result = [x+[y] for x in result for y in pool]
    return torch.Tensor(result).long()

After Change


    dtype = torch.LongTensor
    pools = []
    for i in args:
        if isinstance(i, int):
            pools.append(torch.range(0, i-1))
        else:
            if type(i) != torch.LongTensor:
                dtype = i.type()
            pools.append(i)
    result = [[]]
    for pool in pools:
        result = [x+[y] for x in result for y in pool]
    return torch.Tensor(result).type(dtype)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: ncullen93/torchsample
Commit Name: afaf4383126b25be6ed427c0f3626ae09ae35b45
Time: 2017-04-23
Author: ncullen@Nicks-MacBook-Pro.local
File Name: torchsample/utils.py
Class Name:
Method Name: th_meshgrid


Project Name: biolab/orange3
Commit Name: fba0fc9d72e984e73c8ed0de1e57bc37bbe8f676
Time: 2018-03-23
Author: ales.erjavec@fri.uni-lj.si
File Name: Orange/statistics/util.py
Class Name:
Method Name: _count_nans_per_row_sparse


Project Name: pantsbuild/pants
Commit Name: e8ccd90f029a17d1822c37ebe259d77243fe2e67
Time: 2019-03-05
Author: 1305167+cosmicexplorer@users.noreply.github.com
File Name: src/python/pants/engine/selectors.py
Class Name: Get
Method Name: __new__