Created
January 6, 2022 15:34
-
-
Save eileen-code4fun/5b630eedc2f1bb9c399170f567633d8c to your computer and use it in GitHub Desktop.
GCN Training
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for epoch in range(20): | |
with tf.GradientTape() as tape: | |
logits = g_model(g.ndata['feat']) | |
# Loss is only calculated on the training set. | |
loss = loss_fcn(g.ndata['label'][g.ndata['train_mask']], logits[g.ndata['train_mask']]) | |
grads = tape.gradient(loss, g_model.trainable_weights) | |
opt.apply_gradients(zip(grads, g_model.trainable_weights)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment