(node: Node, quantization_config: QuantizationConfig)
| 186 | ) |
| 187 | |
| 188 | def annotate_stack(node: Node, quantization_config: QuantizationConfig) -> None: |
| 189 | input_nodes = node.args[0] |
| 190 | |
| 191 | first_input_node = input_nodes[0] |
| 192 | input_qspec_map = {} |
| 193 | input_qspec_map[first_input_node] = quantization_config.input_activation |
| 194 | share_qparams_with_input_act0_qspec = SharedQuantizationSpec( |
| 195 | (first_input_node, node) |
| 196 | ) |
| 197 | |
| 198 | for input_node in input_nodes[1:]: |
| 199 | if input_node not in input_qspec_map: |
| 200 | input_qspec_map[input_node] = share_qparams_with_input_act0_qspec |
| 201 | |
| 202 | node.meta[Q_ANNOTATION_KEY] = QuantizationAnnotation( |
| 203 | input_qspec_map=input_qspec_map, |
| 204 | output_qspec=share_qparams_with_input_act0_qspec, |
| 205 | _annotated=True, |
| 206 | ) |
| 207 | |
| 208 | def annotate_matmul_input1(node: Node, is_qat: str): |
| 209 | if is_qat: |
no outgoing calls
no test coverage detected