2c01aa22c697b4326db05b7729f85613ebb8a8a0,torch_geometric/utils/one_hot.py,,one_hot,#Any#Any#Any#,4

Before Change


    if num_classes is None:
        num_classes = src.max(dim=0)[0] + 1
    elif isinstance(num_classes, int) or isinstance(num_classes, float):
        num_classes = torch.tensor(int(num_classes))

    if src.size(1) > 1:
        zero = torch.tensor([0], device=src.device)
        src = src + torch.cat([zero, torch.cumsum(num_classes, 0)[:-1]])

After Change


    if num_classes is None:
        num_classes = src.max(dim=0)[0] + 1
    else:
        num_classes = torch.tensor(
            repeat(num_classes, length=src.size(1)),
            dtype=torch.long,
            device=src.device)

    if src.size(1) > 1:
        zero = torch.tensor([0], device=src.device)
        src = src + torch.cat([zero, torch.cumsum(num_classes, 0)[:-1]])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: rusty1s/pytorch_geometric
Commit Name: 2c01aa22c697b4326db05b7729f85613ebb8a8a0
Time: 2018-12-28
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/utils/one_hot.py
Class Name:
Method Name: one_hot


Project Name: rusty1s/pytorch_geometric
Commit Name: b2002a8ef80ecbecee09fd61b910c987648455c7
Time: 2020-08-26
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/datasets/karate.py
Class Name: KarateClub
Method Name: __init__


Project Name: facebookresearch/pytext
Commit Name: 8f54218a8ed67dc6c3df585ff89777b1e2bb2c26
Time: 2019-12-06
Author: hyzhan@fb.com
File Name: pytext/optimizer/sparsifiers/tests/sparsifier_test.py
Class Name: TestSparsifier
Method Name: test_param_mask_with_pre_mask