code: def test_fake_quant_dequant(tensor_shape, groups):
      input_tensor = torch.rand((tensor_shape), dtype=torch.float16).to(
          get_accelerator().device_name()
      )
  
      # 8-bit quantization.
      ref_input_8bit = input_tensor.clone().detach()
      ds_input_8bit = input_tensor.clone().detach()
      ref_out_8bit = quantize_dequantize_ref(ref_input_8bit, 8, groups)
      # run_quant_dequant will do quantize then dequantize, and return the dequantized value.
      ds_out_8bit = run_quant_dequant(ds_input_8bit, groups, 8)
      assert allclose(ds_out_8bit, ref_out_8bit)
  
      # 4-bit quantization.
      ref_input_4bit = input_tensor.clone().detach()
      ds_input_4bit = input_tensor.clone().detach()
      ref_out_4bit = quantize_dequantize_ref(ref_input_4bit, 4, groups)
      ds_out_4bit = run_quant_dequant(ds_input_4bit, groups, 4)
      assert allclose(ds_out_4bit, ref_out_4bit)
  
file_path: DeepSpeed/tests/unit/ops/quantizer/test_fake_quantization.py
imports: import torch
  import pytest
  import deepspeed
  from deepspeed.accelerator import get_accelerator
  from deepspeed.ops.op_builder import QuantizerBuilder
label_desc: Use image node_id 4 for calling a global function with example usage: test_fake_quant_dequant(tensor_shape, groups) without return types