ns for fx: expose hook to define custom weight extraction functions (#62047)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/62047
Adds a hook for user to define a weight extraction function for a
custom type.
Example usage:
```
op_to_type_to_weight_extraction_fn = \
get_op_to_type_to_weight_extraction_fn()
op_to_type_to_weight_extraction_fn['call_function'][_wrapped_linear] = \
torch.quantization.ns.weight_utils.get_linear_fun_weight
results = extract_weights_impl(
'a', m1, 'b', m2,
op_to_type_to_weight_extraction_fn=op_to_type_to_weight_extraction_fn)
```
Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs.test_user_defined_function
```
Imported from OSS
Reviewed By: jerryzh168
Differential Revision: D29853625
fbshipit-source-id: 183916ef54ba303bc818e0eba00b52e33c4633ad