code: def test_quantize_loading_behavior(self):
      # test nn.Module
      model = resnet18()
      input_sample = torch.randn(1, 3, 224, 224)
      # test pytorch_fx
      qmodel = InferenceOptimizer.quantize(
          model, calib_data=input_sample
      )
      with tempfile.TemporaryDirectory() as tmp_dir_name:
          InferenceOptimizer.save(qmodel, tmp_dir_name)
          load_model = InferenceOptimizer.load(
              tmp_dir_name, model=model
          )
      with InferenceOptimizer.get_context(load_model):
          load_model(input_sample)
  
      if compare_version("neural_compressor", operator.ge, "2.0"):
          # save & load of INC ipex quantized model only works when inc version >= 2.0
          # test pytorch_ipex with wrong input
          qmodel = InferenceOptimizer.quantize(
              model, calib_data=input_sample, method="ipex"
          )
          with tempfile.TemporaryDirectory() as tmp_dir_name:
              InferenceOptimizer.save(qmodel, tmp_dir_name)
              with pytest.raises(
                  RuntimeError,
                  match="For INC ipex quantizated model, you need to set input_sample when loading model.",
              ):
                  load_model = InferenceOptimizer.load(
                      tmp_dir_name, model=model
                  )
  
          # test pytorch_ipex with right input
          qmodel = InferenceOptimizer.quantize(
              model, calib_data=input_sample, method="ipex"
          )
          with tempfile.TemporaryDirectory() as tmp_dir_name:
              InferenceOptimizer.save(qmodel, tmp_dir_name)
              load_model = InferenceOptimizer.load(
                  tmp_dir_name, model=model, input_sample=input_sample
              )
          with InferenceOptimizer.get_context(load_model):
              load_model(input_sample)
  
imports: import os
  import operator
  import tempfile
  from unittest import TestCase
  import pytest
  import torch
  from pytorch_lightning import LightningModule
  from torch import nn
  from test.pytorch.utils._train_torch_lightning import create_data_loader, data_transform
  import torchmetrics
  from torchvision.models import resnet18
  from bigdl.nano.pytorch import Trainer
  from bigdl.nano.pytorch import InferenceOptimizer
  from bigdl.nano.pytorch.vision.models import vision
  from bigdl.nano.utils.common import invalidOperationError
  from bigdl.nano.utils.common import compare_version
  from bigdl.nano.utils.pytorch import TORCH_VERSION_LESS_2_0
  from bigdl.nano.utils.common import _avx2_checker
label_desc: Use image node_id 9 for calling the TestINC obj's underlying member method code with example usage: obj.test_quantize_loading_behavior() without return types