base
base
¶
Abstract base class for PT2E quantization backends.
BasePT2EBackend
¶
Bases: ABC
Base class for PT2E quantization backends.
Each backend provides quantizer creation, environment setup, and operator lowering for a specific hardware target.
is_dynamic
abstractmethod
property
¶
Whether this backend uses dynamic activation quantization.
supported_device_types
abstractmethod
property
¶
Device types this backend supports (e.g., ('cpu',) for x86).
create_quantizer
abstractmethod
¶
Create a configured quantizer targeting a specific module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_path
|
str
|
Dotted path to the target submodule. Empty string means global (whole model). |
required |
Returns:
| Type | Description |
|---|---|
Quantizer
|
A quantizer instance ready for ComposableQuantizer. |
Source code in src/versatil/quantization/pt2e/backends/base.py
environment_context
abstractmethod
¶
activate_environment
abstractmethod
¶
Set backend env vars permanently (no restore on exit).
Use this instead of environment_context when the env must persist beyond a single scope — e.g., for torch.compile where the actual compilation is deferred to the first forward pass.