code: def test_quantize_conv1d(batch_size, tokens, embeddings, device):
      conv = Conv1D(embeddings, embeddings).to(device)
      qconv = QConv1D.from_module(conv)
      qinputs = random_qtensor(
          (batch_size,) + (tokens, embeddings), dtype=torch.float32
      ).to(device)
      # Calibrate and obtain quantized outputs
      with torch.no_grad(), Calibration():
          qout = qconv(qinputs)
      # Freeze to set quantized weights
      freeze(qconv)
      # Align conv weights with quantized conv weights for comparison
      conv.weight = torch.nn.Parameter(qconv.weight.dequantize())
      conv.bias = torch.nn.Parameter(qconv.bias.dequantize())
      out = conv(qinputs.dequantize())
      q_assert_close(out, qout)
      # Now run an inference without calibrating
      with torch.no_grad():
          int_qout = qconv(qinputs)
      assert qout._scale == int_qout._scale
      # There may be a slight difference, but of at most one quantization interval
      assert torch.max(torch.abs(qout._data - int_qout._data)) <= 1
  
file_path: quanto/test/nn/test_custom_qmodule.py
imports: import os
  from tempfile import TemporaryDirectory
  import pytest
  import torch
  from helpers import q_assert_close, random_qtensor
  from quanto import Calibration, QModuleMixin, QTensor, freeze, register_qmodule
label_desc: Use image node_id 1 for calling a global function with example usage: test_quantize_conv1d(batch_size, tokens, embeddings, device) without return types