While I don’t think it works out of the box, you could try to adapt the observers and fake quant layers to be more flexible. For example, there are some obvious 8 bit hard coded values here:

  
      github.com
  
  
    pytorch/pytorch/blob/a414bd69de8d01af44751bfe327703ec997dafd9/torch/quantization/observer.py#L146 3

    Learned Step Size Quantization: https://openreview.net/pdf?id=rkgO66VKDS
    Trained Quantization Thresholds: https://arxiv.org/pdf/1903.08066.pdf
    """
    # The variable names are prefixed with "initial" because their values (qmin and qmax) might be adjusted
    # based on whether quantization range is reduced and the datatype (signed/unsigned) used by the observer.
    initial_qmin, initial_qmax = initial_dynamic_qrange
    assert initial_qmin <= 0 <= initial_qmax, "Dynamic quantization range must include 0."
    assert initial_qmin < initial_qmax, "qmin must be strictly less than qmax for dynamic quantization range."

@torch.jit.export
def _calculate_qmin_qmax(self):
    # type: () -> Tuple[int, int]
    r"""Calculates actual qmin and qmax based on the quantization range,
    observer datatype and if range is reduced.
    """
    if self.is_dynamic_qrange:
        # This initialization here is to be resolve TorchScript compilation issues and allow
        # using of refinement to decouple initial_qmin and initial_qmax from quantization range.
        # The actual values of initial_qmin and initial_qmax will be reset below.
        initial_qmin, initial_qmax = 0, 255
        # The following assignment of initial_qrange to a local variable and the if check refine the