I also have a error like this:
Test_Quantization Epoch #0:   0% 0/129 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/content/drive/My Drive/ECG_quantization/main.py", line 89, in <module>
    trainer.testQuant(loader_test, loss_fn, info='Test_Quantization ',quant=True, stats=stats)
  File "/content/drive/My Drive/ECG_quantization/trainer.py", line 202, in testQuant
    preds = quantForward(self.model, data, stats)
  File "/content/drive/My Drive/ECG_quantization/quantized.py", line 192, in quantForward
    x, scale_next, zero_point_next = quantizeLayer(x, model.fc1, stats['fc2'], scale_next, zero_point_next)
  File "/content/drive/My Drive/ECG_quantization/quantized.py", line 79, in quantizeLayer
    x = (layer(X)/ scale_next) + zero_point_next 
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/linear.py", line 93, in forward
    return F.linear(input, self.weight, self.bias)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 1692, in linear
    output = input.matmul(weight.t())
RuntimeError: mat1 dim 1 must match mat2 dim 0

when I run this
stats = gatherStats(model, loader_test)
trainer.testQuant(loader_test, loss_fn, info='Test_Quantization ',quant=True, stats=stats)


And here are my functions:
def quantForward(model, x, stats):
  
  # Quantise before inputting into incoming layers
  x = quantize_tensor(x, min_val=stats['conv1']['min'], max_val=stats['conv1']['max'])
  # print(type(x))

  x, scale_next, zero_point_next = quantizeLayer(x.tensor, model.conv1, stats['conv2'], x.scale, x.zero_point)

  x = model.bn1(x)

  x = F.max_pool1d(x, 2, stride=3)

  x, scale_next, zero_point_next = quantizeLayer(x, model.conv2, stats['conv3'], scale_next, zero_point_next)

  x = model.dropout(x)

  x = model.bn2(x)

  x = F.max_pool1d(x, 2, stride=2)
  
  x, scale_next, zero_point_next = quantizeLayer(x, model.conv3, stats['fc1'], scale_next, zero_point_next)

  x = model.dropout(x)

  x, scale_next, zero_point_next = quantizeLayer(x, model.fc1, stats['fc2'], scale_next, zero_point_next)

  x = model.faltten(x)

  x = model.dropout(x)

  # Back to dequant for final layer
  x = dequantize_tensor(QTensor(tensor=x, scale=scale_next, zero_point=zero_point_next))
   
  x = model.fc2(x)

  return F.log_softmax(x, dim=1)

Could you please help me have a look at it?