code: def train(net, opt, scheduler, train_loader, dev):
      net.train()
  
      total_loss = 0
      num_batches = 0
      total_correct = 0
      count = 0
      loss_f = nn.CrossEntropyLoss()
      start_time = time.time()
      with tqdm.tqdm(train_loader, ascii=True) as tq:
          for data, label in tq:
              data = data.data.numpy()
              data = provider.random_point_dropout(data)
              data[:, :, 0:3] = provider.random_scale_point_cloud(
                  data[:, :, 0:3]
              )
              data[:, :, 0:3] = provider.jitter_point_cloud(
                  data[:, :, 0:3]
              )
              data[:, :, 0:3] = provider.shift_point_cloud(
                  data[:, :, 0:3]
              )
              data = torch.tensor(data)
              label = label[:, 0]
  
              num_examples = label.shape[0]
              data, label = data.to(dev), label.to(dev).squeeze().long()
              opt.zero_grad()
              logits = net(data)
              loss = loss_f(logits, label)
              loss.backward()
              opt.step()
  
              _, preds = logits.max(1)
  
              num_batches += 1
              count += num_examples
              loss = loss.item()
              correct = (preds == label).sum().item()
              total_loss += loss
              total_correct += correct
  
              tq.set_postfix(
                  {
                      "AvgLoss": "%.5f" % (total_loss / num_batches),
                      "AvgAcc": "%.5f" % (total_correct / count),
                  }
              )
      print(
          "[Train] AvgLoss: {:.5}, AvgAcc: {:.5}, Time: {:.5}s".format(
              total_loss / num_batches,
              total_correct / count,
              time.time() - start_time,
          )
      )
      scheduler.step()
  
file_path: dgl/examples/pytorch/pointcloud/point_transformer/train_cls.py
imports: import argparse
  import os
  import time
  from functools import partial
  import provider
  import torch
  import torch.nn
  import tqdm
  from dgl.data.utils import download, get_download_dir
  from ModelNetDataLoader import ModelNetDataLoader
  from point_transformer import PointTransformerCLS
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 for calling a global function with example usage: train(net, opt, scheduler, train_loader, dev) without return types