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
d6957c28
Unverified
Commit
d6957c28
authored
Jul 30, 2022
by
Rhett Ying
Committed by
GitHub
Jul 30, 2022
Browse files
[BugFix] fix incorrect _bias and bias usage (#4310)
parent
b3242e90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
python/dgl/nn/pytorch/conv/gcn2conv.py
python/dgl/nn/pytorch/conv/gcn2conv.py
+3
-3
tests/pytorch/test_nn.py
tests/pytorch/test_nn.py
+3
-2
No files found.
python/dgl/nn/pytorch/conv/gcn2conv.py
View file @
d6957c28
...
...
@@ -151,7 +151,7 @@ class GCN2Conv(nn.Module):
nn
.
init
.
normal_
(
self
.
weight1
)
if
not
self
.
_project_initial_features
:
nn
.
init
.
normal_
(
self
.
weight2
)
if
self
.
_bias
is
not
None
:
if
self
.
_bias
:
nn
.
init
.
zeros_
(
self
.
bias
)
def
set_allow_zero_in_degree
(
self
,
set_value
):
...
...
@@ -265,8 +265,8 @@ class GCN2Conv(nn.Module):
feat_0
,
feat_0
,
self
.
weight2
,
beta
=
(
1
-
self
.
beta
),
alpha
=
self
.
beta
)
if
self
.
_bias
is
not
None
:
rst
=
rst
+
self
.
_
bias
if
self
.
_bias
:
rst
=
rst
+
self
.
bias
if
self
.
_activation
is
not
None
:
rst
=
self
.
_activation
(
rst
)
...
...
tests/pytorch/test_nn.py
View file @
d6957c28
...
...
@@ -647,10 +647,11 @@ def test_appnp_conv_e_weight(g, idtype):
@
parametrize_idtype
@
pytest
.
mark
.
parametrize
(
'g'
,
get_cases
([
'homo'
],
exclude
=
[
'zero-degree'
]))
def
test_gcn2conv_e_weight
(
g
,
idtype
):
@
pytest
.
mark
.
parametrize
(
"bias"
,
[
True
,
False
])
def
test_gcn2conv_e_weight
(
g
,
idtype
,
bias
):
ctx
=
F
.
ctx
()
g
=
g
.
astype
(
idtype
).
to
(
ctx
)
gcn2conv
=
nn
.
GCN2Conv
(
5
,
layer
=
2
,
alpha
=
0.5
,
gcn2conv
=
nn
.
GCN2Conv
(
5
,
layer
=
2
,
alpha
=
0.5
,
bias
=
bias
,
project_initial_features
=
True
)
feat
=
F
.
randn
((
g
.
number_of_nodes
(),
5
))
eweight
=
F
.
ones
((
g
.
num_edges
(),
))
...
...
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