code: def test_quantize_dequantize_per_tensor(
      self,
      quant_dtype,
      input_rank,
      is_zp_present,
      zp_dtype,
      are_params_tensors,
  ):
      input_shape = [
          *np.random.randint(low=1, high=5, size=(input_rank,))
      ]
      scale = np.random.rand()
      zero_point = 0
      if is_zp_present:
          low = (
              0
              if quant_dtype == torch.quint8 or zp_dtype == np.uint8
              else -128
          )
          high = (
              128
              if quant_dtype == torch.qint8 or zp_dtype == np.int8
              else 256
          )
          zero_point = np.random.randint(low, high, dtype=zp_dtype)
      if are_params_tensors:
          scale = torch.tensor([scale])
          zero_point = torch.tensor([zero_point])
  
      class Model(torch.nn.Module):
          def forward(self, x):
              quantized = torch.quantize_per_tensor(
                  x, scale, zero_point, quant_dtype
              )
              dequantized = torch.dequantize(quantized)
              return dequantized
  
      model = Model()
      if quant_dtype == torch.qint32:
          with pytest.raises(
              ValueError,
              match=r"MIL quantization dtype must be int8 or uint8",
          ):
              self.run_compare_torch([input_shape], model)
      else:
          self.run_compare_torch(
              [input_shape], model, atol=5e-4, rtol=5e-4
          )
  
imports: import itertools
  from typing import Optional
  import numpy
  import pytest
  import torch
  import torchvision
  import coremltools
  from coremltools import TensorType
  from coremltools._deps import _HAS_TORCH, _HAS_TORCH_VISION, MSG_TORCH_NOT_FOUND, MSG_TORCH_VISION_NOT_FOUND
  from coremltools.converters.mil.testing_utils import get_op_types_in_program
  from .testing_utils import TorchBaseTest
label_desc: Use image node_id 1 for calling the TestPyTorchQuantizationOps obj's underlying member method code with example usage: obj.test_quantize_dequantize_per_tensor(quant_dtype, input_rank, is_zp_present, zp_dtype, are_params_tensors) and returns: dequantized