9d6281d3b2f472e5e130dbf88078c433d0795f46,geomstats/_backend/pytorch/__init__.py,,all,#Any#Any#,228

Before Change


def all(x, axis=None):
    if axis is None and torch.is_tensor(x):
        return x.bool().all()
    numpy_result = _np.array(_np.all(_np.array(x), axis=axis))
    return torch.from_numpy(numpy_result)


def get_slice(x, indices):

After Change


    if isinstance(axis, int):
        return torch.all(x.bool(), axis)
    if len(axis) == 2:
        axis = list(axis)
        for i_axis, one_axis in enumerate(axis):
            if one_axis < 0:
                axis[i_axis] = ndim(x) + one_axis
        return torch.all(
            torch.all(x.bool(), axis[1]), axis[0])
    else:
        raise NotImplementedError(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: geomstats/geomstats
Commit Name: 9d6281d3b2f472e5e130dbf88078c433d0795f46
Time: 2020-04-24
Author: ninamio78@gmail.com
File Name: geomstats/_backend/pytorch/__init__.py
Class Name:
Method Name: all


Project Name: HazyResearch/fonduer
Commit Name: 5d4a480c48a242c1d8051be502ecb98a9b273e9c
Time: 2018-08-21
Author: hiromu.hota@hal.hitachi.com
File Name: tests/candidates/test_candidates.py
Class Name:
Method Name: test_ngram_split


Project Name: HazyResearch/fonduer
Commit Name: 766a673bf6bce5b6e238856aaae5f928687e9340
Time: 2018-02-07
Author: lwhsiao@stanford.edu
File Name: tests/test_parser.py
Class Name:
Method Name: test_parse_structure


Project Name: pantsbuild/pants
Commit Name: e3073f0fd4cc62fef7bfbca23ffd360e2d6c8a6a
Time: 2014-02-11
Author: jsirois@twitter.com
File Name: src/python/twitter/pants/commands/goal.py
Class Name: List
Method Name: execute