MCPcopy Create free account
hub / github.com/PyGCL/PyGCL / train

Function train

examples/DGI_transductive.py:54–61  ·  view source on GitHub ↗
(encoder_model, contrast_model, data, optimizer)

Source from the content-addressed store, hash-verified

52
53
54def train(encoder_model, contrast_model, data, optimizer):
55 encoder_model.train()
56 optimizer.zero_grad()
57 z, g, zn = encoder_model(data.x, data.edge_index)
58 loss = contrast_model(h=z, g=g, hn=zn)
59 loss.backward()
60 optimizer.step()
61 return loss.item()
62
63
64def test(encoder_model, data):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected