code: def main():
      pl_model = LightningModule(
          model,
          loss,
          optimizer,
          metrics=[
              torchmetrics.F1Score(
                  "multiclass", num_classes=num_classes
              ),
              torchmetrics.Accuracy(
                  "multiclass", num_classes=num_classes
              ),
          ],
      )
      data_loader = create_data_loader(
          data_dir, batch_size, num_workers, data_transform
      )
      # get the loss function without reduction
      loss_fn = nn.CrossEntropyLoss(reduction="none")
      # pass proper arguments to selective backprop,
      # note that loss_fn must be passed to it
      sb = SelectiveBackprop(
          start=0.5,
          keep=0.5,
          end=0.9,
          scale_factor=1,
          interrupt=2,
          loss_fn=loss_fn,
      )
      # check if selective backprop works
      batch_size_check = CheckBatchSize(
          start=0.5,
          keep=0.5,
          end=0.9,
          interrupt=2,
          batch_size=batch_size,
      )
      # pass the algorithm by algorithms=[sb,]
      trainer = Trainer(
          max_epochs=10,
          log_every_n_steps=1,
          algorithms=[sb],
          callbacks=[batch_size_check],
      )
      trainer.fit(pl_model, data_loader, data_loader)
  
imports: import os
  import torch
  import torchmetrics
  from torch import nn
  from torchvision.datasets import CIFAR10
  from torch.utils.data import DataLoader
  import torchvision.transforms
  from torch.utils.data.sampler import SequentialSampler
  import pytorch_lightning
  from pytorch_lightning.callbacks import Callback
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from typing import Any
  from bigdl.nano.pytorch.lightning import LightningModule
  from bigdl.nano.pytorch import Trainer
  from bigdl.nano.pytorch.vision.models import vision
  from bigdl.nano.pytorch.algorithms.selective_backprop import SelectiveBackprop
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types