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
47c6fb1f
Unverified
Commit
47c6fb1f
authored
Sep 14, 2023
by
peizhou001
Committed by
GitHub
Sep 14, 2023
Browse files
[Graphbolt]Fix docstring example (#6328)
parent
e3bf1c0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
python/dgl/graphbolt/impl/neighbor_sampler.py
python/dgl/graphbolt/impl/neighbor_sampler.py
+2
-5
No files found.
python/dgl/graphbolt/impl/neighbor_sampler.py
View file @
47c6fb1f
...
...
@@ -61,18 +61,15 @@ class NeighborSampler(SubgraphSampler):
>>> indptr = torch.LongTensor([0, 2, 4, 5, 6, 7 ,8])
>>> indices = torch.LongTensor([1, 2, 0, 3, 5, 4, 3, 5])
>>> graph = gb.from_csc(indptr, indices)
>>> data_format = gb.LinkPredictionEdgeFormat.INDEPENDENT
>>> node_pairs = torch.LongTensor([[0, 1], [1, 2]])
>>> item_set = gb.ItemSet(node_pairs, names="node_pairs")
>>> item_sampler = gb.ItemSampler(
...item_set, batch_size=1,
...)
>>> neg_sampler = gb.UniformNegativeSampler(
...item_sampler, 2, data_format, graph)
>>> fanouts = [torch.LongTensor([5]), torch.LongTensor([10]),
...torch.LongTensor([15])]
...item_sampler, graph, 2)
>>> subgraph_sampler = gb.NeighborSampler(
...neg_sampler, graph,
fanouts
)
...neg_sampler, graph,
[5, 10, 15]
)
>>> for data in subgraph_sampler:
... print(data.compacted_node_pairs)
... print(len(data.sampled_subgraphs))
...
...
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