code: def test_quantize_per_tensor(input_shape, itype, dtype, zp, device):
      a = random_tensor(input_shape, dtype=dtype).to(device) + zp
      qa = QBitsTensor.quantize(a, itype=itype)
      assert isinstance(qa, QBitsTensor)
      assert qa.dtype == dtype
      assert qa.itype == itype
      assert device_eq(qa.device, device)
      q_assert_close(a, qa)
  
file_path: quanto/test/tensor/test_qbitstensor.py
imports: import io
  import pytest
  import torch
  from helpers import device_eq, q_assert_close, random_tensor
  from quanto import QBitsTensor, int2, int4
label_desc: Use image node_id 2 for calling a global function with example usage: test_quantize_per_tensor(input_shape, itype, dtype, zp, device) without return types