NeighborLoader with time_attr

I’m initializing a graph data with time_attr set and wants a NeighborLoader that return all the nodes that has smaller time_attr than the sampled node and below is my code.

import torch
import numpy as np
from torch_geometric.data import Data

data = Data()
data.node_id = torch.arange(10)
data.x = torch.tensor([[x, x**2] for x in range(10)])
temp = np.tril(np.ones((data.num_nodes, data.num_nodes)), k = -1)
u, v = np.where(temp!=0)
data.edge_index = torch.tensor(np.array([u,v]), dtype = torch.long)  #setting edges so that it'll be following time constraint. but in future I want to remove this to all connection between all the nodes
data.time_attr = torch.arange(10)


from torch_geometric.loader import NeighborLoader
loader = NeighborLoader(data, num_neighbors=[10], batch_size=1,
                        time_attr='time_attr', shuffle = False)
for batch in loader:
     print(b.x, b.edge_index, b.input_id)
>>tensor([[0, 0]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([0])
tensor([[1, 1]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([1])
tensor([[2, 4]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([2])
tensor([[3, 9]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([3])
tensor([[ 4, 16]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([4])
tensor([[ 5, 25]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([5])
tensor([[ 6, 36]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([6])
tensor([[ 7, 49]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([7])
tensor([[ 8, 64]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([8])
tensor([[ 9, 81]]) tensor([], size=(2, 0), dtype=torch.int64) tensor([9])

can anybody help me how to accomplish this as my code is not giving proper output or what I’m missing!!?

And another thing is there’s two sampler in docs:

  1. torch_geometric.sampler.NeighborSampler
  2. torch_geometric.loader.NeighborSampler so what is the difference between these two and why there’s mentioned that 2nd NeighborSampler will be deprecated, use NeighborLoader?