code: def test_link_neighbor_loader_edge_label():
      edge_index = get_random_edge_index(100, 100, 500)
      data = Data(edge_index=edge_index, x=torch.arange(100))
  
      loader = LinkNeighborLoader(
          data,
          num_neighbors=[-1] * 2,
          batch_size=10,
          neg_sampling_ratio=1.0,
      )
  
      for batch in loader:
          assert batch.edge_label.dtype == torch.float
          assert torch.all(batch.edge_label[:10] == 1.0)
          assert torch.all(batch.edge_label[10:] == 0.0)
  
      loader = LinkNeighborLoader(
          data,
          num_neighbors=[-1] * 2,
          batch_size=10,
          edge_label=torch.ones(500, dtype=torch.long),
          neg_sampling_ratio=1.0,
      )
  
      for batch in loader:
          assert batch.edge_label.dtype == torch.long
          assert torch.all(batch.edge_label[:10] == 1)
          assert torch.all(batch.edge_label[10:] == 0)
  
file_path: pytorch_geometric/test/loader/test_link_neighbor_loader.py
imports: import pytest
  import torch
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.loader import LinkNeighborLoader
  from torch_geometric.testing import MyFeatureStore, MyGraphStore, get_random_edge_index, onlyNeighborSampler, withCUDA, withPackage
label_desc: Use image node_id 5 for calling a global function with example usage: test_link_neighbor_loader_edge_label() without return types