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
43fb73db
Unverified
Commit
43fb73db
authored
Dec 18, 2023
by
Rhett Ying
Committed by
GitHub
Dec 18, 2023
Browse files
[GraphBolt] update doc page about to_dgl() (#6768)
parent
358db43a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
8 deletions
+2
-8
docs/source/guide/minibatch-custom-sampler.rst
docs/source/guide/minibatch-custom-sampler.rst
+0
-2
docs/source/guide/minibatch-edge.rst
docs/source/guide/minibatch-edge.rst
+2
-6
No files found.
docs/source/guide/minibatch-custom-sampler.rst
View file @
43fb73db
...
@@ -51,7 +51,6 @@ To use this sampler with :class:`~dgl.graphbolt.DataLoader`:
...
@@ -51,7 +51,6 @@ To use this sampler with :class:`~dgl.graphbolt.DataLoader`:
dataloader = gb.DataLoader(datapipe, num_workers=0)
dataloader = gb.DataLoader(datapipe, num_workers=0)
for data in dataloader:
for data in dataloader:
data = data.to_dgl()
input_features = data.node_features["feat"]
input_features = data.node_features["feat"]
output_labels = data.labels
output_labels = data.labels
output_predictions = model(data.blocks, input_features)
output_predictions = model(data.blocks, input_features)
...
@@ -97,7 +96,6 @@ can be used on heterogeneous graphs:
...
@@ -97,7 +96,6 @@ can be used on heterogeneous graphs:
dataloader = gb.DataLoader(datapipe, num_workers=0)
dataloader = gb.DataLoader(datapipe, num_workers=0)
for data in dataloader:
for data in dataloader:
data = data.to_dgl()
input_features = {
input_features = {
ntype: data.node_features[(ntype, "feat")]
ntype: data.node_features[(ntype, "feat")]
for ntype in data.blocks[0].srctypes
for ntype in data.blocks[0].srctypes
...
...
docs/source/guide/minibatch-edge.rst
View file @
43fb73db
...
@@ -43,13 +43,11 @@ edges(namely, node pairs) in the training set instead of the nodes.
...
@@ -43,13 +43,11 @@ edges(namely, node pairs) in the training set instead of the nodes.
Iterating
over
the
DataLoader
will
yield
:
class
:`~
dgl
.
graphbolt
.
MiniBatch
`
Iterating
over
the
DataLoader
will
yield
:
class
:`~
dgl
.
graphbolt
.
MiniBatch
`
which
contains
a
list
of
specially
created
graphs
representing
the
computation
which
contains
a
list
of
specially
created
graphs
representing
the
computation
dependencies
on
each
layer
.
In
order
to
train
with
DGL
,
you
need
to
convert
them
dependencies
on
each
layer
.
You
can
access
the
*
message
flow
graphs
*
(
MFGs
)
via
to
:
class
:`~
dgl
.
graphbolt
.
DGLMiniBatch
`.
Then
you
can
access
the
`
mini_batch
.
blocks
`.
*
message
flow
graphs
*
(
MFGs
).
..
code
::
python
..
code
::
python
mini_batch
=
next
(
iter
(
dataloader
))
mini_batch
=
next
(
iter
(
dataloader
))
mini_batch
=
mini_batch
.
to_dgl
()
print
(
mini_batch
.
blocks
)
print
(
mini_batch
.
blocks
)
..
note
::
..
note
::
...
@@ -182,7 +180,6 @@ their incident node representations.
...
@@ -182,7 +180,6 @@ their incident node representations.
opt
=
torch
.
optim
.
Adam
(
model
.
parameters
())
opt
=
torch
.
optim
.
Adam
(
model
.
parameters
())
for
data
in
dataloader
:
for
data
in
dataloader
:
data
=
data
.
to_dgl
()
blocks
=
data
.
blocks
blocks
=
data
.
blocks
x
=
data
.
edge_features
(
"feat"
)
x
=
data
.
edge_features
(
"feat"
)
y_hat
=
model
(
data
.
blocks
,
x
,
data
.
positive_node_pairs
)
y_hat
=
model
(
data
.
blocks
,
x
,
data
.
positive_node_pairs
)
...
@@ -317,7 +314,6 @@ dictionaries of node types and predictions here.
...
@@ -317,7 +314,6 @@ dictionaries of node types and predictions here.
opt
=
torch
.
optim
.
Adam
(
model
.
parameters
())
opt
=
torch
.
optim
.
Adam
(
model
.
parameters
())
for
data
in
dataloader
:
for
data
in
dataloader
:
data
=
data
.
to_dgl
()
blocks
=
data
.
blocks
blocks
=
data
.
blocks
x
=
data
.
edge_features
((
"user:like:item"
,
"feat"
))
x
=
data
.
edge_features
((
"user:like:item"
,
"feat"
))
y_hat
=
model
(
data
.
blocks
,
x
,
data
.
positive_node_pairs
)
y_hat
=
model
(
data
.
blocks
,
x
,
data
.
positive_node_pairs
)
...
...
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