code: def test_quantize_scale(input_shape, axis, dtype, itype, device):
      a = random_tensor(input_shape, dtype=dtype).to(device)
      scale = absmax_scale(a, itype, axis)
      qa = QTensor.quantize(a, itype, scale)
      if axis is not None:
          if a.ndim == 1:
              # Quantization is actually per-tensor since the input tensor is a vector
              assert qa.axis is None
          elif a.shape[axis] == 1:
              # Quantization is actually per-tensor as the axis dim is 1
              assert qa.axis is None
          else:
              assert qa.axis == axis
      assert isinstance(qa, QTensor)
      assert qa.itype == itype
      assert qa._scale.dtype == dtype
      assert device_eq(qa.device, device)
      q_assert_close(a, qa)
  
file_path: quanto/test/tensor/test_qtensor.py
imports: import os
  from tempfile import TemporaryDirectory
  import pytest
  import torch
  from helpers import assert_similar, device_eq, q_assert_close, random_qtensor, random_tensor
  from quanto import QTensor, absmax_scale
label_desc: Use image node_id 3 for calling a global function with example usage: test_quantize_scale(input_shape, axis, dtype, itype, device) without return types