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
7a10bcb6
Unverified
Commit
7a10bcb6
authored
Feb 21, 2024
by
Muhammed Fatih BALIN
Committed by
GitHub
Feb 22, 2024
Browse files
[GraphBolt][Doc] Minor fixes and clarifications. (#7135)
parent
364cb718
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
12 deletions
+19
-12
python/dgl/graphbolt/base.py
python/dgl/graphbolt/base.py
+6
-6
python/dgl/graphbolt/dataloader.py
python/dgl/graphbolt/dataloader.py
+3
-1
python/dgl/graphbolt/impl/torch_based_feature_store.py
python/dgl/graphbolt/impl/torch_based_feature_store.py
+1
-0
python/dgl/graphbolt/internal/sample_utils.py
python/dgl/graphbolt/internal/sample_utils.py
+5
-5
python/dgl/graphbolt/itemset.py
python/dgl/graphbolt/itemset.py
+4
-0
No files found.
python/dgl/graphbolt/base.py
View file @
7a10bcb6
...
...
@@ -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
)
...
...
python/dgl/graphbolt/dataloader.py
View file @
7a10bcb6
...
...
@@ -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
----------
...
...
python/dgl/graphbolt/impl/torch_based_feature_store.py
View file @
7a10bcb6
...
...
@@ -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
...
...
python/dgl/graphbolt/internal/sample_utils.py
View file @
7a10bcb6
...
...
@@ -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
)
...
...
python/dgl/graphbolt/itemset.py
View file @
7a10bcb6
...
...
@@ -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(
...
...
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