Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
pyg_autoscale
Commits
0ac78d87
Commit
0ac78d87
authored
Feb 02, 2021
by
rusty1s
Browse files
example code
parent
eccca6c7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
README.md
README.md
+21
-0
No files found.
README.md
View file @
0ac78d87
...
...
@@ -3,3 +3,24 @@
<img
width=
"100%"
src=
"https://raw.githubusercontent.com/rusty1s/pyg_autoscale/master/figures/overview.png?token=ABU7ZAXZ7WT3RIOSYHIDIVDAEI3SY"
/>
--------------------------------------------------------------------------------
```
python
from
torch_geometric.nn
import
GCNConv
from
torch_geometric_autoscale
import
ScalableGNN
class
GNN
(
ScalableGNN
):
def
__init__
(
self
,
num_nodes
,
in_channels
,
hidden_channels
,
out_channels
,
num_layers
):
super
(
GNN
,
self
).
__init__
(
num_nodes
,
hidden_channels
,
num_layers
)
self
.
convs
=
ModuleList
()
self
.
convs
.
append
(
GCNConv
(
in_channels
,
hidden_channels
))
for
_
in
range
(
num_layers
-
2
):
self
.
convs
.
append
(
GCNConv
(
hidden_channels
,
hidden_channels
))
self
.
convs
.
append
(
GCNConv
(
hidden_channels
,
out_channels
))
def
forward
(
self
,
x
,
adj
,
n_id
):
for
conv
,
history
in
zip
(
self
.
convs
[:
-
1
],
self
.
histories
):
x
=
conv
(
x
,
adj
).
relu
()
x
=
self
.
push_and_pull
(
history
,
x
,
n_id
)
return
self
.
convs
[
-
1
](
x
,
adj
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment