"git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "aed161e63f02233b56aaff8ef54c670d71f938da"
Unverified Commit 74c5e31d authored by Muhammed Fatih BALIN's avatar Muhammed Fatih BALIN Committed by GitHub
Browse files

[GraphBolt][Doc] Update `layer_neighbor` documentation for new args. (#7212)

parent 858c0b86
...@@ -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
......
...@@ -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:`\frac{1}{\\kappa}`. Implements
the dependent minibatching approach in `arXiv:2310.12403
<https://arxiv.org/abs/2310.12403>__.
Examples Examples
------- -------
......
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