Skip to content

Commit 60db1b4

Browse files
author
fengshikun01
committed
fix deeper_gcn
1 parent fb2940a commit 60db1b4

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

examples/deeper_gcn/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ The datasets contain three citation networks: CORA, PUBMED, CITESEER. The detail
1212
- paddlepaddle>=1.6
1313
- pgl
1414

15+
### Performance
16+
17+
We train our models for 200 epochs and report the accuracy on the test dataset.
18+
19+
| Dataset | Accuracy |
20+
| --- | --- |
21+
| Cora | ~77% |
22+
1523
### How to run
1624

1725
For examples, use gpu to train gat on cora dataset.

examples/deeper_gcn/train.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def main(args):
4444
startup_program = fluid.Program()
4545
test_program = fluid.Program()
4646
hidden_size = 64
47-
num_layers = 50
47+
num_layers = 7
4848

4949
with fluid.program_guard(train_program, startup_program):
5050
gw = pgl.graph_wrapper.GraphWrapper(
@@ -103,7 +103,7 @@ def main(args):
103103

104104
# get beta param
105105
beta_param_list = []
106-
for param in train_program.global_block().all_parameters():
106+
for param in fluid.io.get_program_parameter(train_program):
107107
if param.name.endswith("_beta"):
108108
beta_param_list.append(param)
109109

@@ -119,7 +119,7 @@ def main(args):
119119
return_numpy=True)
120120
for param in beta_param_list:
121121
beta = np.array(fluid.global_scope().find_var(param.name).get_tensor())
122-
writer.add_scalar(param.name, beta, epoch)
122+
writer.add_scalar("beta/"+param.name, beta, epoch)
123123

124124
if epoch >= 3:
125125
time_per_epoch = 1.0 * (time.time() - t0)

pgl/message_passing.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ def max_recv(feat):
5050
return fluid.layers.sequence_pool(feat, pool_type="max")
5151

5252

53-
def lstm_recv(feat):
53+
def lstm_recv(hidden_dim):
5454
"""doc"""
55-
hidden_dim = 128
56-
forward, _ = fluid.layers.dynamic_lstm(
57-
input=feat, size=hidden_dim * 4, use_peepholes=False)
58-
output = fluid.layers.sequence_last_step(forward)
59-
return output
55+
def lstm_recv_inside(feat):
56+
forward, _ = fluid.layers.dynamic_lstm(
57+
input=feat, size=hidden_dim * 4, use_peepholes=False)
58+
output = fluid.layers.sequence_last_step(forward)
59+
return output
60+
return lstm_recv_inside
6061

6162

6263
def graphsage_sum(gw, feature, hidden_size, act, initializer, learning_rate, name):

0 commit comments

Comments
 (0)