Shortcuts

BackendPatternConfig

class torch.ao.quantization.backend_config.BackendPatternConfig(pattern)[source]

Config for ops defined in BackendConfig. For a detailed example usage, see BackendConfig.

add_dtype_config(dtype_config)[source]

Add a set of supported input/output activation, weight, and bias data types for this pattern.

Return type:

BackendPatternConfig

classmethod from_dict(backend_pattern_config_dict)[source]

Create a BackendPatternConfig from a dictionary with the following items:

“pattern”: the pattern being configured “observation_type”: the ObservationType that specifies how observers should be inserted for this pattern “dtype_configs”: a list of dictionaries that represents DTypeConfig s “root_module”: a torch.nn.Module that represents the root for this pattern “qat_module”: a torch.nn.Module that represents the QAT implementation for this pattern “reference_quantized_module”: a torch.nn.Module that represents the reference quantized implementation for this pattern’s root module. “fused_module”: a torch.nn.Module that represents the fused implementation for this pattern “fuser_method”: a function that specifies how to fuse the pattern for this pattern

Return type:

BackendPatternConfig

set_dtype_configs(dtype_configs)[source]

Set the supported input/output activation, weight, and bias data types for this pattern, overriding all previously registered data types.

Return type:

BackendPatternConfig

set_fused_module(fused_module)[source]

Set the module that represents the fused implementation for this pattern.

Return type:

BackendPatternConfig

set_fuser_method(fuser_method)[source]

Set the function that specifies how to fuse the pattern for this pattern.

Return type:

BackendPatternConfig

set_observation_type(observation_type)[source]

Set how observers should be inserted for this pattern. See ObservationType for details

Return type:

BackendPatternConfig

set_qat_module(qat_module)[source]

Set the module that represents the QAT implementation for this pattern.

Return type:

BackendPatternConfig

set_reference_quantized_module(reference_quantized_module)[source]

Set the module that represents the reference quantized implementation for this pattern’s root module.

Return type:

BackendPatternConfig

set_root_module(root_module)[source]

Set the module that represents the root for this pattern. For example, the root module for torch.nn.intrinsic.LinearReLU should be torch.nn.Linear.

Return type:

BackendPatternConfig

to_dict()[source]

Convert this BackendPatternConfig to a dictionary with the items described in from_dict().

Return type:

Dict[str, Any]

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources