Unknown custom class type quantized.Conv2dPackedParamsBase. Please ensure it is registered

After converting a pytorch model by using torch.jit.script and calling optimize_for_mobile, the model fails to load on iOS on a real device with the following error.

libc++abi: terminating with uncaught exception of type torch::jit::ErrorReport: 
Unknown custom class type quantized.Conv2dPackedParamsBase. Please ensure it is registered.:
quantized::conv1d(Tensor qx, __torch__.torch.classes.quantized.Conv2dPackedParamsBase packed_weight, float output_scale, int output_zero_point) -> Tensor
                                                               ~~~~~~~~~~~~~~~~~~~~~~ <--- HERE

terminating with uncaught exception of type torch::jit::ErrorReport: 
Unknown custom class type quantized.Conv2dPackedParamsBase. Please ensure it is registered.:
quantized::conv1d(Tensor qx, __torch__.torch.classes.quantized.Conv2dPackedParamsBase packed_weight, float output_scale, int output_zero_point) -> Tensor

How should I start debugging this? We do not use any quantization of any sort in our model.

I have tried disabling the optimzation’s using:

                                              optimization_blocklist={
                                                  HOIST_CONV_PACKED_PARAMS,
                                                  CONV_BN_FUSION,
                                                  INSERT_FOLD_PREPACK_OPS,
                                                  FUSE_ADD_RELU
                                              })
1 Like