code: def train(trim=False):
      for batch in tqdm(loader):
          optimizer.zero_grad()
          batch = batch.to(device)
  
          if not trim:
              out = model(batch.x, batch.edge_index)
          else:
              out = model(
                  batch.x,
                  batch.edge_index,
                  num_sampled_nodes_per_hop=batch.num_sampled_nodes,
                  num_sampled_edges_per_hop=batch.num_sampled_edges,
              )
  
          out = out[: batch.batch_size]
          y = batch.y[: batch.batch_size]
  
          loss = F.cross_entropy(out, y)
          loss.backward()
          optimizer.step()
  
imports: import os.path
  import torch
  import torch.nn.functional
  from tqdm import tqdm
  from torch_geometric.datasets import Reddit
  from torch_geometric.loader import NeighborLoader
  from torch_geometric.nn.models.basic_gnn import GraphSAGE
label_desc: Use image node_id 1 for calling a global function with example usage: train(trim) without return types