@@ -16,13 +16,23 @@ The Arm Ethos-U delegate supports the following quantization schemes:
1616### Quantization API
1717
1818``` python
19- class EthosUQuantizer (compile_spec : ' EthosUCompileSpec' ) -> 'None '
19+ class EthosUQuantizer (compile_spec : ' EthosUCompileSpec' , use_composable_quantizer : ' bool ' = False ) -> 'None '
2020```
2121Quantizer supported by the Arm Ethos -U backend .
2222
23+ .. warning ::
24+ Setting `` use_composable_quantizer= True `` enables an experimental API
25+ surface that may change without notice.
26+
2327Args:
2428- ** compile_spec (EthosUCompileSpec)** : Backend compile specification for
2529 Ethos- U targets.
30+ - ** use_composable_quantizer (bool )** : Whether to use the composable quantizer implementation. See https:// github.com/ pytorch/ executorch/ issues/ 17701 " for details.
31+
32+ ```python
33+ def EthosUQuantizer.add_quantizer(self , quantizer: ' Quantizer' ) -> ' TOSAQuantizer' :
34+ ```
35+ Insert a quantizer with highest precedence.
2636
2737```python
2838def EthosUQuantizer.quantize_with_submodules(self , model: ' GraphModule' , calibration_samples: ' list[tuple]' , is_qat: ' bool' = False , fold_quantize: ' bool' = True ):
@@ -48,22 +58,24 @@ Returns:
4858- ** GraphModule** : The quantized model.
4959
5060```python
51- def EthosUQuantizer.set_global(self , quantization_config: ' QuantizationConfig | None ' ) -> ' TOSAQuantizer' :
61+ def EthosUQuantizer.set_global(self , quantization_config: ' Optional[ QuantizationConfig] ' ) -> ' TOSAQuantizer' :
5262```
5363Set quantization_config for submodules not matched by other filters.
5464
5565Args:
56- - ** quantization_config (QuantizationConfig)** : Configuration to apply to
57- modules that are not captured by name or type filters.
66+ - ** quantization_config (Optional[ QuantizationConfig] )** : Configuration to
67+ apply to modules that are not captured by name or type filters.
68+ `` None `` indicates no quantization.
5869
5970``` python
60- def EthosUQuantizer.set_io(self , quantization_config: ' QuantizationConfig' ) -> ' TOSAQuantizer' :
71+ def EthosUQuantizer.set_io(self , quantization_config: ' Optional[ QuantizationConfig] ' ) -> ' TOSAQuantizer' :
6172```
6273Set quantization_config for input and output nodes.
6374
6475Args:
65- - ** quantization_config (QuantizationConfig)** : Configuration describing
66- activation quantization for model inputs and outputs.
76+ - ** quantization_config (Optional[ QuantizationConfig] )** : Configuration
77+ describing activation quantization for model inputs and outputs.
78+ `` None `` indicates no quantization.
6779
6880``` python
6981def EthosUQuantizer.set_module_name(self , module_name: ' str' , quantization_config: ' Optional[QuantizationConfig]' ) -> ' TOSAQuantizer' :
@@ -75,29 +87,51 @@ patterns for that submodule with the provided quantization_config.
7587
7688Args:
7789- ** module_name (str)** : Fully qualified module name to configure.
78- - ** quantization_config (QuantizationConfig)** : Configuration applied to
79- the named submodule.
90+ - ** quantization_config (Optional[ QuantizationConfig] )** : Configuration
91+ applied to the named submodule. `` None `` indicates no
92+ quantization.
8093
8194``` python
8295def EthosUQuantizer.set_module_type(self , module_type: ' Callable' , quantization_config: ' Optional[QuantizationConfig]' ) -> ' TOSAQuantizer' :
8396```
8497Set quantization_config for submodules with a given module type.
8598
86- For example, calling set_module_type(Sub ) quantizes supported patterns
87- in each Sub instance with the provided quantization_config.
99+ For example, calling set_module_type(Softmax ) quantizes supported
100+ patterns in each Softmax instance with the provided quantization_config.
88101
89102Args:
90103- ** module_type (Callable)** : Type whose submodules should use the
91104 provided quantization configuration.
92- - ** quantization_config (QuantizationConfig)** : Configuration to apply to
93- submodules of the given type.
105+ - ** quantization_config (Optional[ QuantizationConfig] )** : Configuration to
106+ apply to submodules of the given type. `` None `` indicates no
107+ quantization.
108+
109+ ``` python
110+ def EthosUQuantizer.set_node_finder(self , quantization_config: ' Optional[QuantizationConfig]' , node_finder: ' NodeFinder' ) -> ' TOSAQuantizer' :
111+ ```
112+ Set quantization_config for nodes matched by a custom NodeFinder.
113+
114+ Args:
115+ - ** quantization_config (Optional[ QuantizationConfig] )** : Configuration
116+ describing quantization settings for nodes matched by the provided
117+ NodeFinder. `` None `` indicates no quantization.
118+
119+ ``` python
120+ def EthosUQuantizer.set_node_name(self , node_name: ' str' , quantization_config: ' Optional[QuantizationConfig]' ) -> ' TOSAQuantizer' :
121+ ```
122+ Set quantization config for a specific node name.
123+
124+ ``` python
125+ def EthosUQuantizer.set_node_target(self , node_target: ' OpOverload' , quantization_config: ' Optional[QuantizationConfig]' ) -> ' TOSAQuantizer' :
126+ ```
127+ Set quantization config for a specific operator target.
94128
95129``` python
96130def EthosUQuantizer.transform_for_annotation(self , model: ' GraphModule' ) -> ' GraphModule' :
97131```
98132Transform the graph to prepare it for quantization annotation.
99133
100- Currently transforms scalar values to tensor attributes .
134+ Decomposes all operators where required to get correct quantization parameters .
101135
102136Args:
103137- ** model (GraphModule)** : Model whose graph will be transformed.
0 commit comments