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
61139302
Unverified
Commit
61139302
authored
Dec 01, 2022
by
peizhou001
Committed by
GitHub
Dec 01, 2022
Browse files
[API Deprecation] Remove candidates in DGLGraph (#4946)
parent
e088acac
Changes
61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
tutorials/models/4_old_wines/7_transformer.py
tutorials/models/4_old_wines/7_transformer.py
+6
-6
No files found.
tutorials/models/4_old_wines/7_transformer.py
View file @
61139302
...
@@ -231,7 +231,7 @@ Transformer as a Graph Neural Network
...
@@ -231,7 +231,7 @@ Transformer as a Graph Neural Network
# - ``fn.src_mul_egdes(src_field, edges_field, out_field)`` multiplies
# - ``fn.src_mul_egdes(src_field, edges_field, out_field)`` multiplies
# source’s attribute and edges attribute, and send the result to the
# source’s attribute and edges attribute, and send the result to the
# destination node’s mailbox keyed by ``out_field``.
# destination node’s mailbox keyed by ``out_field``.
# - ``fn.copy_e
dge
(edges_field, out_field)`` copies edge’s attribute to
# - ``fn.copy_e(edges_field, out_field)`` copies edge’s attribute to
# destination node’s mailbox.
# destination node’s mailbox.
# - ``fn.sum(edges_field, out_field)`` sums up
# - ``fn.sum(edges_field, out_field)`` sums up
# edge’s attribute and sends aggregation to destination node’s mailbox.
# edge’s attribute and sends aggregation to destination node’s mailbox.
...
@@ -259,11 +259,11 @@ Transformer as a Graph Neural Network
...
@@ -259,11 +259,11 @@ Transformer as a Graph Neural Network
# in-coming edges of each node for normalization. Note that here
# in-coming edges of each node for normalization. Note that here
# :math:`\textrm{wv}` is not normalized.
# :math:`\textrm{wv}` is not normalized.
#
#
# - ``msg: fn.
src
_mul_e
dge
('v', 'score', 'v'), reduce: fn.sum('v', 'wv')``
# - ``msg: fn.
u
_mul_e('v', 'score', 'v'), reduce: fn.sum('v', 'wv')``
#
#
# .. math:: \textrm{wv}_j=\sum_{i=1}^{N} \textrm{score}_{ij} \cdot v_i
# .. math:: \textrm{wv}_j=\sum_{i=1}^{N} \textrm{score}_{ij} \cdot v_i
#
#
# - ``msg: fn.copy_e
dge
('score', 'score'), reduce: fn.sum('score', 'z')``
# - ``msg: fn.copy_e('score', 'score'), reduce: fn.sum('score', 'z')``
#
#
# .. math:: \textrm{z}_j=\sum_{i=1}^{N} \textrm{score}_{ij}
# .. math:: \textrm{z}_j=\sum_{i=1}^{N} \textrm{score}_{ij}
#
#
...
@@ -291,7 +291,7 @@ Transformer as a Graph Neural Network
...
@@ -291,7 +291,7 @@ Transformer as a Graph Neural Network
# g.apply_edges(scaled_exp('score', np.sqrt(self.d_k)))
# g.apply_edges(scaled_exp('score', np.sqrt(self.d_k)))
# # Update node state
# # Update node state
# g.send_and_recv(eids,
# g.send_and_recv(eids,
# [fn.
src
_mul_e
dge
('v', 'score', 'v'), fn.copy_e
dge
('score', 'score')],
# [fn.
u
_mul_e('v', 'score', 'v'), fn.copy_e('score', 'score')],
# [fn.sum('v', 'wv'), fn.sum('score', 'z')])
# [fn.sum('v', 'wv'), fn.sum('score', 'z')])
#
#
# Preprocessing and postprocessing
# Preprocessing and postprocessing
...
@@ -431,7 +431,7 @@ Transformer as a Graph Neural Network
...
@@ -431,7 +431,7 @@ Transformer as a Graph Neural Network
# g.apply_edges(scaled_exp('score', np.sqrt(self.d_k)))
# g.apply_edges(scaled_exp('score', np.sqrt(self.d_k)))
# # 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_e
dge
('v', 'score', 'v'), fn.copy_e
dge
('score', 'score')],
# [fn.
u
_mul_e('v', 'score', 'v'), fn.copy_e('score', 'score')],
# [fn.sum('v', 'wv'), 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):
...
@@ -774,7 +774,7 @@ Transformer as a Graph Neural Network
...
@@ -774,7 +774,7 @@ Transformer as a Graph Neural Network
# 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_e
dge
('v', 'score', 'v'), fn.copy_e
dge
('score', 'score')],
# [fn.
u
_mul_e('v', 'score', 'v'), fn.copy_e('score', 'score')],
# [fn.sum('v', 'wv'), 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):
...
...
Prev
1
2
3
4
Next
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