code: def _test_calibrate_qlinear(
      batch_size, tokens, embeddings, use_bias, activations, device
  ):
      linear = torch.nn.Linear(
          embeddings, embeddings, bias=use_bias
      ).to(device)
      qlinear = QLinear.from_module(linear, activations=activations)
      qinputs = random_qtensor(
          (batch_size,) + (tokens, embeddings), dtype=torch.float32
      ).to(device)
      # Run a first inference without Calibration
      with torch.no_grad():
          qout = qlinear(qinputs)
      assert torch.all(qlinear.input_scale == 1)
      assert torch.all(qlinear.output_scale == 1)
      # Calibrate to adjust input and output scales and set the correct dtype
      with torch.no_grad(), Calibration():
          qout = qlinear(qinputs)
      assert qout.itype == activations
      assert torch.any(qlinear.input_scale != 1)
      assert torch.any(qlinear.output_scale != 1)
  
file_path: quanto/test/nn/test_calibrate.py
imports: import pytest
  import torch
  from helpers import random_qtensor
  from quanto import Calibration
  from quanto.nn import QLinear
label_desc: Use image node_id 1 for calling a global function with example usage: _test_calibrate_qlinear(batch_size, tokens, embeddings, use_bias, activations, device) without return types