Annotate a node's output with the given qspec. Args: node (Node): Node whose output should be annotated. quant_property (_QuantProperty): Output index and qspec. Raises: RuntimeError: If the node is already annotated. ValueError: If ``mark_annotated`` is Tru
(node: Node, quant_property: _QuantProperty)
| 369 | |
| 370 | |
| 371 | def _annotate_output(node: Node, quant_property: _QuantProperty): |
| 372 | """Annotate a node's output with the given qspec. |
| 373 | |
| 374 | Args: |
| 375 | node (Node): Node whose output should be annotated. |
| 376 | quant_property (_QuantProperty): Output index and qspec. |
| 377 | |
| 378 | Raises: |
| 379 | RuntimeError: If the node is already annotated. |
| 380 | ValueError: If ``mark_annotated`` is True, ``optional`` is True, or |
| 381 | ``index`` is not zero. |
| 382 | |
| 383 | """ |
| 384 | if is_annotated(node): |
| 385 | raise RuntimeError( |
| 386 | f"Cannot annotate output: node '{node.name}' is already annotated" |
| 387 | ) |
| 388 | if quant_property.mark_annotated: |
| 389 | raise ValueError( |
| 390 | "quant_property.mark_annotated must be False for output annotation" |
| 391 | ) |
| 392 | if quant_property.optional: |
| 393 | raise ValueError("quant_property.optional must be False for output annotation") |
| 394 | if quant_property.index != 0: |
| 395 | raise ValueError("Only one output annotation supported currently") |
| 396 | |
| 397 | annotate_output_qspec(node, quant_property.qspec) |
| 398 | |
| 399 | |
| 400 | def _match_pattern( |
no test coverage detected