code: def train(model, device, loader, optimizer):
      model.train()
      loss_accum = 0
  
      for step, batch in enumerate(tqdm(loader, desc="Iteration")):
          batch = batch.to(device)
  
          pred = model(batch).view(
              -1,
          )
          optimizer.zero_grad()
          loss = reg_criterion(pred, batch.y)
          loss.backward()
          optimizer.step()
  
          loss_accum += loss.detach().cpu().item()
  
      return loss_accum / (step + 1)
  
file_path: ogb/examples/lsc/pcqm4m-v2/main_gnn.py
imports: import torch
  from torch_geometric.loader import DataLoader
  import torch.optim
  import torch.nn.functional
  from torch.utils.tensorboard import SummaryWriter
  from torch.optim.lr_scheduler import StepLR
  from gnn import GNN
  import os
  from tqdm.auto import tqdm
  import argparse
  import time
  import numpy
  import random
  from ogb.lsc import PygPCQM4Mv2Dataset, PCQM4Mv2Evaluator
label_desc: Use image node_id 1 for calling a global function with example usage: train(model, device, loader, optimizer) and returns: unknown