code: def before_val_epoch(self, runner):
      if (
          runner.config["ipex"]
          and runner.config["int8"]
          and runner.config["calibration"]
      ):
          print("running int8 calibration step\n")
          import intel_extension_for_pytorch as ipex
          from torch.ao.quantization import (
              MinMaxObserver,
              PerChannelMinMaxObserver,
              QConfig,
          )
  
          qconfig = QConfig(
              activation=MinMaxObserver.with_args(
                  qscheme=torch.per_tensor_symmetric, dtype=torch.qint8
              ),
              weight=PerChannelMinMaxObserver.with_args(
                  dtype=torch.qint8, qscheme=torch.per_channel_symmetric
              ),
          )
          x = torch.randn(1, 3, 224, 224)
          prepared_model = ipex.quantization.prepare(
              runner.model, qconfig, x, inplace=True
          )
          with torch.no_grad():
              for i, (images, target) in enumerate(runner.val_loader):
                  images = images.contiguous(
                      memory_format=torch.channels_last
                  )
                  prepared_model(images)
                  if i == 4:
                      print(i)
                      break
              prepared_model.save_qconf_summary(
                  runner.config["configure_dir"]
              )
              print(".........calibration step done..........")
  
      if not runner.num_steps:
          runner.num_steps = len(runner.val_loader)
      invalidInputError(
          runner.num_steps > runner.config["warmup_iterations"],
          "total steps should be larger than warmup iterations",
      )
  
      if runner.config["dummy"]:
          images = torch.randn(runner.config["batch"], 3, 224, 224)
          target = torch.arange(1, runner.config["batch"] + 1).long()
          # Only do the conversion once for dummy data
          if runner.config["ipex"]:
              images = images.contiguous(
                  memory_format=torch.channels_last
              )
          if runner.config["bf16"]:
              images = images.to(torch.bfloat16)
          runner.put("images", images)
          runner.put("target", target)
  
      if runner.config["warmup_iterations"] > 0:
          print("running warmup iterations")
  
file_path: BigDL/python/orca/example/learn/pytorch/resnet50/inference.py
imports: import os
  import argparse
  import torch
  import torch.nn
  import torch.utils.data
  import torchvision.transforms
  import torchvision.datasets
  import torchvision.models
  from bigdl.dllib.utils.log4Error import *
  from bigdl.orca import init_orca_context, stop_orca_context
  from bigdl.orca.learn.pytorch.callbacks import MainCallback
label_desc: Use image node_id 1 for calling the ResNetPerfCallback obj's underlying member method code with example usage: obj.before_val_epoch(runner) without return types