From e16e895d5364cdff243c2fb548e27fbc6366bf2b Mon Sep 17 00:00:00 2001 From: Minjie Wang Date: Tue, 11 Jun 2019 13:41:41 -0400 Subject: [PATCH] [Doc] fix some document warnings (#645) * fix doc * fix some format and warnings * fix --- docs/source/api/python/graph_store.rst | 4 ++-- docs/source/api/python/nodeflow.rst | 2 +- python/dgl/graph.py | 16 +++++++++------- python/dgl/nodeflow.py | 17 +++++++++++------ tutorials/models/5_giant_graph/1_sampling_mx.py | 2 +- tutorials/models/5_giant_graph/2_giant.py | 2 +- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/docs/source/api/python/graph_store.rst b/docs/source/api/python/graph_store.rst index ca3d916f3c..916e38bf7f 100644 --- a/docs/source/api/python/graph_store.rst +++ b/docs/source/api/python/graph_store.rst @@ -7,7 +7,7 @@ Graph Store -- Graph for multi-processing and distributed training .. autoclass:: SharedMemoryDGLGraph Querying the distributed setting ------------------------- +-------------------------------- .. autosummary:: :toctree: ../../generated/ @@ -26,7 +26,7 @@ Using Node/edge features SharedMemoryDGLGraph.init_edata Computing with Graph store ------------------------ +-------------------------- .. autosummary:: :toctree: ../../generated/ diff --git a/docs/source/api/python/nodeflow.rst b/docs/source/api/python/nodeflow.rst index e138dd6968..b92f5a42a9 100644 --- a/docs/source/api/python/nodeflow.rst +++ b/docs/source/api/python/nodeflow.rst @@ -1,7 +1,7 @@ .. _apinodeflow: NodeFlow -- Graph sampled from a large graph -========================================= +============================================ .. currentmodule:: dgl .. autoclass:: NodeFlow diff --git a/python/dgl/graph.py b/python/dgl/graph.py index bb37ea0f2e..774fff576e 100644 --- a/python/dgl/graph.py +++ b/python/dgl/graph.py @@ -3323,25 +3323,27 @@ class DGLGraph(DGLBaseGraph): # pylint: disable=invalid-name def to(self, ctx): - """ - Move both ndata and edata to the targeted mode (cpu/gpu) + """Move both ndata and edata to the targeted mode (cpu/gpu) Framework agnostic Parameters ---------- - ctx : framework specific context object + ctx : framework-specific context object + The context to move data to. - Examples (Pytorch & MXNet) + Examples -------- - >>> import backend as F + The following example uses PyTorch backend. + + >>> import torch >>> G = dgl.DGLGraph() >>> G.add_nodes(5, {'h': torch.ones((5, 2))}) >>> G.add_edges([0, 1], [1, 2], {'m' : torch.ones((2, 2))}) >>> G.add_edges([0, 1], [1, 2], {'m' : torch.ones((2, 2))}) - >>> G.to(F.cuda()) - + >>> G.to(torch.device('cuda:0')) """ for k in self.ndata.keys(): self.ndata[k] = F.copy_to(self.ndata[k], ctx) for k in self.edata.keys(): self.edata[k] = F.copy_to(self.edata[k], ctx) + # pylint: enable=invalid-name diff --git a/python/dgl/nodeflow.py b/python/dgl/nodeflow.py index aee884b4b6..1ba42b01db 100644 --- a/python/dgl/nodeflow.py +++ b/python/dgl/nodeflow.py @@ -558,12 +558,17 @@ class NodeFlow(DGLBaseGraph): or not. There are two types of an incidence matrix `I`: - * "in": - - I[v, e] = 1 if e is the in-edge of v (or v is the dst node of e); - - I[v, e] = 0 otherwise. - * "out": - - I[v, e] = 1 if e is the out-edge of v (or v is the src node of e); - - I[v, e] = 0 otherwise. + + * ``in``: + + - I[v, e] = 1 if e is the in-edge of v (or v is the dst node of e); + - I[v, e] = 0 otherwise. + + * ``out``: + + - I[v, e] = 1 if e is the out-edge of v (or v is the src node of e); + - I[v, e] = 0 otherwise. + "both" isn't defined in the block of a NodeFlow. Parameters diff --git a/tutorials/models/5_giant_graph/1_sampling_mx.py b/tutorials/models/5_giant_graph/1_sampling_mx.py index 770fd82ae8..39b3834abb 100644 --- a/tutorials/models/5_giant_graph/1_sampling_mx.py +++ b/tutorials/models/5_giant_graph/1_sampling_mx.py @@ -1,5 +1,5 @@ """ -.. _sampling: +.. _model-sampling: NodeFlow and Sampling ======================================= diff --git a/tutorials/models/5_giant_graph/2_giant.py b/tutorials/models/5_giant_graph/2_giant.py index 0f8c9bf950..06e19ea6a2 100644 --- a/tutorials/models/5_giant_graph/2_giant.py +++ b/tutorials/models/5_giant_graph/2_giant.py @@ -1,5 +1,5 @@ """ -.. _sampling: +.. _model-graph-store: Large-Scale Training of Graph Neural Networks =============================================