code: def train(dataset, model, epoch, optim, args, neg_k=1, w=None):
      model.train()
      with timer(name="Sample"):
          S = UniformSample_original_python(dataset)
      users, posItems, negItems = shuffle(S[:, 0], S[:, 1], S[:, 2])
      users = paddle.to_tensor(users, dtype="int64")
      posItems = paddle.to_tensor(posItems, dtype="int64")
      negItems = paddle.to_tensor(negItems, dtype="int64")
      batch_size = int(args.batch_size)
      total_batch = len(users) // batch_size + 1
      avg_loss = 0.0
      pbar = tqdm(
          minibatch(users, posItems, negItems, batch_size=batch_size)
      )
      for batch_i, (batch_users, batch_pos, batch_neg) in enumerate(
          pbar
      ):
          loss, reg_loss = model.bpr_loss(
              batch_users, batch_pos, batch_neg
          )
          reg_loss = reg_loss * args.decay
          loss = loss + reg_loss
          loss.backward()
          optim.step()
          optim.clear_grad()
          avg_loss += loss.numpy()
          pbar.set_description(f"losses: {avg_loss[0]/(batch_i+1)}")
  
      avg_loss = avg_loss / total_batch
      time_info = timer.dict()
      timer.zero()
      return f"loss{avg_loss[0]:.3f}-{time_info}"
  
file_path: PGL/examples/lightgcn/train.py
imports: import pgl
  import paddle
  import paddle.nn
  from dataloader import Loader
  from model import *
  from utils import *
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import time
  import multiprocessing
  from tqdm import tqdm
  from time import time
  import argparse
label_desc: Use image node_id 1 for calling a global function with example usage: train(dataset, model, epoch, optim, args, neg_k, w) and returns: str, avg_loss, str, time_info