code: def train(self):
      model = CustomResNet()
      loss_func = torch.nn.CrossEntropyLoss()
      optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
      train_loader = create_data_loader(
          data_dir, batch_size, num_workers, data_transform
      )
  
      model, optimizer, train_loader = self.setup(
          model, optimizer, train_loader
      )
  
      model.train()
  
      num_epochs = 1
      for _i in range(num_epochs):
          total_loss, num = 0, 0
          for X, y in train_loader:
              optimizer.zero_grad()
              loss = loss_func(model(X), y)
              self.backward(loss)
              optimizer.step()
  
              total_loss += loss.sum()
              num += 1
          print(f"avg_loss: {total_loss / num}")
  
imports: import os
  import pytest
  import torch
  from unittest import TestCase
  from bigdl.nano.pytorch import Trainer
  from bigdl.nano.pytorch import TorchNano
  from bigdl.nano.utils.pytorch import TORCH_VERSION_LESS_1_12, TORCH_VERSION_LESS_2_0
  from torchvision.models.resnet import ResNet, BasicBlock
  from torchmetrics.functional import accuracy
  import pytorch_lightning
  import torch.nn.functional
  from test.pytorch.utils._train_torch_lightning import create_data_loader, data_transform
  from test.pytorch.utils._train_torch_lightning import create_test_data_loader
label_desc: Use image node_id 1 for calling the MyNano obj's underlying member method code with example usage: obj.train() without return types