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_quantize_in_place_ops.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,)for node in model.graph.nodes:if (node.op == "call_function"and node.tar...
4
27
2
159
0
2,974
3,000
2,974
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_in_place_ops.annotate) defined within the public class called public.The function start at line 2974 and ends at 3000. It contains 27 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [2974.0] and does not return any value..
pytorch_ao
public
public
0
0
test_quantize_in_place_ops.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
3,002
3,003
3,002
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_in_place_ops.validate) defined within the public class called public.The function start at line 3002 and ends at 3003. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3002.0] and does not return any value..
pytorch_ao
public
public
0
0
test_quantize_in_place_ops.__init__
def __init__(self):super().__init__()self.register_buffer("buf", torch.randn(1, 2, 3, 3))
1
3
1
31
0
3,006
3,008
3,006
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_in_place_ops.__init__) defined within the public class called public.The function start at line 3006 and ends at 3008. 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_quantize_in_place_ops.forward
def forward(self, x):self.buf.add_(x)return self.buf
1
3
2
19
0
3,010
3,012
3,010
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_in_place_ops.forward) defined within the public class called public.The function start at line 3010 and ends at 3012. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3010.0] and does not return any value..
pytorch_ao
public
public
0
0
test_quantize_in_place_ops.has_inplace_ops
def has_inplace_ops(graph_module: torch.fx.GraphModule) -> bool:return (len([nfor n in graph_module.graph.nodesif n.op == "call_function"and n.name.endswith("_")and n.name != "copy_"])> 0)
5
13
1
53
0
3,014
3,026
3,014
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_in_place_ops.has_inplace_ops) defined within the public class called public.The function start at line 3014 and ends at 3026. It contains 13 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_quantize_in_place_ops
def test_quantize_in_place_ops(self):class TestQuantizer(Quantizer):example_inputs = Nonedef set_example_inputs(self, example_inputs):self.example_inputs = example_inputsdef transform_for_annotation(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:# Make a copy of the graph to ensure that we are using the# re...
3
26
1
175
0
2,958
3,047
2,958
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_in_place_ops) defined within the public class called public.The function start at line 2958 and ends at 3047. It contains 26 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_channel_group_quantization.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.linear.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)act_qspec = QuantizationSpec...
4
41
2
217
0
3,060
3,103
3,060
null
[]
None
null
0
0
0
null
0
null
The function (test_channel_group_quantization.annotate) defined within the public class called public.The function start at line 3060 and ends at 3103. It contains 41 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [3060.0] and does not return any value..
pytorch_ao
public
public
0
0
test_channel_group_quantization.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
3,105
3,106
3,105
null
[]
None
null
0
0
0
null
0
null
The function (test_channel_group_quantization.validate) defined within the public class called public.The function start at line 3105 and ends at 3106. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3105.0] and does not return any value..
pytorch_ao
public
public
0
0
test_channel_group_quantization.__init__
def __init__(self):super().__init__()self.linear = torch.nn.Linear(128, 20)
1
3
1
26
0
3,109
3,111
3,109
null
[]
None
null
0
0
0
null
0
null
The function (test_channel_group_quantization.__init__) defined within the public class called public.The function start at line 3109 and ends at 3111. 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_channel_group_quantization.forward
def forward(self, x):return self.linear(x)
1
2
2
14
0
3,113
3,114
3,113
null
[]
None
null
0
0
0
null
0
null
The function (test_channel_group_quantization.forward) defined within the public class called public.The function start at line 3113 and ends at 3114. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3113.0] and does not return any value..
pytorch_ao
public
public
0
0
test_channel_group_quantization
def test_channel_group_quantization(self):from torchao.quantization.pt2e._affine_quantization import (AffineQuantizedMinMaxObserver,)from torchao.quantization.pt2e.observer import MappingType, PerGroup, PerTokenclass BackendAQuantizer(Quantizer):def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:fo...
1
28
1
140
0
3,053
3,132
3,053
null
[]
None
null
0
0
0
null
0
null
The function (test_channel_group_quantization) defined within the public class called public.The function start at line 3053 and ends at 3132. 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_dynamic_affine_act_per_channel_weights.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.linear.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)activation_dtype = torch.int...
4
40
2
209
0
3,147
3,189
3,147
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_affine_act_per_channel_weights.annotate) defined within the public class called public.The function start at line 3147 and ends at 3189. It contains 40 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [3147.0] and does not return any value..
pytorch_ao
public
public
0
0
test_dynamic_affine_act_per_channel_weights.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
3,191
3,192
3,191
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_affine_act_per_channel_weights.validate) defined within the public class called public.The function start at line 3191 and ends at 3192. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3191.0] and does not return any value..
pytorch_ao
public
public
0
0
test_dynamic_affine_act_per_channel_weights.__init__
def __init__(self):super().__init__()self.linear = torch.nn.Linear(128, 20)
1
3
1
26
0
3,195
3,197
3,195
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_affine_act_per_channel_weights.__init__) defined within the public class called public.The function start at line 3195 and ends at 3197. 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_dynamic_affine_act_per_channel_weights.forward
def forward(self, x):return self.linear(x)
1
2
2
14
0
3,199
3,200
3,199
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_affine_act_per_channel_weights.forward) defined within the public class called public.The function start at line 3199 and ends at 3200. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3199.0] and does not return any value..
pytorch_ao
public
public
0
0
test_dynamic_affine_act_per_channel_weights
def test_dynamic_affine_act_per_channel_weights(self):import operatorfrom torchao.quantization.pt2e._affine_quantization import (AffineQuantizedMovingAverageMinMaxObserver,)from torchao.quantization.pt2e.observer import (MappingType,PerChannelMinMaxObserver,PerToken,)class BackendAQuantizer(Quantizer):def annotate(self...
1
38
1
191
0
3,134
3,223
3,134
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_affine_act_per_channel_weights) defined within the public class called public.The function start at line 3134 and ends at 3223. 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_dynamic_per_tok_act_per_group_weights.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.linear.default):input_act = node.args[0]assert isinstance(input_act, Node)weight = node.args[1]assert isinstance(weight, Node)activation_dtype = torch.int...
4
43
2
226
0
3,236
3,281
3,236
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_per_tok_act_per_group_weights.annotate) defined within the public class called public.The function start at line 3236 and ends at 3281. It contains 43 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [3236.0] and does not return any value..
pytorch_ao
public
public
0
0
test_dynamic_per_tok_act_per_group_weights.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
3,283
3,284
3,283
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_per_tok_act_per_group_weights.validate) defined within the public class called public.The function start at line 3283 and ends at 3284. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3283.0] and does not return any value..
pytorch_ao
public
public
0
0
test_dynamic_per_tok_act_per_group_weights.__init__
def __init__(self):super().__init__()self.linear = torch.nn.Linear(128, 20)
1
3
1
26
0
3,287
3,289
3,287
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_per_tok_act_per_group_weights.__init__) defined within the public class called public.The function start at line 3287 and ends at 3289. 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_dynamic_per_tok_act_per_group_weights.forward
def forward(self, x):return self.linear(x)
1
2
2
14
0
3,291
3,292
3,291
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_per_tok_act_per_group_weights.forward) defined within the public class called public.The function start at line 3291 and ends at 3292. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3291.0] and does not return any value..
pytorch_ao
public
public
0
0
test_dynamic_per_tok_act_per_group_weights
def test_dynamic_per_tok_act_per_group_weights(self):import operator# TODO: merge into torchao observerfrom torchao.quantization.pt2e._affine_quantization import (AffineQuantizedMinMaxObserver,AffineQuantizedPlaceholderObserver,)from torchao.quantization.pt2e.observer import MappingType, PerGroup, PerTokenclass Backend...
1
35
1
180
0
3,225
3,315
3,225
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_per_tok_act_per_group_weights) defined within the public class called public.The function start at line 3225 and ends at 3315. 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
__init__
def __init__(self,conv_class: type[torch.nn.Module],bn_class: type[torch.nn.Module],has_conv_bias: bool,has_bn: bool,has_relu: bool,**conv_kwargs,):super().__init__()conv_kwargs.setdefault("in_channels", 3)conv_kwargs.setdefault("out_channels", 3)conv_kwargs.setdefault("kernel_size", 3)conv_kwargs.setdefault("bias", ha...
3
17
7
121
0
63
79
63
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 63 and ends at 79. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 7 parameters, represented as [63.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):x = self.conv(x)if self.bn is not None:x = self.bn(x)if self.relu is not None:x = self.relu(x)return x
3
7
2
49
0
81
87
81
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 81 and ends at 87. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [81.0] and does not return any value..
pytorch_ao
public
public
0
0
_get_conv_bn_model
def _get_conv_bn_model(self,has_conv_bias: bool = True,has_bn: bool = True,has_relu: bool = False,transpose: bool = False,**conv_kwargs,):"""Return an instance of a simple test model containing theconv[-bn][-relu] pattern. By default, this returns aconv-bn model with conv bias."""return self._BaseConvBnModel(self.conv_...
2
16
6
63
0
89
109
89
null
[]
None
null
0
0
0
null
0
null
The function (_get_conv_bn_model) defined within the public class called public.The function start at line 89 and ends at 109. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [89.0] and does not return any value..
pytorch_ao
public
public
0
0
_verify_symmetric_xnnpack_qat_numerics
def _verify_symmetric_xnnpack_qat_numerics(self,model: torch.nn.Module,example_inputs: tuple[Any, ...],):self._verify_symmetric_xnnpack_qat_numerics_helper(model,example_inputs,is_per_channel=True,)self._verify_symmetric_xnnpack_qat_numerics_helper(model,example_inputs,is_per_channel=False,)
1
15
3
49
0
111
125
111
null
[]
None
null
0
0
0
null
0
null
The function (_verify_symmetric_xnnpack_qat_numerics) defined within the public class called public.The function start at line 111 and ends at 125. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [111.0] and does not return any value..
pytorch_ao
public
public
0
0
_verify_symmetric_xnnpack_qat_numerics_helper
def _verify_symmetric_xnnpack_qat_numerics_helper(self,model: torch.nn.Module,example_inputs: tuple[Any, ...],is_per_channel: bool,verify_convert: bool = True,):"""Helper method to verify that the QAT numerics for PT2E quantization match those ofFX graph mode quantization for symmetric qnnpack."""# resetting dynamo cac...
3
55
5
292
0
127
195
127
null
[]
None
null
0
0
0
null
0
null
The function (_verify_symmetric_xnnpack_qat_numerics_helper) defined within the public class called public.The function start at line 127 and ends at 195. It contains 55 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [127.0] and does not return any value..
pytorch_ao
public
public
0
0
_verify_symmetric_xnnpack_qat_graph
def _verify_symmetric_xnnpack_qat_graph(self,m: torch.fx.GraphModule,example_inputs: tuple[Any, ...],has_relu: bool,has_bias: bool = True,is_cuda: bool = False,expected_conv_literal_args: Optional[tuple[Any, ...]] = None,# TODO: set this to true by defaultverify_convert: bool = False,):self._verify_symmetric_xnnpack_qa...
1
30
8
125
0
197
227
197
null
[]
None
null
0
0
0
null
0
null
The function (_verify_symmetric_xnnpack_qat_graph) defined within the public class called public.The function start at line 197 and ends at 227. It contains 30 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [197.0] and does not return any value..
pytorch_ao
public
public
0
0
_verify_symmetric_xnnpack_qat_graph_helper
def _verify_symmetric_xnnpack_qat_graph_helper(self,m: torch.fx.GraphModule,example_inputs: tuple[Any, ...],is_per_channel: bool,has_relu: bool,has_bias: bool = True,is_cuda: bool = False,expected_conv_literal_args: Optional[tuple[Any, ...]] = None,verify_convert: bool = False,):"""Verify that the graph module matches ...
11
167
9
1,135
0
229
423
229
null
[]
None
null
0
0
0
null
0
null
The function (_verify_symmetric_xnnpack_qat_graph_helper) defined within the public class called public.The function start at line 229 and ends at 423. It contains 167 lines of code and it has a cyclomatic complexity of 11. It takes 9 parameters, represented as [229.0] and does not return any value..
pytorch_ao
public
public
0
0
setUp
def setUp(self):# NB: Skip the test if this is a base class, this is to handle the test# discovery logic in buck which finds and runs all tests here including# the base class which we don't want to runif self.id() and "_Base" in self.id():self.skipTest("Skipping test running from base class")
3
3
1
26
0
437
442
437
null
[]
None
null
0
0
0
null
0
null
The function (setUp) defined within the public class called public.The function start at line 437 and ends at 442. It contains 3 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_qat_conv_no_bias
def test_qat_conv_no_bias(self):m1 = self._get_conv_bn_model(has_conv_bias=False, has_bn=False, has_relu=True)m2 = self._get_conv_bn_model(has_conv_bias=False, has_bn=False, has_relu=False)self._verify_symmetric_xnnpack_qat_numerics(m1, self.example_inputs)self._verify_symmetric_xnnpack_qat_numerics(m2, self.example_in...
1
5
1
61
0
444
448
444
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_no_bias) defined within the public class called public.The function start at line 444 and ends at 448. 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_qat_conv_bn_fusion
def test_qat_conv_bn_fusion(self):m = self._get_conv_bn_model()self._verify_symmetric_xnnpack_qat_graph(m, self.example_inputs, has_relu=False)self._verify_symmetric_xnnpack_qat_numerics(m, self.example_inputs)
1
4
1
36
0
450
453
450
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_fusion) defined within the public class called public.The function start at line 450 and ends at 453. It contains 4 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_qat_conv_bn_fusion_cuda
def test_qat_conv_bn_fusion_cuda(self):m = self._get_conv_bn_model().cuda()example_inputs = (self.example_inputs[0].cuda(),)self._verify_symmetric_xnnpack_qat_graph(m,example_inputs,has_relu=False,is_cuda=True,)self._verify_symmetric_xnnpack_qat_numerics(m, example_inputs)
1
10
1
56
0
456
465
456
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_fusion_cuda) defined within the public class called public.The function start at line 456 and ends at 465. 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_qat_conv_bn_fusion_literal_args.__init__
def __init__(self, conv_class, bn_class):super().__init__()self.conv = conv_class(3, 3, 3, stride=2, padding=4)self.bn = bn_class(3)
1
4
3
44
0
469
472
469
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_fusion_literal_args.__init__) defined within the public class called public.The function start at line 469 and ends at 472. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [469.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_conv_bn_fusion_literal_args.forward
def forward(self, x):x = self.conv(x)x = self.bn(x)return x
1
4
2
25
0
474
477
474
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_fusion_literal_args.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 2 parameters, represented as [474.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_conv_bn_fusion_literal_args
def test_qat_conv_bn_fusion_literal_args(self):class M(torch.nn.Module):def __init__(self, conv_class, bn_class):super().__init__()self.conv = conv_class(3, 3, 3, stride=2, padding=4)self.bn = bn_class(3)def forward(self, x):x = self.conv(x)x = self.bn(x)return xassert self.dim in [1, 2]if self.dim == 1:# stride, paddi...
2
19
1
165
0
467
497
467
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_fusion_literal_args) defined within the public class called public.The function start at line 467 and ends at 497. It contains 19 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_qat_conv_bn_fusion_no_conv_bias.__init__
def __init__(self, conv_class, bn_class):super().__init__()self.conv1 = conv_class(3, 3, 3, bias=False)self.bn1 = bn_class(3)self.conv2 = conv_class(3, 3, 3, bias=True)self.bn2 = bn_class(3)
1
6
3
64
0
505
510
505
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_fusion_no_conv_bias.__init__) defined within the public class called public.The function start at line 505 and ends at 510. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [505.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_conv_bn_fusion_no_conv_bias.forward
def forward(self, x):x = self.conv1(x)x = self.bn1(x)x = self.conv2(x)x = self.bn2(x)return x
1
6
2
41
0
512
517
512
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_fusion_no_conv_bias.forward) defined within the public class called public.The function start at line 512 and ends at 517. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [512.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_conv_bn_fusion_no_conv_bias
def test_qat_conv_bn_fusion_no_conv_bias(self):class M2(torch.nn.Module):"""Mixed conv + BN with and without conv bias."""def __init__(self, conv_class, bn_class):super().__init__()self.conv1 = conv_class(3, 3, 3, bias=False)self.bn1 = bn_class(3)self.conv2 = conv_class(3, 3, 3, bias=True)self.bn2 = bn_class(3)def forw...
2
19
1
126
0
499
535
499
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_fusion_no_conv_bias) defined within the public class called public.The function start at line 499 and ends at 535. It contains 19 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_qat_conv_bn_relu_fusion
def test_qat_conv_bn_relu_fusion(self):m = self._get_conv_bn_model(has_relu=True)self._verify_symmetric_xnnpack_qat_graph(m, self.example_inputs, has_relu=True)self._verify_symmetric_xnnpack_qat_numerics(m, self.example_inputs)
1
4
1
39
0
537
540
537
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_relu_fusion) defined within the public class called public.The function start at line 537 and ends at 540. It contains 4 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_qat_conv_bn_relu_fusion_cuda
def test_qat_conv_bn_relu_fusion_cuda(self):m = self._get_conv_bn_model(has_relu=True).cuda()example_inputs = (self.example_inputs[0].cuda(),)self._verify_symmetric_xnnpack_qat_graph(m,example_inputs,has_relu=True,is_cuda=True,)self._verify_symmetric_xnnpack_qat_numerics(m, example_inputs)
1
10
1
59
0
543
552
543
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_relu_fusion_cuda) defined within the public class called public.The function start at line 543 and ends at 552. 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_qat_conv_bn_relu_fusion_no_conv_bias
def test_qat_conv_bn_relu_fusion_no_conv_bias(self):m = self._get_conv_bn_model(has_conv_bias=False, has_relu=True)self._verify_symmetric_xnnpack_qat_graph(m,self.example_inputs,has_relu=True,has_bias=False,)self._verify_symmetric_xnnpack_qat_numerics(m, self.example_inputs)
1
9
1
48
0
554
562
554
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_relu_fusion_no_conv_bias) defined within the public class called public.The function start at line 554 and ends at 562. It contains 9 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_qat_inplace_add_relu.__init__
def __init__(self, conv_class):super().__init__()self.conv = conv_class(1, 1, 1)self.relu = torch.nn.ReLU(inplace=True)
1
4
2
40
0
566
569
566
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_inplace_add_relu.__init__) defined within the public class called public.The function start at line 566 and ends at 569. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [566.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_inplace_add_relu.forward
def forward(self, x):x0 = xx = self.conv(x)x += x0x = self.relu(x)return x
1
6
2
31
0
571
576
571
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_inplace_add_relu.forward) defined within the public class called public.The function start at line 571 and ends at 576. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [571.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_inplace_add_relu
def test_qat_inplace_add_relu(self):class M(torch.nn.Module):def __init__(self, conv_class):super().__init__()self.conv = conv_class(1, 1, 1)self.relu = torch.nn.ReLU(inplace=True)def forward(self, x):x0 = xx = self.conv(x)x += x0x = self.relu(x)return xassert self.dim in [1, 2]if self.dim == 1:example_inputs = (torch....
2
11
1
86
0
564
585
564
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_inplace_add_relu) defined within the public class called public.The function start at line 564 and ends at 585. It contains 11 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_qat_update_shared_qspec.__init__
def __init__(self, conv_class, bn_class):super().__init__()self.conv = conv_class(3, 3, 3)self.bn = bn_class(3)self.hardtanh = torch.nn.Hardtanh()
1
5
3
47
0
594
598
594
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_update_shared_qspec.__init__) defined within the public class called public.The function start at line 594 and ends at 598. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [594.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_update_shared_qspec.forward
def forward(self, x):x = self.conv(x)x = self.bn(x)x = self.hardtanh(x)return x
1
5
2
33
0
600
604
600
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_update_shared_qspec.forward) defined within the public class called public.The function start at line 600 and ends at 604. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [600.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_update_shared_qspec
def test_qat_update_shared_qspec(self):"""Test the case where nodes used in SharedQuantizationSpec were replacedduring QAT subgraph rewriting."""class M(torch.nn.Module):def __init__(self, conv_class, bn_class):super().__init__()self.conv = conv_class(3, 3, 3)self.bn = bn_class(3)self.hardtanh = torch.nn.Hardtanh()def ...
1
6
1
42
0
587
607
587
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_update_shared_qspec) defined within the public class called public.The function start at line 587 and ends at 607. 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
test_qat_preserve_source_fn_stack.__init__
def __init__(self, conv_class, bn_class, backbone):super().__init__()self.conv = conv_class(5, 3, 3)self.bn = bn_class(3)self.relu = torch.nn.ReLU()self.backbone = backbone
1
6
4
54
0
615
620
615
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_preserve_source_fn_stack.__init__) defined within the public class called public.The function start at line 615 and ends at 620. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [615.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_preserve_source_fn_stack.forward
def forward(self, x):x = self.conv(x)x = self.bn(x)x = self.relu(x)x = self.backbone(x)return x
1
6
2
41
0
622
627
622
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_preserve_source_fn_stack.forward) defined within the public class called public.The function start at line 622 and ends at 627. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [622.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_preserve_source_fn_stack.get_conv_weight_and_bias
def get_conv_weight_and_bias(conv_node: torch.fx.Node):weight_dq_node = conv_node.args[1]qweight_node = weight_dq_node.args[0]bias_node = conv_node.args[2]assert isinstance(qweight_node, torch.fx.Node)assert isinstance(bias_node, torch.fx.Node)return (qweight_node, bias_node)
1
7
1
63
0
659
665
659
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_preserve_source_fn_stack.get_conv_weight_and_bias) defined within the public class called public.The function start at line 659 and ends at 665. It contains 7 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_qat_preserve_source_fn_stack.get_source_fn
def get_source_fn(node: torch.fx.Node):# E.g. [('l__self___backbone1_conv', <class 'torch.nn.modules.conv.Conv2d'>)]return node.meta["source_fn_stack"][0][0]
1
2
1
24
0
671
673
671
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_preserve_source_fn_stack.get_source_fn) defined within the public class called public.The function start at line 671 and ends at 673. 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_qat_preserve_source_fn_stack
def test_qat_preserve_source_fn_stack(self):"""Test whether `source_fn_stack` is preserved after QAT fusion."""class M(torch.nn.Module):def __init__(self, conv_class, bn_class, backbone):super().__init__()self.conv = conv_class(5, 3, 3)self.bn = bn_class(3)self.relu = torch.nn.ReLU()self.backbone = backbonedef forward(...
5
42
1
380
0
609
693
609
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_preserve_source_fn_stack) defined within the public class called public.The function start at line 609 and ends at 693. It contains 42 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_qat_conv_bn_bias_derived_qspec
def test_qat_conv_bn_bias_derived_qspec(self):m = self._get_conv_bn_model()example_inputs = self.example_inputsm = torch.export.export(m, example_inputs, strict=True).module()quantizer = ConvBnDerivedBiasQuantizer()m = prepare_qat_pt2e(m, quantizer)m(*example_inputs)m = convert_pt2e(m)m(*example_inputs)# Assert that bo...
1
39
1
262
0
695
740
695
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_bias_derived_qspec) defined within the public class called public.The function start at line 695 and ends at 740. 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_qat_per_channel_weight_custom_dtype
def test_qat_per_channel_weight_custom_dtype(self):m = self._get_conv_bn_model()example_inputs = self.example_inputsm = torch.export.export(m, example_inputs, strict=True).module()quantizer = ConvBnInt32WeightQuantizer()m = prepare_qat_pt2e(m, quantizer)m(*example_inputs)m = convert_pt2e(m)m(*example_inputs)# Assert th...
1
25
1
179
0
742
771
742
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_per_channel_weight_custom_dtype) defined within the public class called public.The function start at line 742 and ends at 771. It contains 25 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
_do_test_qat_conv_transpose_bn
def _do_test_qat_conv_transpose_bn(self, has_relu: bool):# Use different in/out channel sizes to test if conv weight is# properly transposed in QAT patternm = self._get_conv_bn_model(has_relu=has_relu,transpose=True,in_channels=3,out_channels=5,kernel_size=3,)self._verify_symmetric_xnnpack_qat_graph(m,self.example_inpu...
1
14
2
55
0
773
788
773
null
[]
None
null
0
0
0
null
0
null
The function (_do_test_qat_conv_transpose_bn) defined within the public class called public.The function start at line 773 and ends at 788. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [773.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_conv_transpose_bn
def test_qat_conv_transpose_bn(self):self._do_test_qat_conv_transpose_bn(has_relu=False)
1
2
1
13
0
790
791
790
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_transpose_bn) defined within the public class called public.The function start at line 790 and ends at 791. 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_qat_conv_transpose_bn_relu
def test_qat_conv_transpose_bn_relu(self):self._do_test_qat_conv_transpose_bn(has_relu=True)
1
2
1
13
0
793
794
793
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_transpose_bn_relu) defined within the public class called public.The function start at line 793 and ends at 794. 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_qat_conv_bn_per_channel_weight_bias
def test_qat_conv_bn_per_channel_weight_bias(self):m = self._get_conv_bn_model()example_inputs = self.example_inputsm = torch.export.export(m, example_inputs, strict=True).module()quantizer = ConvBnDerivedBiasQuantizer(is_per_channel=True)m = prepare_qat_pt2e(m, quantizer)m(*example_inputs)m = convert_pt2e(m)m(*example...
1
47
1
254
0
796
848
796
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv_bn_per_channel_weight_bias) defined within the public class called public.The function start at line 796 and ends at 848. It contains 47 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_fold_bn_erases_bn_node
def test_fold_bn_erases_bn_node(self):"""Ensure the BN node is erased from the graph after foldingit into conv in `convert_pt2e` even in train mode."""m = self._get_conv_bn_model(has_conv_bias=False, has_bn=True, has_relu=False)m = torch.export.export(m, self.example_inputs, strict=True).module()quantizer = XNNPACKQuan...
1
12
1
110
0
850
865
850
null
[]
None
null
0
0
0
null
0
null
The function (test_fold_bn_erases_bn_node) defined within the public class called public.The function start at line 850 and ends at 865. 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
_is_conv_node
def _is_conv_node(n: torch.fx.Node):return n.op == "call_function" and n.target in [torch.ops.aten.conv1d.default,torch.ops.aten.conv2d.default,torch.ops.aten.conv_transpose1d,torch.ops.aten.conv_transpose1d.default,torch.ops.aten.conv_transpose2d,torch.ops.aten.conv_transpose2d.input,]
2
9
1
80
0
888
896
888
null
[]
None
null
0
0
0
null
0
null
The function (_is_conv_node) defined within the public class called public.The function start at line 888 and ends at 896. It contains 9 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
_get_conv_bn_getitem_nodes
def _get_conv_bn_getitem_nodes(model: torch.fx.GraphModule):"""Return a 3-tuple of (conv, bn, getitem) nodes from the graph."""model.graph.eliminate_dead_code()model.recompile()conv_node = Nonebn_node = Nonegetitem_node = Nonefor n in model.graph.nodes:if _is_conv_node(n):conv_node = nif n.target in (torch.ops.aten._na...
5
18
1
109
3
899
919
899
null
['getitem_node', 'bn_node', 'conv_node']
None
null
0
0
0
null
0
null
The function (_get_conv_bn_getitem_nodes) defined within the public class called public.The function start at line 899 and ends at 919. It contains 18 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:conv_node, bn_node, getitem_node = _get_conv_bn_getitem_nodes(model)act_qspec = QuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,observer_or_fake_quant_ctr=default_fake_quant,)weight_qspec = QuantizationS...
1
30
2
156
0
928
959
928
null
[]
None
null
0
0
0
null
0
null
The function (annotate) defined within the public class called public.The function start at line 928 and ends at 959. It contains 30 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [928.0] and does not return any value..
pytorch_ao
public
public
0
0
validate
def validate(self, model: torch.fx.GraphModule):pass
1
2
2
14
0
961
962
961
null
[]
None
null
0
0
0
null
0
null
The function (validate) defined within the public class called public.The function start at line 961 and ends at 962. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [961.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, is_per_channel: bool = False):super().__init__()self.is_per_channel = is_per_channel
1
3
2
23
0
971
973
971
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 971 and ends at 973. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [971.0] and does not return any value..
pytorch_ao
public
public
0
0
_derive_bias_qparams_from_act_and_weight_qparams
def _derive_bias_qparams_from_act_and_weight_qparams(self, obs_or_fqs):act_scale, _ = obs_or_fqs[0].calculate_qparams()weight_scale, _ = obs_or_fqs[1].calculate_qparams()if self.is_per_channel:bias_scale = act_scale * weight_scalebias_zero_point = torch.zeros_like(bias_scale, dtype=torch.int32)else:bias_scale = torch.t...
2
10
2
95
0
975
984
975
null
[]
None
null
0
0
0
null
0
null
The function (_derive_bias_qparams_from_act_and_weight_qparams) defined within the public class called public.The function start at line 975 and ends at 984. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [975.0] and does not return any value..
pytorch_ao
public
public
0
0
annotate
def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:if self.is_per_channel:weight_qscheme = torch.per_channel_symmetricweight_fq = FusedMovingAvgObsFakeQuantize.with_args(observer=MovingAveragePerChannelMinMaxObserver,)else:weight_qscheme = torch.per_tensor_affineweight_fq = default_fake_quantconv_n...
3
49
2
257
0
986
1,041
986
null
[]
None
null
0
0
0
null
0
null
The function (annotate) defined within the public class called public.The function start at line 986 and ends at 1041. It contains 49 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [986.0] and does not return any value..
pytorch_ao
public
public
0
0
validate
def validate(self, model: torch.fx.GraphModule):pass
1
2
2
14
0
1,043
1,044
961
null
[]
None
null
0
0
0
null
0
null
The function (validate) defined within the public class called public.The function start at line 1043 and ends at 1044. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [961.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_resnet18
def test_qat_resnet18(self):import torchvisionwith override_quantized_engine("qnnpack"):example_inputs = (torch.randn(1, 3, 224, 224),)m = torchvision.models.resnet18()self._verify_symmetric_xnnpack_qat_numerics(m, example_inputs)
1
6
1
47
0
1,052
1,058
1,052
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_resnet18) defined within the public class called public.The function start at line 1052 and ends at 1058. 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
test_qat_mobilenet_v2
def test_qat_mobilenet_v2(self):import torchvisionwith override_quantized_engine("qnnpack"):example_inputs = (torch.randn(1, 3, 224, 224),)m = torchvision.models.mobilenet_v2()self._verify_symmetric_xnnpack_qat_numerics(m, example_inputs)
1
6
1
47
0
1,062
1,068
1,062
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_mobilenet_v2) defined within the public class called public.The function start at line 1062 and ends at 1068. 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
__init__
def __init__(self) -> None:super().__init__()self.linear1 = torch.nn.Linear(16, 8, bias=False)self.linear2 = torch.nn.Linear(8, 8)
1
4
1
46
0
1,074
1,077
1,074
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 1074 and ends at 1077. It contains 4 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):return self.linear2(self.linear1(x))
1
2
2
19
0
1,079
1,080
1,079
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 1079 and ends at 1080. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1079.0] 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, 16, 3)self.linears = TestQuantizeMixQATAndPTQ.TwoLinear()self.my_linear = torch.nn.Linear(8, 8)
1
5
1
53
0
1,083
1,087
1,083
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 1083 and ends at 1087. 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
forward
def forward(self, x):conv_out = self.conv(x)permute_out = torch.permute(conv_out, (0, 2, 3, 1))linear_out = self.linears(permute_out)my_linear_out = self.my_linear(linear_out)# Hardtanh doesnt get quantized via xnnpack quantizer in this test# because it relies on the propagation rules# Need to fix thisreturn torch.nn.f...
1
6
2
60
0
1,089
1,097
1,089
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 1089 and ends at 1097. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1089.0] and does not return any value..
pytorch_ao
public
public
0
0
_prepare_qat_linears
def _prepare_qat_linears(self, model):for name, child in model.named_children():if isinstance(child, (torch.nn.Linear, TestQuantizeMixQATAndPTQ.TwoLinear)):if isinstance(child, torch.nn.Linear):in_channels = child.weight.size(1)else:in_channels = child.linear1.weight.size(1)example_input = (torch.rand((1, in_channels))...
4
20
2
154
0
1,099
1,119
1,099
null
[]
None
null
0
0
0
null
0
null
The function (_prepare_qat_linears) defined within the public class called public.The function start at line 1099 and ends at 1119. It contains 20 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [1099.0] and does not return any value..
pytorch_ao
public
public
0
0
_convert_qat_linears
def _convert_qat_linears(self, model):for name, child in model.named_children():if isinstance(child, torch.fx.GraphModule):torch.ao.quantization.move_exported_model_to_eval(child)converted_child = convert_pt2e(child)setattr(model, name, converted_child)else:self._convert_qat_linears(child)
3
8
2
62
0
1,121
1,128
1,121
null
[]
None
null
0
0
0
null
0
null
The function (_convert_qat_linears) defined within the public class called public.The function start at line 1121 and ends at 1128. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1121.0] and does not return any value..
pytorch_ao
public
public
0
0
test_mixing_qat_ptq
def test_mixing_qat_ptq(self):example_inputs = (torch.randn(2, 3, 4, 4),)model = TestQuantizeMixQATAndPTQ.QATPTQTestModule()self._prepare_qat_linears(model)model(*example_inputs)# must be fixed model.eval()self._convert_qat_linears(model)model(*example_inputs)model_pt2e = torch.export.export(model, example_inputs, stri...
1
31
1
210
0
1,130
1,170
1,130
null
[]
None
null
0
0
0
null
0
null
The function (test_mixing_qat_ptq) defined within the public class called public.The function start at line 1130 and ends at 1170. It contains 31 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_representation
def _test_representation(self,model: torch.nn.Module,example_inputs: tuple[Any, ...],quantizer: Quantizer,ref_node_occurrence: dict[ns, int],non_ref_node_occurrence: dict[ns, int],fixed_output_tol: Optional[float] = None,output_scale_idx: int = 2,) -> torch.nn.Module:# resetting dynamo cachetorch._dynamo.reset()model =...
5
43
8
273
0
36
89
36
null
[]
None
null
0
0
0
null
0
null
The function (_test_representation) defined within the public class called public.The function start at line 36 and ends at 89. It contains 43 lines of code and it has a cyclomatic complexity of 5. It takes 8 parameters, represented as [36.0] and does not return any value..
pytorch_ao
public
public
0
0
test_static_linear.__init__
def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(5, 5)
1
3
1
28
0
93
95
93
null
[]
None
null
0
0
0
null
0
null
The function (test_static_linear.__init__) defined within the public class called public.The function start at line 93 and ends at 95. 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_static_linear.forward
def forward(self, x):return self.linear(x)
1
2
2
14
0
97
98
97
null
[]
None
null
0
0
0
null
0
null
The function (test_static_linear.forward) defined within the public class called public.The function start at line 97 and ends at 98. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [97.0] and does not return any value..
pytorch_ao
public
public
0
0
test_static_linear
def test_static_linear(self):class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(5, 5)def forward(self, x):return self.linear(x)quantizer = XNNPACKQuantizer()operator_config = get_symmetric_quantization_config(is_per_channel=False)quantizer.set_global(operator_config)exam...
1
15
1
78
0
91
111
91
null
[]
None
null
0
0
0
null
0
null
The function (test_static_linear) defined within the public class called public.The function start at line 91 and ends at 111. 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_dynamic_linear.__init__
def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(5, 5)
1
3
1
28
0
115
117
115
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_linear.__init__) defined within the public class called public.The function start at line 115 and ends at 117. 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_dynamic_linear.forward
def forward(self, x):return self.linear(x)
1
2
2
14
0
119
120
119
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_linear.forward) defined within the public class called public.The function start at line 119 and ends at 120. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [119.0] and does not return any value..
pytorch_ao
public
public
0
0
test_dynamic_linear
def test_dynamic_linear(self):class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(5, 5)def forward(self, x):return self.linear(x)quantizer = XNNPACKQuantizer()operator_config = get_symmetric_quantization_config(is_per_channel=False, is_dynamic=True)quantizer.set_global(op...
1
18
1
88
0
113
136
113
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_linear) defined within the public class called public.The function start at line 113 and ends at 136. It contains 18 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_conv2d.__init__
def __init__(self) -> None:super().__init__()self.conv2d = torch.nn.Conv2d(3, 3, 3)
1
3
1
30
0
140
142
140
null
[]
None
null
0
0
0
null
0
null
The function (test_conv2d.__init__) defined within the public class called public.The function start at line 140 and ends at 142. 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_conv2d.forward
def forward(self, x):return self.conv2d(x)
1
2
2
14
0
144
145
144
null
[]
None
null
0
0
0
null
0
null
The function (test_conv2d.forward) defined within the public class called public.The function start at line 144 and ends at 145. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [144.0] and does not return any value..
pytorch_ao
public
public
0
0
test_conv2d
def test_conv2d(self):class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.conv2d = torch.nn.Conv2d(3, 3, 3)def forward(self, x):return self.conv2d(x)quantizer = XNNPACKQuantizer()operator_config = get_symmetric_quantization_config(is_per_channel=False)quantizer.set_global(operator_config)example_...
1
15
1
82
0
138
158
138
null
[]
None
null
0
0
0
null
0
null
The function (test_conv2d) defined within the public class called public.The function start at line 138 and ends at 158. 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_add.__init__
def __init__(self) -> None:super().__init__()
1
2
1
14
0
162
163
162
null
[]
None
null
0
0
0
null
0
null
The function (test_add.__init__) defined within the public class called public.The function start at line 162 and ends at 163. 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_add.forward
def forward(self, x, y):return x + y
1
2
3
13
0
165
166
165
null
[]
None
null
0
0
0
null
0
null
The function (test_add.forward) defined within the public class called public.The function start at line 165 and ends at 166. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [165.0] and does not return any value..
pytorch_ao
public
public
0
0
test_add
def test_add(self):class M(torch.nn.Module):def __init__(self) -> None:super().__init__()def forward(self, x, y):return x + yquantizer = XNNPACKQuantizer()quantization_config = get_symmetric_quantization_config(is_per_channel=True)quantizer.set_global(quantization_config)M().eval()example_inputs = (torch.randn(1, 3, 3,...
1
19
1
102
0
160
184
160
null
[]
None
null
0
0
0
null
0
null
The function (test_add) defined within the public class called public.The function start at line 160 and ends at 184. 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
test_add_relu.__init__
def __init__(self) -> None:super().__init__()
1
2
1
14
0
188
189
188
null
[]
None
null
0
0
0
null
0
null
The function (test_add_relu.__init__) defined within the public class called public.The function start at line 188 and ends at 189. 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_add_relu.forward
def forward(self, x, y):out = x + yout = torch.nn.functional.relu(out)return out
1
4
3
28
0
191
194
191
null
[]
None
null
0
0
0
null
0
null
The function (test_add_relu.forward) defined within the public class called public.The function start at line 191 and ends at 194. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [191.0] and does not return any value..
pytorch_ao
public
public
0
0
test_add_relu
def test_add_relu(self):class M(torch.nn.Module):def __init__(self) -> None:super().__init__()def forward(self, x, y):out = x + yout = torch.nn.functional.relu(out)return outquantizer = XNNPACKQuantizer()operator_config = get_symmetric_quantization_config(is_per_channel=True)quantizer.set_global(operator_config)example...
1
21
1
107
0
186
214
186
null
[]
None
null
0
0
0
null
0
null
The function (test_add_relu) defined within the public class called public.The function start at line 186 and ends at 214. 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_maxpool2d
def test_maxpool2d(self):quantizer = XNNPACKQuantizer()operator_config = get_symmetric_quantization_config(is_per_channel=True)quantizer.set_global(operator_config)m_eager = TestHelperModules.ConvMaxPool2d().eval()example_inputs = (torch.randn(1, 2, 2, 2),)self._test_representation(m_eager,example_inputs,quantizer,ref_...
1
13
1
73
0
216
230
216
null
[]
None
null
0
0
0
null
0
null
The function (test_maxpool2d) defined within the public class called public.The function start at line 216 and ends at 230. It contains 13 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_qdq_per_channel.__init__
def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(5, 5)
1
3
1
28
0
236
238
236
null
[]
None
null
0
0
0
null
0
null
The function (test_qdq_per_channel.__init__) defined within the public class called public.The function start at line 236 and ends at 238. 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_qdq_per_channel.forward
def forward(self, x):return self.linear(x)
1
2
2
14
0
240
241
240
null
[]
None
null
0
0
0
null
0
null
The function (test_qdq_per_channel.forward) defined within the public class called public.The function start at line 240 and ends at 241. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [240.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qdq_per_channel
def test_qdq_per_channel(self):"""Test representation for quantize_per_channel and dequantize_per_channel op"""class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(5, 5)def forward(self, x):return self.linear(x)quantizer = XNNPACKQuantizer()# use per channel quantization f...
2
39
1
216
0
232
281
232
null
[]
None
null
0
0
0
null
0
null
The function (test_qdq_per_channel) defined within the public class called public.The function start at line 232 and ends at 281. It contains 39 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_qdq.__init__
def __init__(self) -> None:super().__init__()
1
2
1
14
0
287
288
287
null
[]
None
null
0
0
0
null
0
null
The function (test_qdq.__init__) defined within the public class called public.The function start at line 287 and ends at 288. 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_qdq.forward
def forward(self, x, y):return x + y
1
2
3
13
0
290
291
290
null
[]
None
null
0
0
0
null
0
null
The function (test_qdq.forward) 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 3 parameters, represented as [290.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qdq
def test_qdq(self):"""Test representation for quantize and dequantize op"""class M(torch.nn.Module):def __init__(self) -> None:super().__init__()def forward(self, x, y):return x + yquantizer = XNNPACKQuantizer()quantization_config = get_symmetric_quantization_config(is_per_channel=True)quantizer.set_global(quantization...
1
31
1
169
0
283
320
283
null
[]
None
null
0
0
0
null
0
null
The function (test_qdq) defined within the public class called public.The function start at line 283 and ends at 320. It contains 31 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
get_default_quantizer
def get_default_quantizer(is_qat, is_dynamic):quantizer = X86InductorQuantizer()quantizer.set_global(xiq.get_default_x86_inductor_quantization_config(is_qat=is_qat, is_dynamic=is_dynamic))return quantizer
1
8
2
31
1
94
101
94
null
['quantizer']
None
null
0
0
0
null
0
null
The function (get_default_quantizer) defined within the public class called public.The function start at line 94 and ends at 101. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [94.0] and does not return any value..