@@ -27,11 +27,15 @@ class RecencyNeighborHook(StatefulHook, SeedableHook):
2727 id (str): A unique identifier for the hook. The hook’s name and all attributes it produces will be suffixed with this `id`.
2828
2929 Note:
30- The order of the output tensors respect the order of seed_nodes_keys.
30+ - RecencyNeighborSamplerHook assumes queries occur in chronological order.
31+ Query timestamp is significantly behind the buffer's current timestamp.
32+ Results may be incomplete or incorrect.
33+ - The order of the output tensors respect the order of seed_nodes_keys.
3134 For instance, for seed node keys ['edge_src', 'edge_dst', 'neg'] will have the first output index (hop 0) contain the concatenation
3235 of batch.edge_src, batch.edge_dst, batch.neg (in that order). The next index (hop 1) will contain first-hop neighbors of batch.edge_src
3336 followed by first-hop neighbors of batch.edge_dst, and then those of batch.neg. This pattern repeats for deeper hops.
3437
38+
3539 Raises:
3640 ValueError: If the num_nbrs list is empty or has non-positive entries.
3741 ValueError: If len(seed_nodes_keys) != len(seed_times_keys).
@@ -62,6 +66,12 @@ def __init__(
6266 if not all ([isinstance (x , int ) and (x > 0 ) for x in num_nbrs ]):
6367 raise ValueError ('Each value in num_nbrs must be a positive integer' )
6468
69+ logger .warning (
70+ "RecencyNeighborSamplerHook: query timestamp is significantly behind the buffer's "
71+ 'current timestamp. Results may be incomplete or incorrect. '
72+ 'This hook assumes queries occur in chronological order.'
73+ )
74+
6575 self ._num_nodes = num_nodes
6676 self ._num_nbrs = num_nbrs
6777 self ._max_nbrs = max (num_nbrs )
@@ -233,6 +243,13 @@ def _get_seed_tensors(
233243 def _get_recency_neighbors (
234244 self , node_ids : torch .Tensor , query_times : torch .Tensor , k : int
235245 ) -> Tuple [torch .Tensor , ...]:
246+ if query_times .min () < self ._nbr_times .min ():
247+ logger .warning (
248+ "RecencyNeighborSamplerHook: query timestamp is significantly behind the buffer's "
249+ 'current timestamp. Results may be incomplete or incorrect. '
250+ 'This hook assumes queries occur in chronological order.'
251+ )
252+
236253 assert self ._nbr_feats is not None # For mypy
237254 B = self ._max_nbrs # buffer size
238255
0 commit comments