Unverified Commit 7a10bcb6 authored by Muhammed Fatih BALIN's avatar Muhammed Fatih BALIN Committed by GitHub
Browse files

[GraphBolt][Doc] Minor fixes and clarifications. (#7135)

parent 364cb718
......@@ -90,9 +90,9 @@ def expand_indptr(indptr, dtype=None, node_ids=None, output_size=None):
argument avoids a stream synchronization to calculate the output shape.
Returns
-------
torch.Tensor
The converted COO tensor with values from node_ids.
-------
torch.Tensor
The converted COO tensor with values from node_ids.
"""
assert indptr.dim() == 1, "Indptr should be 1D tensor."
assert not (
......@@ -127,9 +127,9 @@ def index_select(tensor, index):
The 1-D tensor containing the indices to index.
Returns
-------
torch.Tensor
The indexed input tensor, equivalent to tensor[index].
-------
torch.Tensor
The indexed input tensor, equivalent to tensor[index].
"""
assert index.dim() == 1, "Index should be 1D tensor."
return torch.ops.graphbolt.index_select(tensor, index)
......
......@@ -84,7 +84,9 @@ class DataLoader(torch.utils.data.DataLoader):
everything after feature fetching in the main process. The datapipe
is modified in-place as a result.
Only works on single GPU.
When the copy_to operation is placed earlier in the data pipeline, the
num_workers argument is required to be 0 as utilizing CUDA in multiple
worker processes is not supported.
Parameters
----------
......
......@@ -63,6 +63,7 @@ class TorchBasedFeature(Feature):
tensor([[1, 2]])
3. Pinned CPU feature.
>>> torch_feat = torch.arange(10).reshape(2, -1).pin_memory()
>>> feature = gb.TorchBasedFeature(torch_feat)
>>> feature.read().device
......
......@@ -32,11 +32,11 @@ def unique_and_compact(
Returns
-------
Tuple[unique_nodes, compacted_node_list]
The Unique nodes (per type) of all nodes in the input. And the compacted
nodes list, where IDs inside are replaced with compacted node IDs.
"Compacted node list" indicates that the node IDs in the input node
list are replaced with mapped node IDs, where each type of node is
mapped to a contiguous space of IDs ranging from 0 to N.
The Unique nodes (per type) of all nodes in the input. And the compacted
nodes list, where IDs inside are replaced with compacted node IDs.
"Compacted node list" indicates that the node IDs in the input node
list are replaced with mapped node IDs, where each type of node is
mapped to a contiguous space of IDs ranging from 0 to N.
"""
is_heterogeneous = isinstance(nodes, dict)
......
......@@ -36,6 +36,7 @@ class ItemSet:
>>> from dgl import graphbolt as gb
1. Integer: number of nodes.
>>> num = 10
>>> item_set = gb.ItemSet(num, names="seed_nodes")
>>> list(item_set)
......@@ -47,6 +48,7 @@ class ItemSet:
('seed_nodes',)
2. Single iterable: seed nodes.
>>> node_ids = torch.arange(0, 5)
>>> item_set = gb.ItemSet(node_ids, names="seed_nodes")
>>> list(item_set)
......@@ -57,6 +59,7 @@ class ItemSet:
('seed_nodes',)
3. Tuple of iterables with same shape: seed nodes and labels.
>>> node_ids = torch.arange(0, 5)
>>> labels = torch.arange(5, 10)
>>> item_set = gb.ItemSet(
......@@ -70,6 +73,7 @@ class ItemSet:
('seed_nodes', 'labels')
4. Tuple of iterables with different shape: node pairs and negative dsts.
>>> node_pairs = torch.arange(0, 10).reshape(-1, 2)
>>> neg_dsts = torch.arange(10, 25).reshape(-1, 3)
>>> item_set = gb.ItemSet(
......
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