fde4f581d219e0d25148ffb0f8c44d6848032b53,examples/pytorch/gcn/gcn.py,,main,#Any#,63

Before Change


    // features of each samples
    features = {}
    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])
    labels = torch.LongTensor(labels)
    in_feats = data.features.shape[1]
    n_classes = data.num_labels
    n_edges = data.graph.number_of_edges()

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)
    model = GCN(g,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


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: rusty1s/pytorch_geometric
Commit Name: e2db3b3f1d3d23cd5bc1e295835e0f4b33e95447
Time: 2018-03-07
Author: matthias.fey@tu-dortmund.de
File Name: examples/cora_gcn.py
Class Name:
Method Name:


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