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
dba8c825
Unverified
Commit
dba8c825
authored
Aug 20, 2020
by
Mufei Li
Committed by
GitHub
Aug 20, 2020
Browse files
Fix (#2070)
Co-authored-by:
Ubuntu
<
ubuntu@ip-172-31-1-5.us-west-2.compute.internal
>
parent
8f3e423c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
examples/pytorch/transformer/modules/models.py
examples/pytorch/transformer/modules/models.py
+2
-3
No files found.
examples/pytorch/transformer/modules/models.py
View file @
dba8c825
...
@@ -79,9 +79,8 @@ class Transformer(nn.Module):
...
@@ -79,9 +79,8 @@ class Transformer(nn.Module):
g
.
apply_edges
(
src_dot_dst
(
'k'
,
'q'
,
'score'
),
eids
)
g
.
apply_edges
(
src_dot_dst
(
'k'
,
'q'
,
'score'
),
eids
)
g
.
apply_edges
(
scaled_exp
(
'score'
,
np
.
sqrt
(
self
.
d_k
)),
eids
)
g
.
apply_edges
(
scaled_exp
(
'score'
,
np
.
sqrt
(
self
.
d_k
)),
eids
)
# Send weighted values to target nodes
# Send weighted values to target nodes
g
.
send_and_recv
(
eids
,
g
.
send_and_recv
(
eids
,
fn
.
src_mul_edge
(
'v'
,
'score'
,
'v'
),
fn
.
sum
(
'v'
,
'wv'
))
[
fn
.
src_mul_edge
(
'v'
,
'score'
,
'v'
),
fn
.
copy_edge
(
'score'
,
'score'
)],
g
.
send_and_recv
(
eids
,
fn
.
copy_edge
(
'score'
,
'score'
),
fn
.
sum
(
'score'
,
'z'
))
[
fn
.
sum
(
'v'
,
'wv'
),
fn
.
sum
(
'score'
,
'z'
)])
def
update_graph
(
self
,
g
,
eids
,
pre_pairs
,
post_pairs
):
def
update_graph
(
self
,
g
,
eids
,
pre_pairs
,
post_pairs
):
"Update the node states and edge states of the graph."
"Update the node states and edge states of the graph."
...
...
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