code: def test_static_quantized_inference(self):
      qlinear = QuantizedLinear(10, 5, mode="EMA")
      weight = qlinear.weight.data.detach()
      weight_scale = get_dynamic_scale(weight, 8)
      weight_int = quantize_np(weight, weight_scale, 8)
      self.assertTrue((weight_int == torch.round(weight_int)).all())
      self.assertTrue(weight_int.abs().max() <= 127)
      x = torch.randn(3, 10) * 2**0.5 - 0.36
      x_thresh = 3.0
      output_thresh = 2.3
      output_scale = 127.0 / output_thresh
      x_scale = 127.0 / x_thresh
      qlinear.input_thresh = torch.tensor(x_thresh)
      qlinear.output_thresh = torch.tensor(output_thresh)
      x_int = quantize_np(x, x_scale, 8)
      self.assertTrue((x_int == torch.round(x_int)).all())
      self.assertTrue(x_int.abs().max() <= 127)
      bias = qlinear.bias.data
      bias_scale = x_scale * weight_scale
      bias_int = quantize_np(bias, bias_scale, 32)
      self.assertTrue((bias_int == torch.round(bias_int)).all())
      self.assertTrue(bias_int.abs().max() <= 2 ** (32 - 1) - 1)
      output_int = x_int @ weight_int.t() + bias_int
      output_int = torch.clamp(
          output_int, -(2 ** (32 - 1) - 1), 2 ** (32 - 1) - 1
      )
      output = (
          torch.round(output_int / bias_scale * output_scale).clamp(
              -127, 127
          )
          / output_scale
      )
      qlinear.eval()
      qlinear_output = qlinear(x)
      self.assertTrue((qlinear_output - output).norm() < 10**-6)
  
imports: import unittest
  import numpy
  import torch
  from torch import nn
  from torch.nn import functional
  from nlp_architect.nn.torch.quantization import FakeLinearQuantizationWithSTE, QuantizedLinear, get_dynamic_scale, get_scale, QuantizedEmbedding
label_desc: Use image node_id 2 for calling the QuantizedLinearTest obj's underlying member method code with example usage: obj.test_static_quantized_inference() without return types