MCPcopy Create free account
hub / github.com/pytorch/executorch / validate_node

Function validate_node

backends/arm/test/quantizer/test_set_module_name.py:101–122  ·  view source on GitHub ↗
(
    node: torch.fx.Node, quantization_config: QuantizationConfig | None
)

Source from the content-addressed store, hash-verified

99
100
101def 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
125def test_set_module_name_tosa_INT() -> None:

Callers 1

Calls 7

is_annotatedFunction · 0.90
validate_inputFunction · 0.85
validate_outputFunction · 0.85
get_input_act_qspecMethod · 0.45
get_output_act_qspecMethod · 0.45
get_weight_qspecMethod · 0.45
get_bias_qspecMethod · 0.45

Tested by

no test coverage detected