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
74c5e31d
"git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "aed161e63f02233b56aaff8ef54c670d71f938da"
Unverified
Commit
74c5e31d
authored
Mar 18, 2024
by
Muhammed Fatih BALIN
Committed by
GitHub
Mar 18, 2024
Browse files
[GraphBolt][Doc] Update `layer_neighbor` documentation for new args. (#7212)
parent
858c0b86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
python/dgl/graphbolt/impl/fused_csc_sampling_graph.py
python/dgl/graphbolt/impl/fused_csc_sampling_graph.py
+34
-0
python/dgl/graphbolt/impl/neighbor_sampler.py
python/dgl/graphbolt/impl/neighbor_sampler.py
+14
-1
No files found.
python/dgl/graphbolt/impl/fused_csc_sampling_graph.py
View file @
74c5e31d
...
@@ -791,6 +791,32 @@ class FusedCSCSamplingGraph(SamplingGraph):
...
@@ -791,6 +791,32 @@ class FusedCSCSamplingGraph(SamplingGraph):
corresponding to each neighboring edge of a node. It must be a 1D
corresponding to each neighboring edge of a node. It must be a 1D
floating-point or boolean tensor, with the number of elements
floating-point or boolean tensor, with the number of elements
equalling the total number of edges.
equalling the total number of edges.
random_seed: torch.Tensor, optional
An int64 tensor with one or two elements.
The passed random_seed makes it so that for any seed node ``s`` and
its neighbor ``t``, the rolled random variate ``r_t`` is the same
for any call to this function with the same random seed. When
sampling as part of the same batch, one would want identical seeds
so that LABOR can globally sample. One example is that for
heterogenous graphs, there is a single random seed passed for each
edge type. This will sample much fewer nodes compared to having
unique random seeds for each edge type. If one called this function
individually for each edge type for a heterogenous graph with
different random seeds, then it would run LABOR locally for each
edge type, resulting into a larger number of nodes being sampled.
If this function is called without a ``random_seed``, we get the
random seed by getting a random number from GraphBolt. Use this
argument with identical random_seed if multiple calls to this
function are used to sample as part of a single batch.
If given two numbers, then the ``seed2_contribution`` argument
determines the interpolation between the two random seeds.
seed2_contribution: float, optional
A float value between [0, 1) that determines the contribution of the
second random seed, ``random_seed[-1]``, to generate the random
variates.
Returns
Returns
-------
-------
...
@@ -826,6 +852,14 @@ class FusedCSCSamplingGraph(SamplingGraph):
...
@@ -826,6 +852,14 @@ class FusedCSCSamplingGraph(SamplingGraph):
nodes
=
self
.
_convert_to_homogeneous_nodes
(
nodes
)
nodes
=
self
.
_convert_to_homogeneous_nodes
(
nodes
)
self
.
_check_sampler_arguments
(
nodes
,
fanouts
,
probs_name
)
self
.
_check_sampler_arguments
(
nodes
,
fanouts
,
probs_name
)
if
random_seed
is
not
None
:
assert
(
1
<=
len
(
random_seed
)
<=
2
),
"There should be a 1 or 2 random seeds."
if
len
(
random_seed
)
==
2
:
assert
(
0
<=
seed2_contribution
<=
1
),
"seed2_contribution should be in [0, 1]."
has_original_eids
=
(
has_original_eids
=
(
self
.
edge_attributes
is
not
None
self
.
edge_attributes
is
not
None
and
ORIGINAL_EDGE_ID
in
self
.
edge_attributes
and
ORIGINAL_EDGE_ID
in
self
.
edge_attributes
...
...
python/dgl/graphbolt/impl/neighbor_sampler.py
View file @
74c5e31d
...
@@ -483,7 +483,7 @@ class LayerNeighborSampler(NeighborSamplerImpl):
...
@@ -483,7 +483,7 @@ class LayerNeighborSampler(NeighborSamplerImpl):
Sampler that builds computational dependency of node representations via
Sampler that builds computational dependency of node representations via
labor sampling for multilayer GNN from the NeurIPS 2023 paper
labor sampling for multilayer GNN from the NeurIPS 2023 paper
`Layer-Neighbor Sampling -- Defusing Neighborhood Explosion in GNNs
`Layer-Neighbor Sampling -- Defusing Neighborhood Explosion in GNNs
<https://
arxiv.org/abs/2210.13339
>`__
<https://
proceedings.neurips.cc/paper_files/paper/2023/file/51f9036d5e7ae822da8f6d4adda1fb39-Paper-Conference.pdf
>`__
Layer-Neighbor sampler is responsible for sampling a subgraph from given
Layer-Neighbor sampler is responsible for sampling a subgraph from given
data. It returns an induced subgraph along with compacted information. In
data. It returns an induced subgraph along with compacted information. In
...
@@ -526,6 +526,19 @@ class LayerNeighborSampler(NeighborSamplerImpl):
...
@@ -526,6 +526,19 @@ class LayerNeighborSampler(NeighborSamplerImpl):
Boolean indicating whether seeds between hops will be deduplicated.
Boolean indicating whether seeds between hops will be deduplicated.
If True, the same elements in seeds will be deleted to only one.
If True, the same elements in seeds will be deleted to only one.
Otherwise, the same elements will be remained.
Otherwise, the same elements will be remained.
layer_dependency: bool
Boolean indicating whether different layers should use the same random
variates. Results in a reduction in the number of nodes sampled and
turns LayerNeighborSampler into a subgraph sampling method. Later layers
will be guaranteed to sample overlapping neighbors as the previous
layers.
batch_dependency: int
Specifies whether consecutive minibatches should use similar random
variates. Results in a higher temporal access locality of sampled
nodes and edges. Setting it to :math:`
\\
kappa` slows down the change in
the random variates proportional to :math:`
\f
rac{1}{
\\
kappa}`. Implements
the dependent minibatching approach in `arXiv:2310.12403
<https://arxiv.org/abs/2310.12403>__.
Examples
Examples
-------
-------
...
...
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