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 16, 2020
1 parent bd26322 commit a11999e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions torch/quantization/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ def prepare(model, inplace=False, allow_list=None,
Example:
.. testcode::
import torch
class CustomModule(torch.nn.Module):
pass
class ObservedCustomModule(torch.nn.Module):
pass
prepare_custom_config_dict = {
# user will manually define the corresponding observed
# module class which has a from_float class method that converts
Expand All @@ -202,7 +209,7 @@ def prepare(model, inplace=False, allow_list=None,
CustomModule: ObservedCustomModule
}
}
# get around the no code warning
# get around the no code/output warning
print(prepare_custom_config_dict)
"""
Expand Down Expand Up @@ -418,6 +425,13 @@ def convert(
Example:
xo
.. testcode::
import torch
class ObservedCustomModule(torch.nn.Module):
pass
class QuantizedCustomModule(torch.nn.Module):
pass
convert_custom_config_dict = {
# user will manually define the corresponding quantized
# module class which has a from_observed class method that converts
Expand All @@ -426,7 +440,7 @@ def convert(
ObservedCustomModule: QuantizedCustomModule
}
}
# get around the no code warning
# get around the no code/output warning
print(convert_custom_config_dict)
"""
Expand Down

0 comments on commit a11999e

Please sign in to comment.