7156c7163b046686064d7c9de445041870e672bc,tutorials/1_first.py,,,#,136

Before Change


graph_sum = readout(g_boring)
print("graph sum after send() and recv() is: ", graph_sum)

g_better = an_interesting_graph()
graph_sum = readout(g_better)
print("graph sum before send() and recv() is: ", graph_sum)
super_useful_comp(g_better)
graph_sum = readout(g_better)
print("graph sum after send() and recv() is: ", graph_sum)

After Change


// (node 33) are labeled.

inputs = torch.eye(34)
labeled_nodes = torch.tensor([0, 33])  // only the instructor and the president nodes are labeled
labels = torch.tensor([0, 1])  // their labels are different

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The training loop is no fancier than other NN models. We (1) create an optimizer,
// (2) feed the inputs to the model, (3) calculate the loss and (4) use autograd
// to optimize the model.

optimizer = torch.optim.Adam(net.parameters(), lr=0.01)
all_logits = []
for epoch in range(30):
    logits = net(G, inputs)
    // we save the logits for visualization later
    all_logits.append(logits.detach())
    logp = F.log_softmax(logits, 1)
    // we only compute loss for labeled nodes
    loss = F.nll_loss(logp[labeled_nodes], labels)

    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: dmlc/dgl
Commit Name: 7156c7163b046686064d7c9de445041870e672bc
Time: 2018-12-01
Author: minjie.wang@nyu.edu
File Name: tutorials/1_first.py
Class Name:
Method Name:


Project Name: dmlc/dgl
Commit Name: ff345c2e2210061141653a19ef1431c6866cbf68
Time: 2021-02-03
Author: wcy_james@outlook.com
File Name: examples/pytorch/pointcloud/pointnet/train_partseg.py
Class Name:
Method Name:


Project Name: SPFlow/SPFlow
Commit Name: 8406abaa40c9d42e4528285024a7b3ba7596a1e6
Time: 2018-06-10
Author: molina@cs.tu-darmstadt.de
File Name: src/spn/gpu/Pytorch.py
Class Name:
Method Name: