QAT : Could not run 'aten::add.out'


How is it possible that a simple addition is not working out of the box in QAT with Pytorch 2.0 ?
If I take the QAT example from “Quantization — PyTorch 2.1 documentation” and only add a skip connection :

def forward(self, x):
        x = self.quant(x)
        _x = x # NEW
        x = self.conv(x)
        x =
        x = self.relu(x)
        x = x + _x # NEW
        x = self.dequant(x)
        return x

I get the error :

NotImplementedError: Could not run ‘aten::add.out’ 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 Internal Login for possible resolutions. ‘aten::add.out’ is only available for these backends: [CPU, CUDA, Meta, …].

Did I miss something ?

you would need to use FloatFunctional to wrap the add operation. The QAT tutorial has more details on how to do this (beta) Static Quantization with Eager Mode in PyTorch — PyTorch Tutorials 2.0.0+cu117 documentation