aidanaranjo:

The error is in the line 70: RuntimeError: Could not run ‘aten::add_.Tensor’ with arguments from the ‘QuantizedCPU’ backend. This could be because the operator doesn’t exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. ‘aten::add_.Tensor’ is only available for these backends: [CPU, MkldnnCPU, SparseCPU, Meta, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradNestedTensor, UNKNOWN_TENSOR_TYPE_ID, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].


This means the input of aten::add_ is a quantized Tensor. To address the problem you can either
(1). place a DequantStub and QuantStub around the aten::add_ op.
e.g.
def __init__(...):
    ...
    self.quant = torch.quantization.QuantStub()
    self.dequant = torch.quantization.DeQuantStub()
   ...

def forward(...):
     ...
     self.dequant(x)
     x += ...
     self.quant(x)
     ...

or
(2). quantize aten::add_ by replacing it with FloatFunctional(pytorch/functional_modules.py at master · pytorch/pytorch · GitHub 123)