code: def pack(self, linear, scales, zeros, g_idx=None):
      self.g_idx = g_idx.clone() if g_idx is not None else self.g_idx
  
      scales = scales.t().contiguous()
      zeros = zeros.t().contiguous()
      scale_zeros = zeros * scales
      self.scales = scales.clone().half()
      if linear.bias is not None:
          self.bias = linear.bias.clone().half()
  
      intweight = []
      for idx in range(self.infeatures):
          intweight.append(
              torch.round(
                  (
                      linear.weight.data[:, idx]
                      + scale_zeros[self.g_idx[idx]]
                  )
                  / self.scales[self.g_idx[idx]]
              ).to(torch.int)[:, None]
          )
      intweight = torch.cat(intweight, dim=1)
      intweight = intweight.t().contiguous()
      intweight = intweight.numpy().astype(np.uint32)
      qweight = np.zeros(
          (intweight.shape[0] // 32 * self.bits, intweight.shape[1]),
          dtype=np.uint32,
      )
      i = 0
      row = 0
      while row < qweight.shape[0]:
          if self.bits in [2, 4, 8]:
              for j in range(i, i + (32 // self.bits)):
                  qweight[row] |= intweight[j] << (self.bits * (j - i))
              i += 32 // self.bits
              row += 1
          else:
              raise NotImplementedError(
                  "Only 2,4,8 bits are supported."
              )
  
      qweight = qweight.astype(np.int32)
      self.qweight = torch.from_numpy(qweight)
  
      zeros -= 1
      zeros = zeros.numpy().astype(np.uint32)
      qzeros = np.zeros(
          (zeros.shape[0], zeros.shape[1] // 32 * self.bits),
          dtype=np.uint32,
      )
      i = 0
      col = 0
      while col < qzeros.shape[1]:
          if self.bits in [2, 4, 8]:
              for j in range(i, i + (32 // self.bits)):
                  qzeros[:, col] |= zeros[:, j] << (self.bits * (j - i))
              i += 32 // self.bits
              col += 1
          else:
              raise NotImplementedError(
                  "Only 2,4,8 bits are supported."
              )
  
      qzeros = qzeros.astype(np.int32)
      self.qzeros = torch.from_numpy(qzeros)
  
file_path: text-generation-inference/server/text_generation_server/utils/gptq/quant_linear.py
imports: import math
  import numpy
  import torch
  import torch.nn
  from torch.cuda.amp import custom_bwd, custom_fwd
label_desc: Use image node_id 3 for calling the QuantLinear obj's underlying member method code with example usage: obj.pack(linear, scales, zeros, g_idx) without return types