18fb9b3d96be393221b27c31ba260c0972ea2014,geomstats/backend/pytorch/random.py,,choice,#Any#Any#Any#Any#,22

Before Change


    if size is None:
        size_prod = 1
    if ~isinstance(size, int):
        size_prod = torch.prod(torch.Tensor(size))

    if p is None:
        p = torch.ones_like(a) / len(a)

After Change


        size_prod = 1

    elif not isinstance(size, int):
        size_prod = int(torch.prod(torch.Tensor(size)).item())

    if p is None:
        p = torch.ones_like(a) / float(len(a))
    sample = a[torch.multinomial(p, size_prod, replacement=replace)]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: geomstats/geomstats
Commit Name: 18fb9b3d96be393221b27c31ba260c0972ea2014
Time: 2020-01-17
Author: thomas.l.p.gerald@gmail.com
File Name: geomstats/backend/pytorch/random.py
Class Name:
Method Name: choice


Project Name: silvandeleemput/memcnn
Commit Name: 85e122c91e6f85e9a73e769034465d8e8919076e
Time: 2019-05-28
Author: silvandeleemput@gmail.com
File Name: memcnn/models/affine.py
Class Name: AffineBlockFunction2
Method Name: backward


Project Name: silvandeleemput/memcnn
Commit Name: 85e122c91e6f85e9a73e769034465d8e8919076e
Time: 2019-05-28
Author: silvandeleemput@gmail.com
File Name: memcnn/models/affine.py
Class Name: AffineBlockFunction
Method Name: backward