class_docstr: Tests fake quantize calculate_qparams() method
  by comparing with result from observer calculate_qparams.
  Uses hard-coded values: alpha=1.0, b=4, k=2.
class_docstr_tok: ["Tests","fake","quantize","calculate_qparams","(",")","method","by","comparing","with","result","from","observer","calculate_qparams",".","Uses","hard-coded","values",":","alpha=1.0",",","b=4",",","k=2","."]
code: def test_fake_calc_qparams(self):
      apot_fake = APoTFakeQuantize(b=4, k=2)
      apot_fake.activation_post_process.min_val = torch.tensor([0.0])
      apot_fake.activation_post_process.max_val = torch.tensor([1.0])
  
      (
          alpha,
          gamma,
          quantization_levels,
          level_indices,
      ) = apot_fake.calculate_qparams(signed=False)
  
      observer = APoTObserver(b=4, k=2)
      observer.min_val = torch.tensor([0.0])
      observer.max_val = torch.tensor([1.0])
  
      qparams_expected = observer.calculate_qparams(signed=False)
  
      self.assertEqual(alpha, qparams_expected[0])
      self.assertTrue(torch.equal(gamma, qparams_expected[1]))
      self.assertTrue(
          torch.equal(quantization_levels, qparams_expected[2])
      )
      self.assertTrue(torch.equal(level_indices, qparams_expected[3]))
  
file_path: pytorch/test/quantization/core/experimental/test_fake_quantize.py
imports: import torch
  import unittest
  from torch.ao.quantization.experimental.observer import APoTObserver
  from torch.ao.quantization.experimental.quantizer import quantize_APoT, dequantize_APoT
  from torch.ao.quantization.experimental.fake_quantize import APoTFakeQuantize
  from torch.ao.quantization.experimental.fake_quantize_function import fake_quantize_function
  from torch.autograd import gradcheck
label_desc: Use image node_id 1 for calling the TestFakeQuantize obj's underlying member method code with example usage: obj.test_fake_calc_qparams() without return types