code: def test_force_dequant_layernorm(self):
      output_bit = 8
      array = [
          [[i * j * j + j for j in range(5, 15)]]
          for i in range(-10, 10)
      ]
      x_int = torch.tensor(array)
      x_scaling_factor = torch.tensor(0.1)
      x = x_int * x_scaling_factor
  
      ln_dq = IntLayerNorm(
          x.shape[1:], 1e-5, quant_mode=False, output_bit=output_bit
      )
      ln_fdqs_dict = {
          True: [
              IntLayerNorm(
                  x.shape[1:],
                  1e-5,
                  quant_mode=True,
                  output_bit=output_bit,
                  force_dequant="nonlinear",
              ),
              IntLayerNorm(
                  x.shape[1:],
                  1e-5,
                  quant_mode=True,
                  output_bit=output_bit,
                  force_dequant="layernorm",
              ),
          ],
          False: [
              IntLayerNorm(
                  x.shape[1:],
                  1e-5,
                  quant_mode=True,
                  output_bit=output_bit,
                  force_dequant="none",
              ),
              IntLayerNorm(
                  x.shape[1:],
                  1e-5,
                  quant_mode=True,
                  output_bit=output_bit,
                  force_dequant="gelu",
              ),
              IntLayerNorm(
                  x.shape[1:],
                  1e-5,
                  quant_mode=True,
                  output_bit=output_bit,
                  force_dequant="softmax",
              ),
          ],
      }
  
      ln_dq.weight = nn.Parameter(torch.ones(x.shape[1:]))
      ln_dq.bias = nn.Parameter(torch.ones(x.shape[1:]))
      dq, dq_scaling_factor = ln_dq(x, x_scaling_factor)
      for label, ln_fdqs in ln_fdqs_dict.items():
          for ln_fdq in ln_fdqs:
              ln_fdq.weight = nn.Parameter(torch.ones(x.shape[1:]))
              ln_fdq.bias = nn.Parameter(torch.ones(x.shape[1:]))
              q, q_scaling_factor = ln_fdq(x, x_scaling_factor)
              if label:
                  self.assertTrue(torch.allclose(q, dq, atol=1e-4))
              else:
                  self.assertFalse(torch.allclose(q, dq, atol=1e-4))
  
imports: import copy
  import unittest
  from transformers import IBertConfig, is_torch_available
  from transformers.testing_utils import require_torch, slow, torch_device
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 9 for calling the IBertModelIntegrationTest obj's underlying member method code with example usage: obj.test_force_dequant_layernorm() without return types