code: def trainingggg_loop(
      model, optimizer, train_loader, val_loader, num_epochs, loss_func
  ):
      # EPOCH LOOP
      for epoch in range(num_epochs):
          # TRAINING LOOP
          model.train()
          train_loss, num = 0, 0
          with tqdm(train_loader, unit="batch") as tepoch:
              for data, target in tepoch:
                  tepoch.set_description(f"Epoch {epoch}")
                  optimizer.zero_grad()
                  output = model(data)
                  loss = loss_func(output, target)
                  loss.backward()
                  optimizer.step()
                  loss_value = loss.sum()
                  train_loss += loss_value
                  num += 1
                  tepoch.set_postfix(loss=loss_value)
              print(
                  f"Train Epoch: {epoch}, avg_loss: {train_loss / num}"
              )
  
file_path: BigDL/python/nano/tutorial/training/pytorch/pytorch_train_ipex_decorator.py
imports: import torch
  from torch import nn
  from torch.utils.data import DataLoader
  from torchvision import transforms
  from torchvision.models import resnet18
  from torchvision.datasets import OxfordIIITPet
  from tqdm import tqdm
  from bigdl.nano.pytorch import nano
label_desc: Use image node_id 2 for calling a global function with example usage: trainingggg_loop(model, optimizer, train_loader, val_loader, num_epochs, loss_func) without return types