code: def test_trim_to_layer_with_neighbor_loader():
      x = torch.randn(14, 16)
      edge_index = torch.tensor(
          [
              [2, 3, 4, 5, 7, 7, 10, 11, 12, 13],
              [0, 1, 2, 3, 2, 3, 7, 7, 7, 7],
          ]
      )
      edge_weight = torch.rand(edge_index.size(1))
      data = Data(x=x, edge_index=edge_index, edge_weight=edge_weight)
  
      loader = NeighborLoader(
          data,
          num_neighbors=[1, 2, 4],
          batch_size=2,
          shuffle=False,
      )
      batch = next(iter(loader))
  
      model = GNN(num_layers=3)
      out1 = model(batch.x, batch.edge_index, batch.edge_weight)[:2]
      assert out1.size() == (2, 16)
  
      out2 = model(
          batch.x,
          batch.edge_index,
          batch.edge_weight,
          batch.num_sampled_nodes,
          batch.num_sampled_edges,
      )[:2]
      assert out2.size() == (2, 16)
  
      assert torch.allclose(out1, out2, atol=1e-6)
  
imports: from typing import List, Optional
  import torch
  from torch import Tensor
  import torch_geometric.typing
  from torch_geometric.data import Data
  from torch_geometric.loader import NeighborLoader
  from torch_geometric.nn import GraphConv
  from torch_geometric.testing import withPackage
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import trim_to_layer
  from torch_geometric.utils._trim_to_layer import trim_sparse_tensor
label_desc: Use image node_id 4 for calling a global function with example usage: test_trim_to_layer_with_neighbor_loader() without return types