Skip to content

Commit edb9787

Browse files
authored
[Doc, UG, Tutorial] Misc Fix (dmlc#2376)
* Update * Update * Update * Update * Update
1 parent 6b02bab commit edb9787

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

docs/source/guide/training-edge.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
5.2 Edge Classification/Regression
44
---------------------------------------------
55

6-
Sometimes you wish to predict the attributes on the edges of the graph,
7-
or even whether an edge exists or not between two given nodes. In that
6+
Sometimes you wish to predict the attributes on the edges of the graph. In that
87
case, you would like to have an *edge classification/regression* model.
98

109
Here we generate a random graph for edge prediction as a demonstration.

python/dgl/convert.py

+2
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ def heterograph(data_dict,
259259
formats and chooses the most efficient one depending on the computation invoked.
260260
If memory usage becomes an issue in the case of large graphs, use
261261
:func:`dgl.DGLGraph.formats` to restrict the allowed formats.
262+
4. DGL internally decides a deterministic order for the same set of node types and canonical
263+
edge types, which does not necessarily follow the order in :attr:`data_dict`.
262264
263265
Examples
264266
--------

tutorials/basics/1_first.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def build_karate_club_graph():
6464
u = np.concatenate([src, dst])
6565
v = np.concatenate([dst, src])
6666
# Construct a DGLGraph
67-
return dgl.DGLGraph((u, v))
67+
return dgl.graph((u, v))
6868

6969
###############################################################################
7070
# Print out the number of nodes and edges in our newly constructed graph:

tutorials/models/1_gnn/1_gcn.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import torch.nn.functional as F
5050
from dgl import DGLGraph
5151

52-
gcn_msg = fn.copy_src(src='h', out='m')
52+
gcn_msg = fn.copy_u(u='h', out='m')
5353
gcn_reduce = fn.sum(msg='m', out='h')
5454

5555
###############################################################################
@@ -95,15 +95,14 @@ def forward(self, g, features):
9595
###############################################################################
9696
# We load the cora dataset using DGL's built-in data module.
9797

98-
from dgl.data import citation_graph as citegrh
99-
import networkx as nx
98+
from dgl.data import CoraGraphDataset
10099
def load_cora_data():
101-
data = citegrh.load_cora()
102-
features = th.FloatTensor(data.features)
103-
labels = th.LongTensor(data.labels)
104-
train_mask = th.BoolTensor(data.train_mask)
105-
test_mask = th.BoolTensor(data.test_mask)
106-
g = DGLGraph(data.graph)
100+
dataset = CoraGraphDataset()
101+
g = dataset[0]
102+
features = g.ndata['feat']
103+
labels = g.ndata['label']
104+
train_mask = g.ndata['train_mask']
105+
test_mask = g.ndata['test_mask']
107106
return g, features, labels, train_mask, test_mask
108107

109108
###############################################################################

0 commit comments

Comments
 (0)