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

Before Change


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)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Next steps
// ----------

After Change


// one-hot encoding, and only the instructor (node 0) and the club president
// (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: 3

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: facebookresearch/Horizon
Commit Name: 45499cc575d9e555fd17605104cc2452698ecbad
Time: 2018-10-30
Author: jjg@fb.com
File Name: ml/rl/test/gym/gym_predictor.py
Class Name: GymDQNPredictor
Method Name: predict


Project Name: GPflow/GPflow
Commit Name: 2637c4a942f380aab9f893f29a87de053a01ff53
Time: 2017-10-27
Author: art.art.v@gmail.com
File Name: testing/test_hmc.py
Class Name: SampleGaussianTest
Method Name: test_mean_cov