Skip to content

Commit

Permalink
Update on "[reland][quant][eagermode] Move custom_module registration…
Browse files Browse the repository at this point in the history
… to prepare/convert_custom_config_dict (#46293)"

Summary:

Test Plan: Imported from OSS

Reviewed By: raghuramank100

Differential Revision: [D24322747](https://our.internmc.facebook.com/intern/diff/D24322747)

[ghstack-poisoned]
  • Loading branch information
jerryzh168 committed Oct 15, 2020
1 parent fa3fd4c commit b33febb
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions torch/quantization/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,16 @@ def prepare(model, inplace=False, allow_list=None,
`prepare_custom_config_dict`: customization configuration dictionary for prepare function
Example:
prepare_custom_config_dict = {
# user will manually define the corresponding observed
# module class which has a from_float class method that converts
# float custom module to observed custom module
"float_to_observed_custom_module_class": {
CustomModule: ObservedCustomModule
}
}
.. testcode::
prepare_custom_config_dict = {
# user will manually define the corresponding observed
# module class which has a from_float class method that converts
# float custom module to observed custom module
"float_to_observed_custom_module_class": {
CustomModule: ObservedCustomModule
}
}
"""
torch._C._log_api_usage_once("quantization_api.quantize.prepare")
Expand Down Expand Up @@ -410,14 +412,15 @@ def convert(
`convert_custom_config_dict`: custom configuration dictionary for convert function
Example:
convert_custom_config_dict = {
# user will manually define the corresponding quantized
# module class which has a from_observed class method that converts
# observed custom module to quantized custom module
"observed_to_quantized_custom_module_class": {
ObservedCustomModule: QuantizedCustomModule
}
}
.. testcode::
convert_custom_config_dict = {
# user will manually define the corresponding quantized
# module class which has a from_observed class method that converts
# observed custom module to quantized custom module
"observed_to_quantized_custom_module_class": {
ObservedCustomModule: QuantizedCustomModule
}
}
"""
torch._C._log_api_usage_once("quantization_api.quantize.convert")
Expand Down

0 comments on commit b33febb

Please sign in to comment.