Where is torch.ops.quantized.conv2d defined?

Hello,

I am trying to understand exactly what the function on line 468 of this code does: pytorch/torch/ao/nn/quantized/modules/conv.py at eba28a6f911ad02515be0f22dc814d37b122f1cd · pytorch/pytorch · GitHub .

I have tried tracing back to find the source code for this function (torch.ops.quantized.conv2d) but have been unable to find it yet. I have already quantized models successfully in PyTorch and I am trying to better understand the exact processes/steps in the quantized Conv2D module. Ideally I would prefer a link to the source code instead of getting an explanation as to what it does.

Thanks!

best way to do this is in general is to look in native_functions.yaml or for quantized ops, library.cpp pytorch/aten/src/ATen/native/quantized/library.cpp at main · pytorch/pytorch · GitHub

from there you can search for quantized::conv2d.new you’ll find the file: pytorch/aten/src/ATen/native/quantized/cpu/qconv.cpp at 773ae817f7bd1d428bc1a0bc83ca56f84e0d6a87 · pytorch/pytorch · GitHub