"tests/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "20ce68f945de7860f9854cd7ee680debf4a07fe5"
Unverified Commit 5498cf05 authored by Theheavens's avatar Theheavens Committed by GitHub
Browse files

[Doc]Fix examples on negative graph sampler (#2863)



* 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: default avatarQuan (Andy) Gan <coin2028@hotmail.com>
parent 241b60d4
...@@ -249,8 +249,7 @@ source-destination array pairs. An example is given as follows: ...@@ -249,8 +249,7 @@ source-destination array pairs. An example is given as follows:
# caches the probability distribution # caches the probability distribution
self.weights = { self.weights = {
etype: g.in_degrees(etype=etype).float() ** 0.75 etype: g.in_degrees(etype=etype).float() ** 0.75
for _, etype, _ in g.canonical_etypes for etype in g.canonical_etypes}
}
self.k = k self.k = k
def __call__(self, g, eids_dict): def __call__(self, g, eids_dict):
...@@ -268,8 +267,8 @@ sampler. For instance, the following iterates over all edges of the heterogeneo ...@@ -268,8 +267,8 @@ sampler. For instance, the following iterates over all edges of the heterogeneo
.. code:: python .. code:: python
train_eid_dict = { train_eid_dict = {
g.edges(etype=etype, form='eid') etype: g.edges(etype=etype, form='eid')
for etype in g.etypes} for etype in g.canonical_etypes}
dataloader = dgl.dataloading.EdgeDataLoader( dataloader = dgl.dataloading.EdgeDataLoader(
g, train_eid_dict, sampler, g, train_eid_dict, sampler,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment