Skip to content

Commit

Permalink
[Doc]Fix examples on negative graph sampler (dmlc#2863)
Browse files Browse the repository at this point in the history
* Fix examples on negative graph sampler

In heterogeneous graph, the old example may build a negative graph without edges. In dgl.dataloading.dataloader line637, it shows the key of neg_edges dict should be item in g.canonical_etypes.

* poke ci

Co-authored-by: Quan (Andy) Gan <[email protected]>
  • Loading branch information
Theheavens and BarclayII authored May 6, 2021
1 parent 241b60d commit 5498cf0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/source/guide/minibatch-link.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ source-destination array pairs. An example is given as follows:
# caches the probability distribution
self.weights = {
etype: g.in_degrees(etype=etype).float() ** 0.75
for _, etype, _ in g.canonical_etypes
}
for etype in g.canonical_etypes}
self.k = k
def __call__(self, g, eids_dict):
Expand All @@ -268,8 +267,8 @@ sampler. For instance, the following iterates over all edges of the heterogeneo
.. code:: python
train_eid_dict = {
g.edges(etype=etype, form='eid')
for etype in g.etypes}
etype: g.edges(etype=etype, form='eid')
for etype in g.canonical_etypes}
dataloader = dgl.dataloading.EdgeDataLoader(
g, train_eid_dict, sampler,
Expand Down

0 comments on commit 5498cf0

Please sign in to comment.