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
dgl
Commits
2f43cdb3
"...git@developer.sourcefind.cn:OpenDAS/fairscale.git" did not exist on "454537d19de4dbc8b985a97615c31b3f75607bd9"
Unverified
Commit
2f43cdb3
authored
Jun 28, 2021
by
WangYQ
Committed by
GitHub
Jun 28, 2021
Browse files
deal with situation where num_layers equals 1 (#3066)
parent
9664cdff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
examples/pytorch/graphsage/model.py
examples/pytorch/graphsage/model.py
+7
-4
No files found.
examples/pytorch/graphsage/model.py
View file @
2f43cdb3
...
@@ -17,10 +17,13 @@ class SAGE(nn.Module):
...
@@ -17,10 +17,13 @@ class SAGE(nn.Module):
self
.
n_hidden
=
n_hidden
self
.
n_hidden
=
n_hidden
self
.
n_classes
=
n_classes
self
.
n_classes
=
n_classes
self
.
layers
=
nn
.
ModuleList
()
self
.
layers
=
nn
.
ModuleList
()
if
n_layers
>
1
:
self
.
layers
.
append
(
dglnn
.
SAGEConv
(
in_feats
,
n_hidden
,
'mean'
))
self
.
layers
.
append
(
dglnn
.
SAGEConv
(
in_feats
,
n_hidden
,
'mean'
))
for
i
in
range
(
1
,
n_layers
-
1
):
for
i
in
range
(
1
,
n_layers
-
1
):
self
.
layers
.
append
(
dglnn
.
SAGEConv
(
n_hidden
,
n_hidden
,
'mean'
))
self
.
layers
.
append
(
dglnn
.
SAGEConv
(
n_hidden
,
n_hidden
,
'mean'
))
self
.
layers
.
append
(
dglnn
.
SAGEConv
(
n_hidden
,
n_classes
,
'mean'
))
self
.
layers
.
append
(
dglnn
.
SAGEConv
(
n_hidden
,
n_classes
,
'mean'
))
else
:
self
.
layers
.
append
(
dglnn
.
SAGEConv
(
in_feats
,
n_classes
,
'mean'
))
self
.
dropout
=
nn
.
Dropout
(
dropout
)
self
.
dropout
=
nn
.
Dropout
(
dropout
)
self
.
activation
=
activation
self
.
activation
=
activation
...
...
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