(
node: torch.fx.Node, quantization_config: QuantizationConfig | None
)
| 99 | |
| 100 | |
| 101 | def validate_node( |
| 102 | node: torch.fx.Node, quantization_config: QuantizationConfig | None |
| 103 | ) -> None: |
| 104 | if quantization_config is None: |
| 105 | assert not is_annotated(node), f"Node {node} is unexpectedly annotated" |
| 106 | return |
| 107 | |
| 108 | assert is_annotated(node), f"Node {node} is not annotated" |
| 109 | input_qspec = quantization_config.get_input_act_qspec() |
| 110 | output_qspec = quantization_config.get_output_act_qspec() |
| 111 | weight_qspec = quantization_config.get_weight_qspec() |
| 112 | |
| 113 | if len(node.all_input_nodes) == 3: |
| 114 | input_node, weight_node, bias_node = node.all_input_nodes |
| 115 | bias_qspec = quantization_config.get_bias_qspec(node) |
| 116 | validate_input(bias_node, bias_qspec) # type: ignore[arg-type] |
| 117 | else: |
| 118 | input_node, weight_node = node.all_input_nodes |
| 119 | |
| 120 | validate_input(input_node, input_qspec) # type: ignore[arg-type] |
| 121 | validate_input(weight_node, weight_qspec) # type: ignore[arg-type] |
| 122 | validate_output(node, output_qspec) # type: ignore[arg-type] |
| 123 | |
| 124 | |
| 125 | def test_set_module_name_tosa_INT() -> None: |
no test coverage detected