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_activation_per_token_abs_max_dtype
def test_quantize_activation_per_token_abs_max_dtype(self):input = torch.zeros(10, 10, dtype=torch.bfloat16)quantized_ref, scale_ref = _quantize_activation_per_token_absmax(input)self.assertTrue(scale_ref.dtype, torch.bfloat16)input = torch.zeros(10, 10, dtype=torch.float32)quantized_ref, scale_ref = _quantize_activati...
1
10
1
113
0
365
376
365
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_activation_per_token_abs_max_dtype) defined within the public class called public.The function start at line 365 and ends at 376. 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_quantize_dequantize_group_sym
def test_quantize_dequantize_group_sym(self):input = torch.randn(10, 10)mapping_type = MappingType.SYMMETRICdtype = torch.int8block_size = (1, 2)scale, zero_point = choose_qparams_affine(input, mapping_type, block_size, dtype, eps=torch.finfo(torch.float32).eps)quantized = quantize_affine(input, block_size, scale, zero...
1
37
1
193
0
379
418
379
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_dequantize_group_sym) defined within the public class called public.The function start at line 379 and ends at 418. 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_quantize_dequantize_channel_asym
def test_quantize_dequantize_channel_asym(self):input = torch.randn(10, 10)mapping_type = MappingType.ASYMMETRICdtype = torch.int8block_size = (10, 1)scale, zero_point = choose_qparams_affine(input, mapping_type, block_size, dtype, eps=torch.finfo(torch.float32).eps)output_dtype = torch.float32quantized = quantize_affi...
1
38
1
194
0
421
459
421
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_dequantize_channel_asym) defined within the public class called public.The function start at line 421 and ends at 459. 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_quantize_dequantize_tensor_asym
def test_quantize_dequantize_tensor_asym(self):input = torch.randn(10, 10)mapping_type = MappingType.ASYMMETRICdtype = torch.int8block_size = (10, 10)output_dtype = torch.float32scale, zero_point = choose_qparams_affine(input, mapping_type, block_size, dtype, eps=torch.finfo(torch.float32).eps)quantized = quantize_affi...
1
36
1
187
0
462
498
462
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_dequantize_tensor_asym) defined within the public class called public.The function start at line 462 and ends at 498. 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_quantize_dequantize_channel_asym_4d
def test_quantize_dequantize_channel_asym_4d(self):input = torch.randn(3, 3, 10, 10)mapping_type = MappingType.ASYMMETRICdtype = torch.int8block_size = (3, 3, 1, 10)scale, zero_point = choose_qparams_affine(input, mapping_type, block_size, dtype, eps=torch.finfo(torch.float32).eps)quantized = quantize_affine(input, blo...
1
37
1
201
0
501
538
501
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_dequantize_channel_asym_4d) defined within the public class called public.The function start at line 501 and ends at 538. 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_quantize_dequantize_channel_asym_4d_multi_dim_reduction
def test_quantize_dequantize_channel_asym_4d_multi_dim_reduction(self):input = torch.randn(3, 3, 10, 10)mapping_type = MappingType.ASYMMETRICdtype = torch.int8block_size = (3, 3, 2, 2)scale, zero_point = choose_qparams_affine(input, mapping_type, block_size, dtype, eps=torch.finfo(torch.float32).eps)quantized = quantiz...
1
20
1
126
0
540
560
540
null
[]
None
null
0
0
0
null
0
null
The function (test_quantize_dequantize_channel_asym_4d_multi_dim_reduction) defined within the public class called public.The function start at line 540 and ends at 560. It contains 20 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_choose_qparams_tensor_asym_eps
def test_choose_qparams_tensor_asym_eps(self):input = torch.zeros(10, 10)mapping_type = MappingType.ASYMMETRICdtype = torch.int8block_size = (10, 10)scale, zero_point = choose_qparams_affine(input, mapping_type, block_size, dtype)eps = torch.finfo(torch.float32).epsself.assertEqual(scale, eps)
1
10
1
66
0
562
571
562
null
[]
None
null
0
0
0
null
0
null
The function (test_choose_qparams_tensor_asym_eps) defined within the public class called public.The function start at line 562 and ends at 571. 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_get_group_qparams_symmetric_memory
def test_get_group_qparams_symmetric_memory(self):"""Check the memory usage of the op"""weight = torch.randn(1024, 1024).to(device="cuda")original_mem_use = torch.cuda.memory_allocated()n_bit = 4groupsize = 128(scale_ao, _) = get_group_qparams_symmetric(weight, n_bit, groupsize)after_choose_qparams_mem_use = torch.cuda...
1
8
1
73
0
576
584
576
null
[]
None
null
0
0
0
null
0
null
The function (test_get_group_qparams_symmetric_memory) defined within the public class called public.The function start at line 576 and ends at 584. It contains 8 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_raises
def test_raises(self):"""Make sure some errors are raised when user requested an unsupported type of quantization"""input = torch.randn(10, 10)mapping_type = MappingType.ASYMMETRICdtype = torch.int8block_size = (10, 10)scale, zero_point = choose_qparams_affine(input, mapping_type, block_size, dtype)# make sure we can't...
1
15
1
109
0
586
605
586
null
[]
None
null
0
0
0
null
0
null
The function (test_raises) defined within the public class called public.The function start at line 586 and ends at 605. 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_get_groupwise_affine_qparams
def test_get_groupwise_affine_qparams(self):input = torch.randn(10, 256)n_bit = 4zero_point_domains = [ZeroPointDomain.FLOAT, ZeroPointDomain.INT]zero_point_dtypes = [torch.bfloat16, torch.int32]mapping_type = MappingType.ASYMMETRICdtype = torch.int8block_size = (1, 128)quant_min = 0quant_max = 2**n_bit - 1eps = 1e-6sc...
3
48
1
209
0
607
656
607
null
[]
None
null
0
0
0
null
0
null
The function (test_get_groupwise_affine_qparams) defined within the public class called public.The function start at line 607 and ends at 656. It contains 48 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_groupwise_affine_quantize_tensor_from_qparams
def test_groupwise_affine_quantize_tensor_from_qparams(self):input = torch.randn(10, 256)scales = torch.randn(10, 2)zeros = torch.randn(10, 2)n_bit = 4groupsize = 128for zero_point_domain in [ZeroPointDomain.FLOAT, ZeroPointDomain.INT]:w_int4x8 = groupwise_affine_quantize_tensor_from_qparams(input, scales, zeros, n_bit...
2
14
1
99
0
658
673
658
null
[]
None
null
0
0
0
null
0
null
The function (test_groupwise_affine_quantize_tensor_from_qparams) defined within the public class called public.The function start at line 658 and ends at 673. It contains 14 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_groupwise_affine_dequantize_tensor_from_qparams
def test_groupwise_affine_dequantize_tensor_from_qparams(self):input = torch.randint(0, 15, (10, 256), dtype=torch.int32)scales = torch.randn(10, 2).bfloat16()zeros = torch.randn(10, 2).bfloat16()n_bit = 4groupsize = 128for zero_point_domain in [ZeroPointDomain.FLOAT, ZeroPointDomain.INT]:if zero_point_domain == ZeroPo...
6
23
1
244
0
675
699
675
null
[]
None
null
0
0
0
null
0
null
The function (test_groupwise_affine_dequantize_tensor_from_qparams) defined within the public class called public.The function start at line 675 and ends at 699. It contains 23 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_fake_quantize_affine
def test_fake_quantize_affine(self):input = torch.randn(10, 10)mapping_type = MappingType.SYMMETRICblock_size = list(input.shape)for i in range(len(block_size) - 1):block_size[i] = 1dtype = torch.int8eps = 1e-5quant_min = -127quant_max = 127scale, zero_point = choose_qparams_affine(input,mapping_type,block_size,dtype,q...
2
30
1
157
0
701
732
701
null
[]
None
null
0
0
0
null
0
null
The function (test_fake_quantize_affine) defined within the public class called public.The function start at line 701 and ends at 732. It contains 30 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_fake_quantize_affine_cachemask
def test_fake_quantize_affine_cachemask(self):input = torch.randn(10, 10)mapping_type = MappingType.SYMMETRICblock_size = list(input.shape)for i in range(len(block_size) - 1):block_size[i] = 1dtype = torch.int8eps = 1e-5quant_min = -127quant_max = 127scale, zero_point = choose_qparams_affine(input,mapping_type,block_si...
2
38
1
184
0
734
773
734
null
[]
None
null
0
0
0
null
0
null
The function (test_fake_quantize_affine_cachemask) defined within the public class called public.The function start at line 734 and ends at 773. It contains 38 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_maybe_expand_scale_to_tensor_shape
def test_maybe_expand_scale_to_tensor_shape(self):# rowwise quantization: if all dimensions match except for the last one,# and the last dimension is 1, then just return the scale as isscale = torch.randn([3, 2, 1])target_shape = torch.Size([3, 2, 8])new_scale = _maybe_expand_scale_to_tensor_shape(scale, target_shape)s...
1
21
1
241
0
775
799
775
null
[]
None
null
0
0
0
null
0
null
The function (test_maybe_expand_scale_to_tensor_shape) defined within the public class called public.The function start at line 775 and ends at 799. 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
skipIfNoArm.wrapper
def wrapper(*args, **kwargs):if platform.processor() != "aarch64":raise unittest.SkipTest(reason)else:fn(*args, **kwargs)
2
5
2
35
0
51
55
51
null
[]
None
null
0
0
0
null
0
null
The function (skipIfNoArm.wrapper) defined within the public class called public.The function start at line 51 and ends at 55. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [51.0] and does not return any value..
pytorch_ao
public
public
0
0
skipIfNoArm
def skipIfNoArm(fn):reason = "Quantized operations require Arm."if isinstance(fn, type):if platform.processor() != "aarch64":fn.__unittest_skip__ = Truefn.__unittest_skip_why__ = reasonreturn fn@functools.wraps(fn)def wrapper(*args, **kwargs):if platform.processor() != "aarch64":raise unittest.SkipTest(reason)else:fn(*...
3
10
1
48
1
42
57
42
null
['reason']
None
null
0
0
0
null
0
null
The function (skipIfNoArm) defined within the public class called public.The function start at line 42 and ends at 57. It contains 10 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
__init__
def __init__(self, with_bn=False) -> None:super().__init__()self.conv = nn.Conv2d(3, 6, (2, 2), stride=(1, 1), padding=(1, 1))self.bn = torch.nn.BatchNorm2d(6)self.with_bn = with_bn
1
5
2
69
0
68
72
68
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 68 and ends at 72. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [68.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):x = self.conv(x)if self.with_bn:x = self.bn(x)return x
2
5
2
30
0
74
78
74
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 74 and ends at 78. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [74.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,inplace_add: bool = False,conv2d_type: NodePosType = NodePosType.left,use_bias: bool = False,with_bn: bool = False,) -> None:super().__init__()self.conv = torch.nn.Conv2d(in_channels=3,out_channels=3,kernel_size=3,stride=1,padding=1,bias=use_bias,)self.conv2 = torch.nn.Conv2d(in_channels=3,out_channel...
1
29
5
147
0
81
109
81
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 81 and ends at 109. It contains 29 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [81.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):if self.conv2d_type == NodePosType.left:if self.inplace_add:tmp = self.conv(x)if self.with_bn:tmp = self.bn(tmp)tmp += self.relu(x)return tmpelse:tmp = self.conv(x)if self.with_bn:tmp = self.bn(tmp)return tmp + self.relu(x)elif self.conv2d_type == NodePosType.right:if self.inplace_add:tmp = self.re...
9
27
2
180
0
111
137
111
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 111 and ends at 137. It contains 27 lines of code and it has a cyclomatic complexity of 9. It takes 2 parameters, represented as [111.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, single_op):super().__init__()self.conv = nn.Conv2d(2, 2, 1)self.single_op = single_op
1
4
2
33
0
140
143
140
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 140 and ends at 143. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [140.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):x = self.conv(x)x = self.single_op(x)return torch.pow(x, 2)
1
4
2
32
0
145
148
145
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 145 and ends at 148. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [145.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, use_bias) -> None:super().__init__()self.linear = nn.Linear(4, 4, bias=use_bias)
1
3
2
32
0
151
153
151
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 151 and ends at 153. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [151.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):return self.linear(x)
1
2
2
14
0
155
156
155
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 155 and ends at 156. It contains 2 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
__init__
def __init__(self, use_bias, postop, inplace_postop=False, post_op_algo="none") -> None:super().__init__()self.linear = nn.Linear(4, 4, bias=use_bias)if postop == nn.GELU:self.postop = postop(approximate=post_op_algo)else:self.postop = postop(inplace=inplace_postop)
2
9
5
71
0
159
167
159
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 159 and ends at 167. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [159.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):return self.postop(self.linear(x))
1
2
2
19
0
169
170
169
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 169 and ends at 170. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [169.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,inplace_add: bool = False,linear_pos: NodePosType = NodePosType.left,use_bias: bool = False,) -> None:super().__init__()self.linear = torch.nn.Linear(in_features=16, out_features=16, bias=use_bias)self.linear2 = torch.nn.Linear(in_features=16, out_features=16, bias=use_bias)self.relu = nn.ReLU()self.i...
1
16
4
98
0
173
188
173
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 173 and ends at 188. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [173.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):if self.linear_pos == NodePosType.left:if self.inplace_add:tmp = self.linear(x)tmp += self.relu(x)return tmpelse:tmp = self.linear(x)return tmp + self.relu(x)elif self.linear_pos == NodePosType.right:if self.inplace_add:tmp = self.relu(x)tmp += self.linear(x)return tmpelse:return self.relu(x) + sel...
7
23
2
154
0
190
212
190
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 190 and ends at 212. It contains 23 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [190.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,inplace_add: bool = False,) -> None:super().__init__()self.linear = torch.nn.Linear(in_features=16, out_features=16, bias=True)self.linear2 = torch.nn.Linear(in_features=16, out_features=16, bias=True)self.inplace_add = inplace_add
1
8
2
70
0
215
222
215
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 215 and ends at 222. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [215.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):if self.inplace_add:tmp = self.linear(x)tmp += self.linear2(tmp)return tmpelse:tmp = self.linear(x)return tmp + self.linear2(tmp)
2
8
2
49
0
224
231
224
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 224 and ends at 231. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [224.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,inplace_add: bool = False,) -> None:super().__init__()self.conv = torch.nn.Conv2d(in_channels=3, out_channels=3, kernel_size=3, stride=1, padding=1)self.conv2 = torch.nn.Conv2d(in_channels=3, out_channels=3, kernel_size=3, stride=1, padding=1)self.inplace_add = inplace_addself.bn = torch.nn.BatchNorm2...
1
14
2
110
0
234
247
234
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 234 and ends at 247. It contains 14 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
forward
def forward(self, x):if self.inplace_add:tmp = self.bn(self.conv(x))tmp += self.bn2(self.conv2(tmp))return tmpelse:tmp = self.bn(self.conv(x))return tmp + self.bn2(self.conv2(tmp))
2
8
2
69
0
249
256
249
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 249 and ends at 256. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [249.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,input_dim,transpose_for_score=False,num_attention_heads=None,attention_head_size=None,) -> None:super().__init__()self.input_dim = input_dimself.q_proj = nn.Linear(input_dim, input_dim, bias=False)self.k_proj = nn.Linear(input_dim, input_dim, bias=False)self.v_proj = nn.Linear(input_dim, input_dim, bi...
2
19
5
125
0
259
277
259
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 259 and ends at 277. It contains 19 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [259.0] and does not return any value..
pytorch_ao
public
public
0
0
transpose_for_scores
def transpose_for_scores(self, x: torch.Tensor) -> torch.Tensor:new_x_shape = x.size()[:-1] + (self.num_attention_heads,self.attention_head_size,)x = x.view(new_x_shape)return x.permute(0, 2, 1, 3)
1
7
2
59
0
279
285
279
null
[]
None
null
0
0
0
null
0
null
The function (transpose_for_scores) defined within the public class called public.The function start at line 279 and ends at 285. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [279.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):q = self.q_proj(x)k = self.k_proj(x)v = self.v_proj(x)if self.transpose_for_score:q = self.transpose_for_scores(q)k = self.transpose_for_scores(k)v = self.transpose_for_scores(v)scores = torch.matmul(q, k.transpose(-1, -2)) / (self.input_dim**0.5)attention = self.softmax(scores)weighted = torch.mat...
2
12
2
109
0
287
298
287
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 287 and ends at 298. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [287.0] and does not return any value..
pytorch_ao
public
public
0
0
_test_quantizer
def _test_quantizer(self,model,example_inputs,quantizer,expected_node_occurrence,expected_node_list=None,is_qat=False,debug=False,lower=False,):m_eager = model.train() if is_qat else model.eval()# program capturem = copy.deepcopy(m_eager)m = torch.export.export(m, example_inputs).module()# QAT Model failed to deepcopye...
9
39
9
240
0
302
347
302
null
[]
None
null
0
0
0
null
0
null
The function (_test_quantizer) defined within the public class called public.The function start at line 302 and ends at 347. It contains 39 lines of code and it has a cyclomatic complexity of 9. It takes 9 parameters, represented as [302.0] and does not return any value..
pytorch_ao
public
public
0
0
test_conv2d
def test_conv2d(self):"""Test pattern of single conv2d with ArmInductorQuantizer."""with torch.no_grad():m = TestHelperModules.SingleConv2dModule().eval()example_inputs = (torch.randn(2, 3, 16, 16),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_inductor_quantization_config())node_occurrence = {# o...
1
25
1
156
0
354
383
354
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 354 and ends at 383. 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
test_conv2d_binary
def test_conv2d_binary(self):"""Test pattern of conv2d with binary post ops (such as add) with ArmInductorQuantizer.Currently, only add as binary post op is supported."""conv2d_type_list = [NodePosType.left, NodePosType.both]example_inputs = (torch.randn(2, 3, 6, 6),)quantizer = ArmInductorQuantizer().set_global(armiq....
3
36
1
246
0
386
433
386
null
[]
None
null
0
0
0
null
0
null
The function (test_conv2d_binary) defined within the public class called public.The function start at line 386 and ends at 433. It contains 36 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_conv2d_binary2
def test_conv2d_binary2(self):"""Test Pattern:tmp = conv2d_1(x)tmp2 = conv2d_2(tmp)return tmp + tmp2Since conv2d_1 has 2 users, we should annotate conv2d_2 for binary fusion instead of conv2d_1"""example_inputs = (torch.randn(2, 3, 6, 6),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_inductor_quan...
3
33
1
205
0
436
476
436
null
[]
None
null
0
0
0
null
0
null
The function (test_conv2d_binary2) defined within the public class called public.The function start at line 436 and ends at 476. It contains 33 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
_single_op_share_observer_recipe_test_helper
def _single_op_share_observer_recipe_test_helper(self, m, x, single_op):quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_inductor_quantization_config())example_inputs = (x,)node_occurrence = {# one for input and weight of the conv, two for input/output for the maxpool2dtorch.ops.quantized_decomposed....
6
48
4
329
0
478
527
478
null
[]
None
null
0
0
0
null
0
null
The function (_single_op_share_observer_recipe_test_helper) defined within the public class called public.The function start at line 478 and ends at 527. It contains 48 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [478.0] and does not return any value..
pytorch_ao
public
public
0
0
test_linear
def test_linear(self):"""Test pattern of single linear with ArmInductorQuantizer."""with torch.no_grad():for use_bias in [True, False]:m = TestHelperModules.SingleLinearModule(use_bias).eval()example_inputs = (torch.randn(2, 4),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_inductor_quantization_c...
2
26
1
162
0
530
560
530
null
[]
None
null
0
0
0
null
0
null
The function (test_linear) defined within the public class called public.The function start at line 530 and ends at 560. It contains 26 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_linear_unary_helper
def _test_linear_unary_helper(self,post_op_module,post_op_aten,post_op_aten_inplace,post_op_algo_list=None,is_qat=False,is_dynamic=False,):"""Test pattern of linear with unary post ops (e.g. relu) with ArmInductorQuantizer."""use_bias_list = [True, False]# TODO test for inplace add after refactoring of exportinplace_li...
9
61
7
278
0
562
628
562
null
[]
None
null
0
0
0
null
0
null
The function (_test_linear_unary_helper) defined within the public class called public.The function start at line 562 and ends at 628. It contains 61 lines of code and it has a cyclomatic complexity of 9. It takes 7 parameters, represented as [562.0] and does not return any value..
pytorch_ao
public
public
0
0
test_linear_unary
def test_linear_unary(self):aten = torch.ops.atenself._test_linear_unary_helper(nn.ReLU, aten.relu.default, aten.relu_.default)self._test_linear_unary_helper(nn.LeakyReLU, aten.leaky_relu.default, aten.leaky_relu_.default)self._test_linear_unary_helper(nn.GELU, aten.gelu.default, None, ["none", "tanh"])
1
9
1
74
0
631
639
631
null
[]
None
null
0
0
0
null
0
null
The function (test_linear_unary) defined within the public class called public.The function start at line 631 and ends at 639. 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_linear_unary_qat
def test_linear_unary_qat(self):aten = torch.ops.atenself._test_linear_unary_helper(nn.ReLU, aten.relu.default, aten.relu_.default, is_qat=True)self._test_linear_unary_helper(nn.LeakyReLU, aten.leaky_relu.default, aten.leaky_relu_.default, is_qat=True)self._test_linear_unary_helper(nn.GELU, aten.gelu.default, None, ["n...
1
11
1
86
0
642
652
642
null
[]
None
null
0
0
0
null
0
null
The function (test_linear_unary_qat) defined within the public class called public.The function start at line 642 and ends at 652. 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_linear_unary_dynamic
def test_linear_unary_dynamic(self):aten = torch.ops.atenself._test_linear_unary_helper(nn.ReLU, aten.relu.default, aten.relu_.default, is_dynamic=True)self._test_linear_unary_helper(nn.LeakyReLU,aten.leaky_relu.default,aten.leaky_relu_.default,is_dynamic=True,)self._test_linear_unary_helper(nn.GELU, aten.gelu.default,...
1
14
1
87
0
655
668
655
null
[]
None
null
0
0
0
null
0
null
The function (test_linear_unary_dynamic) defined within the public class called public.The function start at line 655 and ends at 668. It contains 14 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_linear_unary_dynamic_qat
def test_linear_unary_dynamic_qat(self):aten = torch.ops.atenself._test_linear_unary_helper(nn.ReLU, aten.relu.default, aten.relu_.default, is_qat=True, is_dynamic=True)self._test_linear_unary_helper(nn.LeakyReLU,aten.leaky_relu.default,aten.leaky_relu_.default,is_qat=True,is_dynamic=True,)self._test_linear_unary_helpe...
1
20
1
100
0
671
690
671
null
[]
None
null
0
0
0
null
0
null
The function (test_linear_unary_dynamic_qat) defined within the public class called public.The function start at line 671 and ends at 690. It contains 20 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
_check_annotation_stat._check_annotation
def _check_annotation(node):annot = node.meta.get(QUANT_ANNOTATION_KEY, None)if annot is None:return False, Falsereturn annot._annotated, annot._is_output_of_quantized_pattern
2
5
1
34
0
695
699
695
null
[]
None
null
0
0
0
null
0
null
The function (_check_annotation_stat._check_annotation) defined within the public class called public.The function start at line 695 and ends at 699. It contains 5 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
_check_annotation_stat
def _check_annotation_stat(self, gm, expected_stat_dict):# Check expected annotation statistics to ensure the annotation is correctdef _check_annotation(node):annot = node.meta.get(QUANT_ANNOTATION_KEY, None)if annot is None:return False, Falsereturn annot._annotated, annot._is_output_of_quantized_patternfor node in gm...
5
9
3
85
0
692
707
692
null
[]
None
null
0
0
0
null
0
null
The function (_check_annotation_stat) defined within the public class called public.The function start at line 692 and ends at 707. It contains 9 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [692.0] and does not return any value..
pytorch_ao
public
public
0
0
_test_linear_binary_helper
def _test_linear_binary_helper(self, is_qat=False, is_dynamic=False):"""Test pattern of linear with binary post ops (such as add) with ArmInductorQuantizer.Currently, only add as binary post op is supported."""linear_pos_list = [NodePosType.left, NodePosType.right, NodePosType.both]# TODO test for inplace add after ref...
10
69
3
395
0
709
791
709
null
[]
None
null
0
0
0
null
0
null
The function (_test_linear_binary_helper) defined within the public class called public.The function start at line 709 and ends at 791. It contains 69 lines of code and it has a cyclomatic complexity of 10. It takes 3 parameters, represented as [709.0] and does not return any value..
pytorch_ao
public
public
0
0
test_qat_conv2d
def test_qat_conv2d(self):"""Test QAT pattern of conv2d_bn with ArmInductorQuantizer."""m = TestHelperModules.SingleConv2dModule(with_bn=True)example_inputs = (torch.randn(2, 3, 16, 16),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_inductor_quantization_config(is_qat=True))node_occurrence = {# on...
1
28
1
187
0
795
828
795
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv2d) defined within the public class called public.The function start at line 795 and ends at 828. 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_qat_conv2d_binary
def test_qat_conv2d_binary(self):"""Test qat pattern of conv2d_bn with binary post ops (such as add) with ArmInductorQuantizer.Currently, only add as binary post op is supported."""example_inputs = (torch.randn(2, 3, 6, 6),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_inductor_quantization_config...
3
34
1
224
0
832
874
832
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv2d_binary) defined within the public class called public.The function start at line 832 and ends at 874. It contains 34 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_conv2d_binary2
def test_qat_conv2d_binary2(self):"""Test qat Pattern:tmp = bn1(conv2d_1(x))tmp2 = bn2(conv2d_2(tmp))return tmp + tmp2Since conv2d_1 has 2 users, we should annotate conv2d_2 for binary fusion instead of conv2d_1"""example_inputs = (torch.randn(2, 3, 6, 6),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default...
3
35
1
220
0
878
921
878
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_conv2d_binary2) defined within the public class called public.The function start at line 878 and ends at 921. It contains 35 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_dynamic_quant_linear
def test_dynamic_quant_linear(self):"""Test pattern of dynamic quantization of linear with ArmInductorQuantizer."""with torch.no_grad():m = TestHelperModules.SelfAttnLikeModule(input_dim=64).eval()example_inputs = (torch.randn(1, 4, 64),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_inductor_quant...
1
27
1
182
0
924
954
924
null
[]
None
null
0
0
0
null
0
null
The function (test_dynamic_quant_linear) defined within the public class called public.The function start at line 924 and ends at 954. It contains 27 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_dynamic_quant_linear
def test_qat_dynamic_quant_linear(self):"""Test pattern of qat dynamic quantization of linear with ArmInductorQuantizer."""with torch.no_grad():m = TestHelperModules.SelfAttnLikeModule(input_dim=64).eval()example_inputs = (torch.randn(1, 4, 64),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_induct...
1
30
1
190
0
957
990
957
null
[]
None
null
0
0
0
null
0
null
The function (test_qat_dynamic_quant_linear) defined within the public class called public.The function start at line 957 and ends at 990. 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_set_module_name_qconfig.__init__
def __init__(self) -> None:super().__init__()self.linear1 = torch.nn.Linear(5, 10)self.relu1 = torch.nn.ReLU(inplace=False)self.linear2 = torch.nn.Linear(10, 5)
1
5
1
56
0
999
1,003
999
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig.__init__) defined within the public class called public.The function start at line 999 and ends at 1003. 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_set_module_name_qconfig.forward
def forward(self, x):x = self.linear1(x)x = self.relu1(x)x = self.linear2(x)return x
1
5
2
33
0
1,005
1,009
1,005
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig.forward) defined within the public class called public.The function start at line 1005 and ends at 1009. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1005.0] and does not return any value..
pytorch_ao
public
public
0
0
test_set_module_name_qconfig.__init__
def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(5, 5)self.sub = Sub()
1
4
1
35
0
1,012
1,015
1,012
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig.__init__) defined within the public class called public.The function start at line 1012 and ends at 1015. 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_set_module_name_qconfig.forward
def forward(self, x):x = self.linear(x)x = self.sub(x)return x
1
4
2
25
0
1,017
1,020
1,017
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig.forward) defined within the public class called public.The function start at line 1017 and ends at 1020. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1017.0] and does not return any value..
pytorch_ao
public
public
0
0
test_set_module_name_qconfig
def test_set_module_name_qconfig(self):"""Test case for quantizing a specific submodule by configuring `set_module_name_qconfig`.Expect that all linear layers within the submodule `sub` are quantized."""class Sub(torch.nn.Module):def __init__(self) -> None:super().__init__()self.linear1 = torch.nn.Linear(5, 10)self.rel...
1
35
1
214
0
993
1,054
993
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig) defined within the public class called public.The function start at line 993 and ends at 1054. 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_set_module_name_qconfig_with_underscores.__init__
def __init__(self) -> None:super().__init__()# This module name has underscores, which can be part of a mangled name.self.foo_bar = torch.nn.Linear(2, 2)self.baz = torch.nn.Linear(2, 2)
1
4
1
42
0
1,061
1,065
1,061
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig_with_underscores.__init__) defined within the public class called public.The function start at line 1061 and ends at 1065. 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_set_module_name_qconfig_with_underscores.forward
def forward(self, x):return self.baz(self.foo_bar(x))
1
2
2
19
0
1,067
1,068
1,067
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig_with_underscores.forward) defined within the public class called public.The function start at line 1067 and ends at 1068. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1067.0] and does not return any value..
pytorch_ao
public
public
0
0
test_set_module_name_qconfig_with_underscores
def test_set_module_name_qconfig_with_underscores(self) -> None:"""Test that if a module name has an underscore, we can still quantize it."""class M(torch.nn.Module):def __init__(self) -> None:super().__init__()# This module name has underscores, which can be part of a mangled name.self.foo_bar = torch.nn.Linear(2, 2)s...
5
33
1
186
0
1,057
1,104
1,057
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig_with_underscores) defined within the public class called public.The function start at line 1057 and ends at 1104. It contains 33 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_set_module_name_and_module_type_case1.__init__
def __init__(self) -> None:super().__init__()self.linear1 = torch.nn.Linear(5, 10)self.linear2 = torch.nn.Linear(10, 5)self.sub = torch.nn.Linear(5, 5)
1
5
1
56
0
1,113
1,117
1,113
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_case1.__init__) defined within the public class called public.The function start at line 1113 and ends at 1117. 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_set_module_name_and_module_type_case1.forward
def forward(self, x):x = self.linear1(x)x = self.linear2(x)x = self.sub(x)return x
1
5
2
33
0
1,119
1,123
1,119
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_case1.forward) defined within the public class called public.The function start at line 1119 and ends at 1123. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1119.0] and does not return any value..
pytorch_ao
public
public
0
0
test_set_module_name_and_module_type_case1
def test_set_module_name_and_module_type_case1(self):"""Test that set `module_name_qconfig` and `module_type_qconfig` at the same time.Expect that all linear layers are not quantized except the last one."""class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.linear1 = torch.nn.Linear(5, 10)self.li...
1
30
1
191
0
1,107
1,157
1,107
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_case1) defined within the public class called public.The function start at line 1107 and ends at 1157. 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_set_module_name_and_module_type_case2.__init__
def __init__(self) -> None:super().__init__()self.linear1 = torch.nn.Linear(5, 10)self.linear2 = torch.nn.Linear(10, 5)self.sub = torch.nn.Linear(5, 5)
1
5
1
56
0
1,166
1,170
1,166
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_case2.__init__) defined within the public class called public.The function start at line 1166 and ends at 1170. 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_set_module_name_and_module_type_case2.forward
def forward(self, x):x = self.linear1(x)x = self.linear2(x)x = self.sub(x)return x
1
5
2
33
0
1,172
1,176
1,172
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_case2.forward) defined within the public class called public.The function start at line 1172 and ends at 1176. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1172.0] and does not return any value..
pytorch_ao
public
public
0
0
test_set_module_name_and_module_type_case2
def test_set_module_name_and_module_type_case2(self):"""Test that set `module_name_qconfig` and `module_type_qconfig` at the same time.Expect that all linear layers are quantized except the last one."""class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.linear1 = torch.nn.Linear(5, 10)self.linear...
1
32
1
211
0
1,160
1,212
1,160
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_case2) defined within the public class called public.The function start at line 1160 and ends at 1212. It contains 32 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_set_module_name_qconfig_for_dynamic_quant
def test_set_module_name_qconfig_for_dynamic_quant(self):"""Test that quantize a specific submodule for dynamic quantization."""with torch.no_grad():for is_qat in [False, True]:m = TestHelperModules.SelfAttnLikeModule(input_dim=64).eval()example_inputs = (torch.randn(1, 4, 64),)# only quantize `q_proj` `v_proj`dynamic_...
2
35
1
221
0
1,215
1,258
1,215
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_qconfig_for_dynamic_quant) defined within the public class called public.The function start at line 1215 and ends at 1258. It contains 35 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_set_module_name_with_mixed_configs
def test_set_module_name_with_mixed_configs(self):"""Test case for setting module names with mixed static/dynamic or QAT/non-QAT configurations.The config for 'v_proj' will always be ignored and raise a warning."""with torch.no_grad():with self.assertWarns(UserWarning) as context:for q_is_dynamic, v_is_dynamic, q_is_qa...
10
66
1
305
0
1,261
1,334
1,261
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_with_mixed_configs) defined within the public class called public.The function start at line 1261 and ends at 1334. It contains 66 lines of code and it has a cyclomatic complexity of 10. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
test_set_module_name_and_module_type_with_mixed_configs.__init__
def __init__(self) -> None:super().__init__()self.linear1 = torch.nn.Linear(5, 10)self.linear2 = torch.nn.Linear(10, 5)self.sub = torch.nn.Linear(5, 5)
1
5
1
56
0
1,343
1,347
1,343
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_with_mixed_configs.__init__) defined within the public class called public.The function start at line 1343 and ends at 1347. 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_set_module_name_and_module_type_with_mixed_configs.forward
def forward(self, x):x = self.linear1(x)x = self.linear2(x)x = self.sub(x)return x
1
5
2
33
0
1,349
1,353
1,349
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_with_mixed_configs.forward) defined within the public class called public.The function start at line 1349 and ends at 1353. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1349.0] and does not return any value...
pytorch_ao
public
public
0
0
test_set_module_name_and_module_type_with_mixed_configs
def test_set_module_name_and_module_type_with_mixed_configs(self):"""Test that set `module_name_qconfig` and `module_type_qconfig` at the same time with mixed the configs.Expect that only the last linear(`sub`) is quantized using static quantization."""class M(torch.nn.Module):def __init__(self) -> None:super().__init_...
1
33
1
202
0
1,337
1,389
1,337
null
[]
None
null
0
0
0
null
0
null
The function (test_set_module_name_and_module_type_with_mixed_configs) defined within the public class called public.The function start at line 1337 and ends at 1389. 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_filter_linear_recipe
def test_filter_linear_recipe(self):"""Test removing linear from default recipe of ArmInductorQuantizer."""with torch.no_grad():m = TestHelperModules.LinearUnaryModule(use_bias=True,postop=nn.ReLU,).eval()example_inputs = (torch.randn(2, 4),)quantizer = ArmInductorQuantizer().set_global(armiq.get_default_arm_inductor_q...
1
28
1
166
0
1,392
1,424
1,392
null
[]
None
null
0
0
0
null
0
null
The function (test_filter_linear_recipe) defined within the public class called public.The function start at line 1392 and ends at 1424. 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_attention_block
def test_attention_block(self):"""Test pattern of Attention like Block with ArmInductorQuantizer."""for annotate_matmul in [False, True]:with torch.no_grad():m = TestHelperModules.SelfAttnLikeModule(input_dim=64 * 16,transpose_for_score=True,num_attention_heads=16,attention_head_size=64,).eval()example_inputs = (torch....
6
59
1
374
0
1,427
1,493
1,427
null
[]
None
null
0
0
0
null
0
null
The function (test_attention_block) defined within the public class called public.The function start at line 1427 and ends at 1493. It contains 59 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
__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
41
46
41
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 41 and ends at 46. 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
48
54
48
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 48 and ends at 54. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [48.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self) -> None:super().__init__()self.conv1 = torch.nn.Conv2d(3, 3, 3)self.conv2 = torch.nn.Conv2d(3, 3, 1)self.linear = torch.nn.Linear(3, 3)
1
5
1
60
0
57
61
57
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 57 and ends at 61. 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):x = self.conv1(x)z = x.view(-1, 3)w = self.linear(z)y = self.conv2(x)add_output = x + yextra_output = x * 2return w, add_output, extra_output
1
8
2
58
0
63
72
63
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 63 and ends at 72. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [63.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self) -> None:super().__init__()self.conv1 = torch.nn.Conv2d(3, 3, 3)self.conv2 = torch.nn.Conv2d(3, 3, 1)self.adaptive_avg_pool2d = torch.nn.AdaptiveAvgPool2d((1, 1))
1
5
1
62
0
75
79
75
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 75 and ends at 79. 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):x = self.conv1(x)w = self.adaptive_avg_pool2d(x)y = self.conv2(x)add_output = x + yextra_output = x + 2return w, add_output, extra_output
1
7
2
47
0
81
89
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 89. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [81.0] and does not return any value..
pytorch_ao
public
public
0
0
_test_duplicate_dq
def _test_duplicate_dq(self,model,example_inputs,quantizer,):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)pt2_quant_output = m(*example_inputs)for n in m.grap...
6
19
4
142
0
102
125
102
null
[]
None
null
0
0
0
null
0
null
The function (_test_duplicate_dq) defined within the public class called public.The function start at line 102 and ends at 125. It contains 19 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [102.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_need_for_duplicate_dq.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"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, quantiz...
1
8
2
57
0
135
142
135
null
[]
None
null
0
0
0
null
0
null
The function (test_no_need_for_duplicate_dq.annotate) defined within the public class called public.The function start at line 135 and ends at 142. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [135.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_need_for_duplicate_dq.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
144
145
144
null
[]
None
null
0
0
0
null
0
null
The function (test_no_need_for_duplicate_dq.validate) 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_no_need_for_duplicate_dq
def test_no_need_for_duplicate_dq(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_conf...
1
10
1
50
0
127
152
127
null
[]
None
null
0
0
0
null
0
null
The function (test_no_need_for_duplicate_dq) defined within the public class called public.The function start at line 127 and ends at 152. 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_simple_duplicate_dq.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"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["add"](gm, quantization_config)
1
8
2
57
0
171
178
171
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_duplicate_dq.annotate) defined within the public class called public.The function start at line 171 and ends at 178. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [171.0] and does not return any value..
pytorch_ao
public
public
0
0
test_simple_duplicate_dq.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
180
181
180
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_duplicate_dq.validate) defined within the public class called public.The function start at line 180 and ends at 181. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [180.0] and does not return any value..
pytorch_ao
public
public
0
0
test_simple_duplicate_dq
def test_simple_duplicate_dq(self):"""Model under testconv2d -> conv2d -> add ||---------> |-----> view_copy --> linear |-----> mulThere should be three dq nodes because output for thefirst conv2d is fed to next conv2d, add, and view_copy + linear.All three are quantized.Thus DQ node is not duplicated for those three u...
1
10
1
50
0
154
188
154
null
[]
None
null
0
0
0
null
0
null
The function (test_simple_duplicate_dq) defined within the public class called public.The function start at line 154 and ends at 188. 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_no_add_quant_duplicate_dq.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"quantization_config = get_symmetric_quantization_config(is_per_channel=True)OP_TO_ANNOTATOR["linear"](gm, quantization_config)OP_TO_ANNOTATOR["conv"](gm, quantization_config)
1
7
2
48
0
208
214
208
null
[]
None
null
0
0
0
null
0
null
The function (test_no_add_quant_duplicate_dq.annotate) defined within the public class called public.The function start at line 208 and ends at 214. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [208.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_add_quant_duplicate_dq.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
216
217
216
null
[]
None
null
0
0
0
null
0
null
The function (test_no_add_quant_duplicate_dq.validate) defined within the public class called public.The function start at line 216 and ends at 217. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [216.0] and does not return any value..
pytorch_ao
public
public
0
0
test_no_add_quant_duplicate_dq
def test_no_add_quant_duplicate_dq(self):"""Model under testconv2d -> conv2d -> add ||---------> |-----> view_copy --> linear |-----> mulThere should be three dq nodes because output for thefirst conv2d is fed to next conv2d, and view_copy + linear.Both are quantized.However the skip connection to add and mul are not q...
1
10
1
50
0
190
224
190
null
[]
None
null
0
0
0
null
0
null
The function (test_no_add_quant_duplicate_dq) defined within the public class called public.The function start at line 190 and ends at 224. 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_avgpool_use_different_qconfig._get_uint8_quantization_config
def _get_uint8_quantization_config():act_observer_or_fake_quant_ctr = HistogramObserver# type: ignore[assignment]act_quantization_spec = QuantizationSpec(dtype=torch.uint8,quant_min=0,quant_max=255,qscheme=torch.per_tensor_affine,observer_or_fake_quant_ctr=act_observer_or_fake_quant_ctr.with_args(eps=2**-12),)weight_ob...
1
40
0
150
0
246
287
246
null
[]
None
null
0
0
0
null
0
null
The function (test_avgpool_use_different_qconfig._get_uint8_quantization_config) defined within the public class called public.The function start at line 246 and ends at 287. It contains 40 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_avgpool_use_different_qconfig.annotate
def annotate(self, gm: torch.fx.GraphModule) -> torch.fx.GraphModule:backend_string = "BackendA"quantization_config = get_symmetric_quantization_config(is_per_channel=True)avgpool_qconfig = _get_uint8_quantization_config()OP_TO_ANNOTATOR["conv"](gm, quantization_config)OP_TO_ANNOTATOR["add"](gm, quantization_config)for...
4
18
2
132
0
290
307
290
null
[]
None
null
0
0
0
null
0
null
The function (test_avgpool_use_different_qconfig.annotate) defined within the public class called public.The function start at line 290 and ends at 307. It contains 18 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [290.0] and does not return any value..
pytorch_ao
public
public
0
0
test_avgpool_use_different_qconfig.validate
def validate(self, model: torch.fx.GraphModule) -> None:pass
1
2
2
16
0
309
310
309
null
[]
None
null
0
0
0
null
0
null
The function (test_avgpool_use_different_qconfig.validate) defined within the public class called public.The function start at line 309 and ends at 310. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [309.0] and does not return any value..
pytorch_ao
public
public
0
0
test_avgpool_use_different_qconfig
def test_avgpool_use_different_qconfig(self):"""Model under testconv2d -> conv2d -> add ||---------> |-----> adaptive_avgpool2d (different qconfig) |-----> addoutputconv2d -> dq -> conv2d -> add ||-------> dq -----> |-> dq -> q -> dq -----> adaptive_avgpool2d (different qconfig) |-> dq -----> add"""def _get_uint8_quant...
1
11
1
52
0
226
317
226
null
[]
None
null
0
0
0
null
0
null
The function (test_avgpool_use_different_qconfig) defined within the public class called public.The function start at line 226 and ends at 317. 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_conv_bn_conv_relu.__init__
def __init__(self) -> None:super().__init__()self.conv1 = torch.nn.Conv2d(3, 3, 3)self.bn1 = torch.nn.BatchNorm2d(3)self.conv2 = torch.nn.Conv2d(3, 3, 3)self.relu2 = torch.nn.ReLU()
1
6
1
69
0
26
31
26
null
[]
None
null
0
0
0
null
0
null
The function (test_conv_bn_conv_relu.__init__) defined within the public class called public.The function start at line 26 and ends at 31. 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_conv_bn_conv_relu.forward
def forward(self, x):bn_out = self.bn1(self.conv1(x))relu_out = torch.nn.functional.relu(bn_out)return self.relu2(self.conv2(relu_out))
1
4
2
44
0
33
36
33
null
[]
None
null
0
0
0
null
0
null
The function (test_conv_bn_conv_relu.forward) defined within the public class called public.The function start at line 33 and ends at 36. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [33.0] and does not return any value..
pytorch_ao
public
public
0
0
test_conv_bn_conv_relu.x
def x():find_sequential_partitions(m,[torch.nn.Conv2d,torch.nn.BatchNorm2d,torch.nn.ReLU,torch.nn.functional.conv2d,],)
1
10
0
38
0
56
65
56
null
[]
None
null
0
0
0
null
0
null
The function (test_conv_bn_conv_relu.x) defined within the public class called public.The function start at line 56 and ends at 65. 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_conv_bn_conv_relu
def test_conv_bn_conv_relu(self):class M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.conv1 = torch.nn.Conv2d(3, 3, 3)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(self.conv1(x))relu_out = torch.nn.function...
1
21
1
146
0
24
67
24
null
[]
None
null
0
0
0
null
0
null
The function (test_conv_bn_conv_relu) defined within the public class called public.The function start at line 24 and ends at 67. 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..