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
66f7fe8b
"...git@developer.sourcefind.cn:OpenDAS/pytorch-encoding.git" did not exist on "2dd88e583afc26cbd7727cfedb97b1d2812eedaf"
Unverified
Commit
66f7fe8b
authored
Mar 29, 2021
by
Quan (Andy) Gan
Committed by
GitHub
Mar 29, 2021
Browse files
Update model.py (#2796)
parent
2952f3c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
examples/pytorch/hgt/model.py
examples/pytorch/hgt/model.py
+3
-3
No files found.
examples/pytorch/hgt/model.py
View file @
66f7fe8b
...
@@ -78,7 +78,7 @@ class HGTLayer(nn.Module):
...
@@ -78,7 +78,7 @@ class HGTLayer(nn.Module):
sub_graph
.
srcdata
[
'k'
]
=
k
sub_graph
.
srcdata
[
'k'
]
=
k
sub_graph
.
dstdata
[
'q'
]
=
q
sub_graph
.
dstdata
[
'q'
]
=
q
sub_graph
.
srcdata
[
'v
'
]
=
v
sub_graph
.
srcdata
[
'v
_%d'
%
e_id
]
=
v
sub_graph
.
apply_edges
(
fn
.
v_dot_u
(
'q'
,
'k'
,
't'
))
sub_graph
.
apply_edges
(
fn
.
v_dot_u
(
'q'
,
'k'
,
't'
))
attn_score
=
sub_graph
.
edata
.
pop
(
't'
).
sum
(
-
1
)
*
relation_pri
/
self
.
sqrt_dk
attn_score
=
sub_graph
.
edata
.
pop
(
't'
).
sum
(
-
1
)
*
relation_pri
/
self
.
sqrt_dk
...
@@ -86,8 +86,8 @@ class HGTLayer(nn.Module):
...
@@ -86,8 +86,8 @@ class HGTLayer(nn.Module):
sub_graph
.
edata
[
't'
]
=
attn_score
.
unsqueeze
(
-
1
)
sub_graph
.
edata
[
't'
]
=
attn_score
.
unsqueeze
(
-
1
)
G
.
multi_update_all
({
etype
:
(
fn
.
u_mul_e
(
'v
'
,
't'
,
'm'
),
fn
.
sum
(
'm'
,
't'
))
\
G
.
multi_update_all
({
etype
:
(
fn
.
u_mul_e
(
'v
_%d'
%
e_id
,
't'
,
'm'
),
fn
.
sum
(
'm'
,
't'
))
\
for
etype
in
edge_dict
},
cross_reducer
=
'mean'
)
for
etype
,
e_id
in
edge_dict
.
items
()
},
cross_reducer
=
'mean'
)
new_h
=
{}
new_h
=
{}
for
ntype
in
G
.
ntypes
:
for
ntype
in
G
.
ntypes
:
...
...
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