8e71b64e2af321361217a621a89fb923ea0f984d,examples/pytorch/gat/gat.py,,main,#Any#,134

Before Change


    labels = []
    train_nodes = []
    for n in data.graph.nodes():
        features[n] = torch.FloatTensor(data.features[n, :])
        if data.train_mask[n] == 1:
            train_nodes.append(n)
            labels.append(data.labels[n])

After Change



    features = torch.FloatTensor(data.features)
    labels = torch.LongTensor(data.labels)
    mask = torch.ByteTensor(data.train_mask)
    in_feats = features.shape[1]
    n_classes = data.num_labels
    n_edges = data.graph.number_of_edges()

    if args.gpu < 0:
        cuda = False
    else:
        cuda = True
        torch.cuda.set_device(args.gpu)
        features = features.cuda()
        labels = labels.cuda()
        mask = mask.cuda()

    // create GCN model
    g = DGLGraph(data.graph)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: dmlc/dgl
Commit Name: 8e71b64e2af321361217a621a89fb923ea0f984d
Time: 2018-10-03
Author: wmjlyjemaine@gmail.com
File Name: examples/pytorch/gat/gat.py
Class Name:
Method Name: main


Project Name: dmlc/dgl
Commit Name: fde4f581d219e0d25148ffb0f8c44d6848032b53
Time: 2018-10-03
Author: wmjlyjemaine@gmail.com
File Name: examples/pytorch/gcn/gcn.py
Class Name:
Method Name: main


Project Name: pytorch/fairseq
Commit Name: 48d9afbeb37584586411c3d8e53d91228528dec4
Time: 2019-03-14
Author: myleott@fb.com
File Name: fairseq/distributed_utils.py
Class Name:
Method Name: all_gather_list