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
45aa1584
"tests/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "c3baf4332b3f2a453fb969c496b2ec71b75c0f2d"
Commit
45aa1584
authored
Nov 22, 2019
by
Jacob Stevens
Committed by
VoVAllen
Nov 22, 2019
Browse files
Fix example code in saving graphs (#1034)
parent
8f7abb5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
python/dgl/data/graph_serialize.py
python/dgl/data/graph_serialize.py
+3
-3
No files found.
python/dgl/data/graph_serialize.py
View file @
45aa1584
...
@@ -87,13 +87,13 @@ def save_graphs(filename, g_list, labels=None):
...
@@ -87,13 +87,13 @@ def save_graphs(filename, g_list, labels=None):
>>> g2 = dgl.DGLGraph()
>>> g2 = dgl.DGLGraph()
>>> g2.add_nodes(3)
>>> g2.add_nodes(3)
>>> g2.add_edges([0, 1, 2], [1, 2, 1])
>>> g2.add_edges([0, 1, 2], [1, 2, 1])
>>> g
1
.edata["e"] = th.ones(3, 4)
>>> g
2
.edata["e"] = th.ones(3, 4)
Save Graphs into file
Save Graphs into file
>>> from dgl.data.utils import save_graphs
>>> from dgl.data.utils import save_graphs
>>> graph_labels = {"glabel": th.tensor([0, 1])}
>>> graph_labels = {"glabel": th.tensor([0, 1])}
>>> save_graphs(
[g1, g2],
"./data.bin", graph_labels)
>>> save_graphs("./data.bin",
[g1, g2],
graph_labels)
"""
"""
if
isinstance
(
g_list
,
DGLGraph
):
if
isinstance
(
g_list
,
DGLGraph
):
...
@@ -130,7 +130,7 @@ def load_graphs(filename, idx_list=None):
...
@@ -130,7 +130,7 @@ def load_graphs(filename, idx_list=None):
----------
----------
Following the example in save_graphs.
Following the example in save_graphs.
>>> from dgl.utils
.data
import load_graphs
>>> from dgl.
data.
utils import load_graphs
>>> glist, label_dict = load_graphs("./data.bin") # glist will be [g1, g2]
>>> glist, label_dict = load_graphs("./data.bin") # glist will be [g1, g2]
>>> glist, label_dict = load_graphs("./data.bin", [0]) # glist will be [g1]
>>> glist, label_dict = load_graphs("./data.bin", [0]) # glist will be [g1]
...
...
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