project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
pytorch_ao
public
public
0
0
test_conv_bn_relu.__init__
def __init__(self) -> None:super().__init__()self.bn1 = torch.nn.BatchNorm2d(3)self.conv2 = torch.nn.Conv2d(3, 3, 3)self.relu2 = torch.nn.ReLU()
1
5
1
53
0
72
76
72
null
[]
None
null
0
0
0
null
0
null
The function (test_conv_bn_relu.__init__) defined within the public class called public.The function start at line 72 and ends at 76. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_conv_bn_relu.forward
def forward(self, x):bn_out = self.bn1(x)return self.relu2(self.conv2(bn_out))
1
3
2
27
0
78
80
78
null
[]
None
null
0
0
0
null
0
null
The function (test_conv_bn_relu.forward) defined within the public class called public.The function start at line 78 and ends at 80. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [78.0] and does not return any value..
pytorch_ao
public
public
0
0
test_conv_bn_relu
def test_conv_bn_relu(self):class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.bn1 = torch.nn.BatchNorm2d(3)self.conv2 = torch.nn.Conv2d(3, 3, 3)self.relu2 = torch.nn.ReLU()def forward(self, x):bn_out = self.bn1(x)return self.relu2(self.conv2(bn_out))m = M().eval()example_inputs = (torch.randn(1...
1
23
1
161
0
70
102
70
null
[]
None
null
0
0
0
null
0
null
The function (test_conv_bn_relu) defined within the public class called public.The function start at line 70 and ends at 102. It contains 23 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_customized_equivalet_types_dict.__init__
def __init__(self) -> None:super().__init__()self.conv = torch.nn.Conv2d(3, 3, 3)
1
3
1
30
0
107
109
107
null
[]
None
null
0
0
0
null
0
null
The function (test_customized_equivalet_types_dict.__init__) defined within the public class called public.The function start at line 107 and ends at 109. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_customized_equivalet_types_dict.forward
def forward(self, x):return torch.nn.functional.relu6(self.conv(x))
1
2
2
23
0
111
112
111
null
[]
None
null
0
0
0
null
0
null
The function (test_customized_equivalet_types_dict.forward) defined within the public class called public.The function start at line 111 and ends at 112. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [111.0] and does not return any value..
pytorch_ao
public
public
0
0
test_customized_equivalet_types_dict
def test_customized_equivalet_types_dict(self):class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.conv = torch.nn.Conv2d(3, 3, 3)def forward(self, x):return torch.nn.functional.relu6(self.conv(x))m = M().eval()example_inputs = (torch.randn(1, 3, 5, 5),)# program capturem, guards = torchdynamo.ex...
1
19
1
129
0
105
130
105
null
[]
None
null
0
0
0
null
0
null
The function (test_customized_equivalet_types_dict) defined within the public class called public.The function start at line 105 and ends at 130. It contains 19 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self) -> None:super().__init__()self.conv = torch.nn.Conv2d(3, 3, 3)self.hardtanh = torch.nn.Hardtanh()self.adaptive_avg_pool2d = torch.nn.AdaptiveAvgPool2d((1, 1))self.linear = torch.nn.Linear(3, 3)
1
6
1
71
0
28
33
28
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 28 and ends at 33. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):x = self.conv(x)x = self.adaptive_avg_pool2d(x)x = self.hardtanh(x)x = x.view(-1, 3)x = self.linear(x)return x
1
7
2
52
0
35
41
35
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 35 and ends at 41. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [35.0] and does not return any value..
pytorch_ao
public
public
0
0
_tag_partitions
def _tag_partitions(backend_name: str, op_name: str, annotated_partitions: list[list[Node]]):for index, partition_nodes in enumerate(annotated_partitions):tag_name = backend_name + "_" + op_name + "_" + str(index)for node in partition_nodes:assert "quantization_tag" not in node.meta, f"{node} is already tagged"node.met...
3
8
3
68
1
44
51
44
null
['tag_name']
None
null
0
0
0
null
0
null
The function (_tag_partitions) defined within the public class called public.The function start at line 44 and ends at 51. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [44.0] and does not return any value..
pytorch_ao
public
public
0
0
_test_quant_tag_preservation_through_decomp
def _test_quant_tag_preservation_through_decomp(self, model, example_inputs, from_node_to_tags):ep = torch.export.export(model, example_inputs, strict=True)found_tags = Truenot_found_nodes = ""for from_node, tag in from_node_to_tags.items():for n in ep.graph_module.graph.nodes:from_node_meta = n.meta.get("from_node", N...
10
29
4
156
0
69
97
69
null
[]
None
null
0
0
0
null
0
null
The function (_test_quant_tag_preservation_through_decomp) defined within the public class called public.The function start at line 69 and ends at 97. It contains 29 lines of code and it has a cyclomatic complexity of 10. It takes 4 parameters, represented as [69.0] and does not return any value..
pytorch_ao
public
public
0
0
_test_metadata_porting
def _test_metadata_porting(self,model,example_inputs,quantizer,node_tags=None,) -> torch.fx.GraphModule:m_eager = model.eval()# program capturem = copy.deepcopy(m_eager)m = torch.export.export(m, example_inputs, strict=True).module()m = prepare_pt2e(m, quantizer)# Calibratem(*example_inputs)m = convert_pt2e(m)m(*exampl...
10
39
5
236
0
99
145
99
null
[]
None
null
0
0
0
null
0
null
The function (_test_metadata_porting) defined within the public class called public.The function start at line 99 and ends at 145. It contains 39 lines of code and it has a cyclomatic complexity of 10. It takes 5 parameters, represented as [99.0] and does not return any value..
pytorch_ao
public
public
0
0
test_simple_metadata_porting.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"quantization_config = get_symmetric_quantization_config(is_per_channel=True)annotated_partitions = OP_TO_ANNOTATOR["linear"](gm, quantization_config)_tag_partitions(backend_string, "linear", annotated_partitions)annotated_pa...
1
17
2
87
0
155
171
155
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_metadata_porting.annotate) defined within the public class called public.The function start at line 155 and ends at 171. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [155.0] and does not return any value..
pytorch_ao
public
public
0
0
test_simple_metadata_porting.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
173
174
173
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_metadata_porting.validate) defined within the public class called public.The function start at line 173 and ends at 174. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [173.0] and does not return any value..
pytorch_ao
public
public
0
0
test_simple_metadata_porting
def test_simple_metadata_porting(self):"""Model under testconv2d -> avgpool -> hardtanh -> linearCheck quantization tags on conv2d, avgpool and linear are correctly set"""class BackendAQuantizer(Quantizer):def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"quantization_confi...
1
39
1
171
0
147
211
147
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_metadata_porting) defined within the public class called public.The function start at line 147 and ends at 211. It contains 39 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_with_no_quant_inbetween.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"quantization_config = get_symmetric_quantization_config(is_per_channel=True)annotated_partitions = OP_TO_ANNOTATOR["linear"](gm, quantization_config)_tag_partitions(backend_string, "linear", annotated_partitions)annotated_pa...
1
11
2
68
0
222
232
222
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_with_no_quant_inbetween.annotate) defined within the public class called public.The function start at line 222 and ends at 232. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [222.0] and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_with_no_quant_inbetween.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
234
235
234
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_with_no_quant_inbetween.validate) defined within the public class called public.The function start at line 234 and ends at 235. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [234.0] and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_with_no_quant_inbetween
def test_metadata_porting_with_no_quant_inbetween(self):"""Model under testconv2d -> avgpool -> hardtanh -> linearDont quantize avgpoolCheck quantization tags on conv2d and linear are correctly set"""class BackendAQuantizer(Quantizer):def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string =...
1
21
1
124
0
213
253
213
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_with_no_quant_inbetween) defined within the public class called public.The function start at line 213 and ends at 253. It contains 21 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_dq.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"# static quantiazationquantization_config = get_symmetric_quantization_config(is_per_channel=True)annotated_partitions = OP_TO_ANNOTATOR["conv"](gm, quantization_config)_tag_partitions(backend_string, "conv2d", annotated_par...
1
20
2
99
0
266
288
266
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_dq.annotate) defined within the public class called public.The function start at line 266 and ends at 288. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [266.0] and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_dq.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
290
291
290
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_dq.validate) defined within the public class called public.The function start at line 290 and ends at 291. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [290.0] and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_dq
def test_metadata_porting_for_dq(self):"""Model under testconv2d -> avgpool -> hardtanh -> linearQuantize all except linear.Quantize linear with dynamic quantizationCheck quantization tags on conv2d, avgpool and linear are correctly set"""class BackendAQuantizer(Quantizer):def annotate(self, gm: torch.fx.GraphModule) -...
1
36
1
175
0
256
325
256
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_dq) defined within the public class called public.The function start at line 256 and ends at 325. It contains 36 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_two_dq.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"# dynamic quantizationquantization_config_dynamic = get_symmetric_quantization_config(is_per_channel=True, is_dynamic=True)annotated_partitions = OP_TO_ANNOTATOR["conv"](gm, quantization_config_dynamic)_tag_partitions(backen...
1
13
2
72
0
336
350
336
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_two_dq.annotate) defined within the public class called public.The function start at line 336 and ends at 350. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [336.0] and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_two_dq.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
352
353
352
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_two_dq.validate) defined within the public class called public.The function start at line 352 and ends at 353. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [352.0] and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_two_dq
def test_metadata_porting_for_two_dq(self):"""Model under testconv2d -> avgpool -> hardtanh -> linearQuantize linear and conv with dynamic quantizationCheck quantization tags on conv2d, avgpool and linear are correctly set"""class BackendAQuantizer(Quantizer):def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.Gra...
1
38
1
148
0
327
388
327
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_two_dq) defined within the public class called public.The function start at line 327 and ends at 388. It contains 38 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_dq_no_static_q.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"# dynamic quantizationquantization_config_dynamic = get_symmetric_quantization_config(is_per_channel=True, is_dynamic=True)annotated_partitions = OP_TO_ANNOTATOR["linear"](gm, quantization_config_dynamic)_tag_partitions(back...
1
9
2
53
0
400
409
400
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_dq_no_static_q.annotate) defined within the public class called public.The function start at line 400 and ends at 409. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [400.0] and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_dq_no_static_q.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
411
412
411
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_dq_no_static_q.validate) defined within the public class called public.The function start at line 411 and ends at 412. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [411.0] and does not return any value..
pytorch_ao
public
public
0
0
test_metadata_porting_for_dq_no_static_q
def test_metadata_porting_for_dq_no_static_q(self):"""Model under testconv2d -> avgpool -> hardtanh -> linearDont quantize anything except linear.Quantize linear with dynamic quantizationCheck quantization tags on conv2d, avgpool and linear are correctly set"""class BackendAQuantizer(Quantizer):def annotate(self, gm: t...
1
23
1
133
0
390
432
390
null
[]
None
null
0
0
0
null
0
null
The function (test_metadata_porting_for_dq_no_static_q) defined within the public class called public.The function start at line 390 and ends at 432. It contains 23 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_no_metadata_porting.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:quantization_config = get_symmetric_quantization_config(is_per_channel=True)OP_TO_ANNOTATOR["linear"](gm, quantization_config)OP_TO_ANNOTATOR["conv"](gm, quantization_config)OP_TO_ANNOTATOR["adaptive_avg_pool2d"](gm, quantization_config)
1
7
2
54
0
436
442
436
null
[]
None
null
0
0
0
null
0
null
The function (test_no_metadata_porting.annotate) defined within the public class called public.The function start at line 436 and ends at 442. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [436.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_metadata_porting.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
444
445
444
null
[]
None
null
0
0
0
null
0
null
The function (test_no_metadata_porting.validate) defined within the public class called public.The function start at line 444 and ends at 445. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [444.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_metadata_porting
def test_no_metadata_porting(self):class BackendAQuantizer(Quantizer):def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:quantization_config = get_symmetric_quantization_config(is_per_channel=True)OP_TO_ANNOTATOR["linear"](gm, quantization_config)OP_TO_ANNOTATOR["conv"](gm, quantization_config)OP_TO_A...
1
16
1
71
0
434
459
434
null
[]
None
null
0
0
0
null
0
null
The function (test_no_metadata_porting) defined within the public class called public.The function start at line 434 and ends at 459. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_no_metadata_porting_through_unknown_ops.__init__
def __init__(self) -> None:super().__init__()self.register_parameter("w", torch.nn.Parameter(torch.rand(8, 16)))
1
3
1
36
0
470
472
470
null
[]
None
null
0
0
0
null
0
null
The function (test_no_metadata_porting_through_unknown_ops.__init__) defined within the public class called public.The function start at line 470 and ends at 472. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_no_metadata_porting_through_unknown_ops.forward
def forward(self, x, y):x = torch.matmul(self.w, x)z = x + yreturn torch.nn.functional.relu(z)
1
4
3
37
0
474
477
474
null
[]
None
null
0
0
0
null
0
null
The function (test_no_metadata_porting_through_unknown_ops.forward) defined within the public class called public.The function start at line 474 and ends at 477. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [474.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_metadata_porting_through_unknown_ops.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:qconfig = get_symmetric_quantization_config()for n in gm.graph.nodes:if n.op != "call_function":continuen.meta["quantization_annotation"] = QuantizationAnnotation(input_qspec_map={n.args[0]: qconfig.input_activation},output_qspec=qconfig.output_activa...
5
14
2
110
0
480
495
480
null
[]
None
null
0
0
0
null
0
null
The function (test_no_metadata_porting_through_unknown_ops.annotate) defined within the public class called public.The function start at line 480 and ends at 495. It contains 14 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [480.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_metadata_porting_through_unknown_ops.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
497
498
497
null
[]
None
null
0
0
0
null
0
null
The function (test_no_metadata_porting_through_unknown_ops.validate) defined within the public class called public.The function start at line 497 and ends at 498. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [497.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_metadata_porting_through_unknown_ops
def test_no_metadata_porting_through_unknown_ops(self):"""Model under testmatmul -> add -> relumatmul has get_attr as first input, but the quantization_tag should not bepropagated to add even if it's part of a chain that ends at get_attr"""class MatmulWithConstInput(torch.nn.Module):def __init__(self) -> None:super()._...
1
30
1
125
0
461
522
461
null
[]
None
null
0
0
0
null
0
null
The function (test_no_metadata_porting_through_unknown_ops) defined within the public class called public.The function start at line 461 and ends at 522. It contains 30 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_simple
def test_simple(self):m = TestHelperModules.Conv2dThenConv1d()example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)m = ep.module()self._assert_each_node_has_from_node_source(m)from_node_source_map = self._extract_from_node_source(m)self.assertEqual(len(set(from_node_source_map.valu...
1
10
1
77
0
35
45
35
null
[]
None
null
0
0
0
null
0
null
The function (test_simple) defined within the public class called public.The function start at line 35 and ends at 45. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_control_flow
def test_control_flow(self):m = TestHelperModules.ControlFlow()example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)m = ep.module()self._assert_each_node_has_from_node_source(m)from_node_source_map = self._extract_from_node_source(m)self.assertEqual(len(set(from_node_source_map.val...
1
10
1
77
0
48
59
48
null
[]
None
null
0
0
0
null
0
null
The function (test_control_flow) defined within the public class called public.The function start at line 48 and ends at 59. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_copy_preserve_handle
def test_copy_preserve_handle(self):m = TestHelperModules.Conv2dThenConv1d()example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)m = ep.module()self._assert_each_node_has_from_node_source(m)from_node_source_map_ref = self._extract_from_node_source(m)ep_copy = copy.copy(ep)from_node...
1
11
1
90
0
61
74
61
null
[]
None
null
0
0
0
null
0
null
The function (test_copy_preserve_handle) defined within the public class called public.The function start at line 61 and ends at 74. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_deepcopy_preserve_handle
def test_deepcopy_preserve_handle(self):m = TestHelperModules.Conv2dThenConv1d()example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)from_node_source_map_ref = self._extract_from_node_source(ep.module())ep_copy = copy.deepcopy(ep)from_node_source_map = self._extract_from_node_sourc...
1
12
1
107
0
76
89
76
null
[]
None
null
0
0
0
null
0
null
The function (test_deepcopy_preserve_handle) defined within the public class called public.The function start at line 76 and ends at 89. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_re_export_preserve_handle
def test_re_export_preserve_handle(self):m = TestHelperModules.Conv2dThenConv1d()example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)m = ep.module()self._assert_each_node_has_from_node_source(m)from_node_source_map_ref = self._extract_from_node_source(m)ep_reexport = torch.export....
1
12
1
101
0
91
106
91
null
[]
None
null
0
0
0
null
0
null
The function (test_re_export_preserve_handle) defined within the public class called public.The function start at line 91 and ends at 106. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_run_decompositions_same_handle_id
def test_run_decompositions_same_handle_id(self):m = TestHelperModules.Conv2dThenConv1d()example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)m = ep.module()self._assert_each_node_has_from_node_source(m)from_node_source_map_ref = self._extract_from_node_source(m)ep_copy = copy.copy...
1
15
1
114
0
108
127
108
null
[]
None
null
0
0
0
null
0
null
The function (test_run_decompositions_same_handle_id) defined within the public class called public.The function start at line 108 and ends at 127. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_run_decompositions_map_handle_to_new_nodes
def test_run_decompositions_map_handle_to_new_nodes(self):test_models = [TestHelperModules.TwoLinearModule(),TestHelperModules.Conv2dThenConv1d(),]for m in test_models:example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)m = ep.module()self._assert_each_node_has_from_node_source(m)...
2
24
1
119
0
129
157
129
null
[]
None
null
0
0
0
null
0
null
The function (test_run_decompositions_map_handle_to_new_nodes) defined within the public class called public.The function start at line 129 and ends at 157. It contains 24 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_prepare_for_propagation_comparison
def test_prepare_for_propagation_comparison(self):m = TestHelperModules.Conv2dThenConv1d()example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)m = ep.module()m_logger = prepare_for_propagation_comparison(m)ref = m(*example_inputs)res = m_logger(*example_inputs)from torchao.quantiza...
4
13
1
127
0
159
173
159
null
[]
None
null
0
0
0
null
0
null
The function (test_prepare_for_propagation_comparison) defined within the public class called public.The function start at line 159 and ends at 173. It contains 13 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_added_node_gets_unique_id
def test_added_node_gets_unique_id(self) -> None:m = TestHelperModules.Conv2dThenConv1d()example_inputs = m.example_inputs()ep = torch.export.export(m, example_inputs, strict=True)ref_from_node_source = self._extract_from_node_source(ep.module())ref_counter = Counter(ref_from_node_source.values())for k, v in ref_counte...
3
45
1
294
0
175
234
175
null
[]
None
null
0
0
0
null
0
null
The function (test_added_node_gets_unique_id) defined within the public class called public.The function start at line 175 and ends at 234. It contains 45 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_simple_quantizer.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)bias = node.args[2]assert is...
4
42
2
223
0
89
130
89
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_quantizer.annotate) defined within the public class called public.The function start at line 89 and ends at 130. It contains 42 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [89.0] and does not return any value..
pytorch_ao
public
public
0
0
test_simple_quantizer.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
132
133
132
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_quantizer.validate) defined within the public class called public.The function start at line 132 and ends at 133. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [132.0] and does not return any value..
pytorch_ao
public
public
0
0
test_simple_quantizer
def test_simple_quantizer(self):# TODO: use OP_TO_ANNOTATORclass BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(in...
1
22
1
132
0
86
153
86
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_quantizer) defined within the public class called public.The function start at line 86 and ends at 153. It contains 22 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_chunked_bn_fusion
def test_chunked_bn_fusion(self):batch_size = 1n_chunks = 3in_channels = 1out_channels = 32m = ConvWithSharedWeightInExportedModel(n_chunks, in_channels, out_channels)m.bn.running_var = torch.nn.Parameter(torch.rand(out_channels) * 1e-2, requires_grad=False)m.eval()example_inputs = (torch.rand(batch_size, n_chunks, 32,...
3
25
1
197
0
155
181
155
null
[]
None
null
0
0
0
null
0
null
The function (test_chunked_bn_fusion) defined within the public class called public.The function start at line 155 and ends at 181. It contains 25 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_wo_annotate_conv_output_quantizer.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:act_qspec = QuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,is_dynamic=False,observer_or_fake_quant_ctr=observer.default_observer,)weight_qspec = QuantizationSpec(dtype=torch.int8,quant_min=-128,quant_ma...
4
41
2
219
0
186
226
186
null
[]
None
null
0
0
0
null
0
null
The function (test_wo_annotate_conv_output_quantizer.annotate) defined within the public class called public.The function start at line 186 and ends at 226. It contains 41 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [186.0] and does not return any value..
pytorch_ao
public
public
0
0
test_wo_annotate_conv_output_quantizer.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
228
229
228
null
[]
None
null
0
0
0
null
0
null
The function (test_wo_annotate_conv_output_quantizer.validate) defined within the public class called public.The function start at line 228 and ends at 229. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [228.0] and does not return any value..
pytorch_ao
public
public
0
0
test_wo_annotate_conv_output_quantizer
def test_wo_annotate_conv_output_quantizer(self):# TODO: use OP_TO_ANNOTATORclass BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:act_qspec = QuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,is_dynamic=False,observer_or_fak...
1
28
1
164
0
183
256
183
null
[]
None
null
0
0
0
null
0
null
The function (test_wo_annotate_conv_output_quantizer) defined within the public class called public.The function start at line 183 and ends at 256. It contains 28 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_max_pool2d_quantizer.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:act_qspec = QuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,is_dynamic=False,observer_or_fake_quant_ctr=observer.default_observer,)weight_qspec = QuantizationSpec(dtype=torch.int8,quant_min=-128,quant_ma...
6
59
2
296
0
261
319
261
null
[]
None
null
0
0
0
null
0
null
The function (test_max_pool2d_quantizer.annotate) defined within the public class called public.The function start at line 261 and ends at 319. It contains 59 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [261.0] and does not return any value..
pytorch_ao
public
public
0
0
test_max_pool2d_quantizer.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
321
322
321
null
[]
None
null
0
0
0
null
0
null
The function (test_max_pool2d_quantizer.validate) defined within the public class called public.The function start at line 321 and ends at 322. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [321.0] and does not return any value..
pytorch_ao
public
public
0
0
test_max_pool2d_quantizer
def test_max_pool2d_quantizer(self):# TODO: use OP_TO_ANNOTATORclass BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:act_qspec = QuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,is_dynamic=False,observer_or_fake_quant_ctr=o...
1
35
1
202
0
258
357
258
null
[]
None
null
0
0
0
null
0
null
The function (test_max_pool2d_quantizer) defined within the public class called public.The function start at line 258 and ends at 357. It contains 35 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_derived_qspec.test_derived_qspec.annotate.derive_qparams_fn
def derive_qparams_fn(obs_or_fqs: list[ObserverOrFakeQuantize],) -> tuple[Tensor, Tensor]:assert len(obs_or_fqs) == 2, (f"Expecting two obs/fqs, one for activation and one for weight, got: {len(obs_or_fqs)}")act_obs_or_fq = obs_or_fqs[0]weight_obs_or_fq = obs_or_fqs[1]act_scale, act_zp = act_obs_or_fq.calculate_qparams...
1
16
1
97
0
391
406
391
null
[]
None
null
0
0
0
null
0
null
The function (test_derived_qspec.test_derived_qspec.annotate.derive_qparams_fn) defined within the public class called public.The function start at line 391 and ends at 406. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_derived_qspec.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)bias = node.args[2]assert is...
4
46
2
258
0
362
424
362
null
[]
None
null
0
0
0
null
0
null
The function (test_derived_qspec.annotate) defined within the public class called public.The function start at line 362 and ends at 424. It contains 46 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [362.0] and does not return any value..
pytorch_ao
public
public
0
0
test_derived_qspec.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
426
427
426
null
[]
None
null
0
0
0
null
0
null
The function (test_derived_qspec.validate) defined within the public class called public.The function start at line 426 and ends at 427. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [426.0] and does not return any value..
pytorch_ao
public
public
0
0
test_derived_qspec
def test_derived_qspec(self):# TODO: use OP_TO_ANNOTATORclass BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input...
1
33
1
195
0
359
460
359
null
[]
None
null
0
0
0
null
0
null
The function (test_derived_qspec) defined within the public class called public.The function start at line 359 and ends at 460. It contains 33 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_derived_qspec_per_channel.test_derived_qspec_per_channel.annotate.derive_qparams_fn
def derive_qparams_fn(obs_or_fqs: list[ObserverOrFakeQuantize],) -> tuple[Tensor, Tensor]:assert len(obs_or_fqs) == 1, (f"Expecting one weight obs/fq, got: {len(obs_or_fqs)}")weight_obs_or_fq = obs_or_fqs[0](weight_scale,weight_zp,) = weight_obs_or_fq.calculate_qparams()return weight_scale, torch.zeros_like(weight_scal...
1
12
1
57
0
494
505
494
null
[]
None
null
0
0
0
null
0
null
The function (test_derived_qspec_per_channel.test_derived_qspec_per_channel.annotate.derive_qparams_fn) defined within the public class called public.The function start at line 494 and ends at 505. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does n...
pytorch_ao
public
public
0
0
test_derived_qspec_per_channel.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)bias = node.args[2]assert is...
4
48
2
260
0
464
524
464
null
[]
None
null
0
0
0
null
0
null
The function (test_derived_qspec_per_channel.annotate) defined within the public class called public.The function start at line 464 and ends at 524. It contains 48 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [464.0] and does not return any value..
pytorch_ao
public
public
0
0
test_derived_qspec_per_channel.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
526
527
526
null
[]
None
null
0
0
0
null
0
null
The function (test_derived_qspec_per_channel.validate) defined within the public class called public.The function start at line 526 and ends at 527. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [526.0] and does not return any value..
pytorch_ao
public
public
0
0
test_derived_qspec_per_channel
def test_derived_qspec_per_channel(self):class BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input_act, Node)weig...
1
36
1
214
0
462
565
462
null
[]
None
null
0
0
0
null
0
null
The function (test_derived_qspec_per_channel) defined within the public class called public.The function start at line 462 and ends at 565. It contains 36 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_fixed_qparams_qspec_ptq
def test_fixed_qparams_qspec_ptq(self):self._test_fixed_qparams_qspec(is_qat=False)
1
2
1
13
0
567
568
567
null
[]
None
null
0
0
0
null
0
null
The function (test_fixed_qparams_qspec_ptq) defined within the public class called public.The function start at line 567 and ends at 568. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_fixed_qparams_qspec_qat
def test_fixed_qparams_qspec_qat(self):self._test_fixed_qparams_qspec(is_qat=True)
1
2
1
13
0
571
572
571
null
[]
None
null
0
0
0
null
0
null
The function (test_fixed_qparams_qspec_qat) defined within the public class called public.The function start at line 571 and ends at 572. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_test_fixed_qparams_qspec.forward
def forward(self, x):return torch.sigmoid(x)
1
2
2
14
0
576
577
576
null
[]
None
null
0
0
0
null
0
null
The function (_test_fixed_qparams_qspec.forward) defined within the public class called public.The function start at line 576 and ends at 577. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [576.0] and does not return any value..
pytorch_ao
public
public
0
0
_test_fixed_qparams_qspec.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.sigmoid.default):input_act = node.args[0]assert isinstance(input_act, Node)act_qspec = FixedQParamsQuantizationSpec(dtype=torch.uint8,quant_min=0,quant_ma...
4
23
2
132
0
580
602
580
null
[]
None
null
0
0
0
null
0
null
The function (_test_fixed_qparams_qspec.annotate) defined within the public class called public.The function start at line 580 and ends at 602. It contains 23 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [580.0] and does not return any value..
pytorch_ao
public
public
0
0
_test_fixed_qparams_qspec.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
604
605
604
null
[]
None
null
0
0
0
null
0
null
The function (_test_fixed_qparams_qspec.validate) defined within the public class called public.The function start at line 604 and ends at 605. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [604.0] and does not return any value..
pytorch_ao
public
public
0
0
_test_fixed_qparams_qspec
def _test_fixed_qparams_qspec(self, is_qat: bool):class M(torch.nn.Module):def forward(self, x):return torch.sigmoid(x)class BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten....
5
49
2
300
0
574
651
574
null
[]
None
null
0
0
0
null
0
null
The function (_test_fixed_qparams_qspec) defined within the public class called public.The function start at line 574 and ends at 651. It contains 49 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [574.0] and does not return any value..
pytorch_ao
public
public
0
0
test_fixed_qparams_qspec_observer_dedup.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:act_qspec = FixedQParamsQuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,scale=1.0 / 256.0,zero_point=0,)for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.sigmo...
6
39
2
216
0
655
693
655
null
[]
None
null
0
0
0
null
0
null
The function (test_fixed_qparams_qspec_observer_dedup.annotate) defined within the public class called public.The function start at line 655 and ends at 693. It contains 39 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [655.0] and does not return any value..
pytorch_ao
public
public
0
0
test_fixed_qparams_qspec_observer_dedup.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
695
696
695
null
[]
None
null
0
0
0
null
0
null
The function (test_fixed_qparams_qspec_observer_dedup.validate) defined within the public class called public.The function start at line 695 and ends at 696. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [695.0] and does not return any value..
pytorch_ao
public
public
0
0
test_fixed_qparams_qspec_observer_dedup.forward
def forward(self, x, y):return torch.sigmoid(x) + y
1
2
3
18
0
699
700
699
null
[]
None
null
0
0
0
null
0
null
The function (test_fixed_qparams_qspec_observer_dedup.forward) defined within the public class called public.The function start at line 699 and ends at 700. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [699.0] and does not return any value..
pytorch_ao
public
public
0
0
test_fixed_qparams_qspec_observer_dedup.example_inputs
def example_inputs(self):return (torch.randn(1, 3, 5, 5),torch.randn(1, 3, 5, 5),)
1
5
1
34
0
702
706
702
null
[]
None
null
0
0
0
null
0
null
The function (test_fixed_qparams_qspec_observer_dedup.example_inputs) defined within the public class called public.The function start at line 702 and ends at 706. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_fixed_qparams_qspec_observer_dedup
def test_fixed_qparams_qspec_observer_dedup(self):class BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:act_qspec = FixedQParamsQuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,scale=1.0 / 256.0,zero_point=0,)for node in mo...
1
37
1
209
0
653
739
653
null
[]
None
null
0
0
0
null
0
null
The function (test_fixed_qparams_qspec_observer_dedup) defined within the public class called public.The function start at line 653 and ends at 739. It contains 37 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)bias = node.args[2]assert is...
6
70
2
351
0
743
813
743
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec.annotate) defined within the public class called public.The function start at line 743 and ends at 813. It contains 70 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [743.0] and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
815
816
815
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec.validate) defined within the public class called public.The function start at line 815 and ends at 816. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [815.0] and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec
def test_shared_qspec(self):class BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.arg...
6
50
1
365
0
741
870
741
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec) defined within the public class called public.The function start at line 741 and ends at 870. It contains 50 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_test_transitive_sharing_with_cat_helper
def _test_transitive_sharing_with_cat_helper(self, quantizer):m = TestHelperModules.Conv2dWithTwoCat().eval()example_inputs = (torch.randn(1, 3, 5, 5),torch.randn(1, 3, 5, 5),torch.randn(1, 6, 3, 3),torch.randn(1, 6, 3, 3),)# program capturem = torch.export.export(m, example_inputs, strict=True).module()m = prepare_pt2...
6
64
2
465
0
872
944
872
null
[]
None
null
0
0
0
null
0
null
The function (_test_transitive_sharing_with_cat_helper) defined within the public class called public.The function start at line 872 and ends at 944. It contains 64 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [872.0] and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec_transitivity.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)bias = node.args[2]assert is...
6
70
2
351
0
962
1,032
962
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec_transitivity.annotate) defined within the public class called public.The function start at line 962 and ends at 1032. It contains 70 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [962.0] and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec_transitivity.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
1,034
1,035
1,034
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec_transitivity.validate) defined within the public class called public.The function start at line 1034 and ends at 1035. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1034.0] and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec_transitivity
def test_shared_qspec_transitivity(self):"""This tests the transitivity of SharedQuantizationSpec, that isif A is shared with B, B is shared with C, then C should be shared with A as wellx1 -> conv1 -> cat1 -----> cat2x2 -> conv2 -// x3 -> add / x4/both cat has shared input and output, and because of cat and (cat1 -> c...
1
5
1
24
0
946
1,037
946
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec_transitivity) defined within the public class called public.The function start at line 946 and ends at 1037. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec_transitivity_case_2.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.conv2d.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)bias = node.args[2]assert is...
5
70
2
348
0
1,058
1,128
1,058
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec_transitivity_case_2.annotate) defined within the public class called public.The function start at line 1058 and ends at 1128. It contains 70 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [1058.0] and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec_transitivity_case_2.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
1,130
1,131
1,130
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec_transitivity_case_2.validate) defined within the public class called public.The function start at line 1130 and ends at 1131. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1130.0] and does not return any value..
pytorch_ao
public
public
0
0
test_shared_qspec_transitivity_case_2
def test_shared_qspec_transitivity_case_2(self):"""This tests the transitivity of SharedQuantizationSpec, that isif A is shared with B, B is shared with C, then C should be shared with A as wellx1 -> conv1 -> cat1 -----> cat2x2 -> conv2 -// x3 -> add / x4/both cat has shared input and output, and because of cat and (ca...
1
5
1
24
0
1,039
1,133
1,039
null
[]
None
null
0
0
0
null
0
null
The function (test_shared_qspec_transitivity_case_2) defined within the public class called public.The function start at line 1039 and ends at 1133. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_allow_implicit_sharing.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if node.target is torch.ops.aten.add.Tensor:add_node = nodefirst_input_node = add_node.args[0]second_input_node = add_node.args[1]input_qspec_map = {}act_qspec = QuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max...
3
30
2
153
0
1,157
1,187
1,157
null
[]
None
null
0
0
0
null
0
null
The function (test_allow_implicit_sharing.annotate) defined within the public class called public.The function start at line 1157 and ends at 1187. It contains 30 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1157.0] and does not return any value..
pytorch_ao
public
public
0
0
test_allow_implicit_sharing.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
1,189
1,190
1,189
null
[]
None
null
0
0
0
null
0
null
The function (test_allow_implicit_sharing.validate) defined within the public class called public.The function start at line 1189 and ends at 1190. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1189.0] and does not return any value..
pytorch_ao
public
public
0
0
test_allow_implicit_sharing
def test_allow_implicit_sharing(self):"""This tests the allow_transitive_sharing flag of QuantizationAnnotation, that isif a node is configured with allow_implicit_sharing=False, we will not have implicit sharingfor node and (node, consumer) even they refer to the same Tensorx1 -> add1 -----> add3x2 -// x3 -> add2 / x4...
3
28
1
268
0
1,135
1,217
1,135
null
[]
None
null
0
0
0
null
0
null
The function (test_allow_implicit_sharing) defined within the public class called public.The function start at line 1135 and ends at 1217. It contains 28 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_allow_implicit_sharing_with_shared_input_edge.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if node.target in [torch.ops.aten.clone.default,torch.ops.aten.eq.Tensor,]:input_qspec_map = {}qspec = QuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,is_dynamic=False,obser...
5
31
2
209
0
1,257
1,290
1,257
null
[]
None
null
0
0
0
null
0
null
The function (test_allow_implicit_sharing_with_shared_input_edge.annotate) defined within the public class called public.The function start at line 1257 and ends at 1290. It contains 31 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [1257.0] and does not return any value..
pytorch_ao
public
public
0
0
test_allow_implicit_sharing_with_shared_input_edge.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
1,292
1,293
1,292
null
[]
None
null
0
0
0
null
0
null
The function (test_allow_implicit_sharing_with_shared_input_edge.validate) defined within the public class called public.The function start at line 1292 and ends at 1293. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1292.0] and does not return any value..
pytorch_ao
public
public
0
0
test_allow_implicit_sharing_with_shared_input_edge.forward
def forward(self, x):a = x.clone()b = torch.eq(a, x)return b
1
4
2
26
0
1,296
1,299
1,296
null
[]
None
null
0
0
0
null
0
null
The function (test_allow_implicit_sharing_with_shared_input_edge.forward) defined within the public class called public.The function start at line 1296 and ends at 1299. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1296.0] and does not return any value..
pytorch_ao
public
public
0
0
test_allow_implicit_sharing_with_shared_input_edge
def test_allow_implicit_sharing_with_shared_input_edge(self):"""This tests implicit sharing when an input edge x is shared betweentwo ops in the following manner:/-----------------> eq(a, x) -> b / /x -> clone(x) -> a -/Clone is annotated such that (x, clone) uses a QuantizationSpec andits output (clone) a SharedQuanti...
4
25
1
238
0
1,219
1,319
1,219
null
[]
None
null
0
0
0
null
0
null
The function (test_allow_implicit_sharing_with_shared_input_edge) defined within the public class called public.The function start at line 1219 and ends at 1319. It contains 25 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_quantization_dtype.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:info_fun = torch.iinfo if quant_dtype == torch.int16 else torch.finfoactivate_qspec = QuantizationSpec(dtype=quant_dtype,quant_min=int(info_fun(quant_dtype).min),quant_max=int(info_fun(quant_dtype).max),qscheme=torch.per_tensor_affine,is_dynamic=Fa...
2
25
2
149
0
1,328
1,352
1,328
null
[]
None
null
0
0
0
null
0
null
The function (test_quantization_dtype.annotate) defined within the public class called public.The function start at line 1328 and ends at 1352. It contains 25 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1328.0] and does not return any value..
pytorch_ao
public
public
0
0
test_quantization_dtype.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
1,354
1,355
1,354
null
[]
None
null
0
0
0
null
0
null
The function (test_quantization_dtype.validate) defined within the public class called public.The function start at line 1354 and ends at 1355. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1354.0] and does not return any value..
pytorch_ao
public
public
0
0
test_quantization_dtype.__init__
def __init__(self, dtype):super().__init__()self.conv = torch.nn.Conv2d(3, 3, 3, dtype=dtype)
1
3
2
34
0
1,358
1,360
1,358
null
[]
None
null
0
0
0
null
0
null
The function (test_quantization_dtype.__init__) defined within the public class called public.The function start at line 1358 and ends at 1360. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1358.0] and does not return any value..
pytorch_ao
public
public
0
0
test_quantization_dtype.forward
def forward(self, x):return self.conv(x)
1
2
2
14
0
1,362
1,363
1,362
null
[]
None
null
0
0
0
null
0
null
The function (test_quantization_dtype.forward) defined within the public class called public.The function start at line 1362 and ends at 1363. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1362.0] and does not return any value..
pytorch_ao
public
public
0
0
test_quantization_dtype.verify_quant_dequant_iotypes
def verify_quant_dequant_iotypes(m):for node in m.graph.nodes:if (node.op == "call_function"and node.target.__name__ == "dequantize_per_tensor.default"):# Check dequantize nodedequant_node = nodedequant_in_dtype = dequant_node.args[5]dequant_out_dtype = torch.float32if "out_dtype" in dequant_node.kwargs:dequant_out_dty...
9
24
1
139
0
1,386
1,413
1,386
null
[]
None
null
0
0
0
null
0
null
The function (test_quantization_dtype.verify_quant_dequant_iotypes) defined within the public class called public.The function start at line 1386 and ends at 1413. It contains 24 lines of code and it has a cyclomatic complexity of 9. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_quantization_dtype
def test_quantization_dtype(self, dtype, quant_dtype):if torch_version_at_least("2.7.0") and TEST_HPU:unittest.SkipTest("test doesn't currently work with HPU")class DtypeActQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:info_fun = torch.iinfo if quant_dtype == torch.int16 e...
3
30
3
175
0
1,323
1,415
1,323
null
[]
None
null
0
0
0
null
0
null
The function (test_quantization_dtype) defined within the public class called public.The function start at line 1323 and ends at 1415. It contains 30 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [1323.0] and does not return any value..
pytorch_ao
public
public
0
0
test_input_edge_sanity_check.forward
def forward(self, x):return x + 6
1
2
2
11
0
1,419
1,420
1,419
null
[]
None
null
0
0
0
null
0
null
The function (test_input_edge_sanity_check.forward) defined within the public class called public.The function start at line 1419 and ends at 1420. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1419.0] and does not return any value..
pytorch_ao
public
public
0
0
test_input_edge_sanity_check.annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.add.Tensor):input_act1 = node.args[0]# this is a constant, so not valid for annotationinput_act2 = node.args[1]act_qspec = QuantizationSpec(dtype=torch.ui...
4
24
2
133
0
1,423
1,448
1,423
null
[]
None
null
0
0
0
null
0
null
The function (test_input_edge_sanity_check.annotate) defined within the public class called public.The function start at line 1423 and ends at 1448. It contains 24 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [1423.0] and does not return any value..
pytorch_ao
public
public
0
0
test_input_edge_sanity_check.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
1,450
1,451
1,450
null
[]
None
null
0
0
0
null
0
null
The function (test_input_edge_sanity_check.validate) defined within the public class called public.The function start at line 1450 and ends at 1451. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1450.0] and does not return any value..
pytorch_ao
public
public
0
0
test_input_edge_sanity_check
def test_input_edge_sanity_check(self):class M(torch.nn.Module):def forward(self, x):return x + 6class BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:for node in model.graph.nodes:if (node.op == "call_function"and node.target == torch.ops.aten.add.Tensor):input_act1...
1
11
1
91
0
1,417
1,457
1,417
null
[]
None
null
0
0
0
null
0
null
The function (test_input_edge_sanity_check) defined within the public class called public.The function start at line 1417 and ends at 1457. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_quantize
def _quantize(self, m, quantizer, example_inputs, is_qat: bool = False):# resetting dynamo cachetorch._dynamo.reset()m = torch.export.export(m,example_inputs,).module()if is_qat:m = prepare_qat_pt2e(m, quantizer)else:m = prepare_pt2e(m, quantizer)m(*example_inputs)m = convert_pt2e(m)return m
2
13
5
75
0
1,459
1,473
1,459
null
[]
None
null
0
0
0
null
0
null
The function (_quantize) defined within the public class called public.The function start at line 1459 and ends at 1473. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [1459.0] and does not return any value..