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 | _replace_literals_with_existing_placeholders | def _replace_literals_with_existing_placeholders(gm: torch.fx.GraphModule,exclude_literals: Optional[list[Any]] = None,literal_to_ph_idx: Optional[dict[Union[float, int, bool, torch.dtype], int]] = None,):"""Replace the literals in the graph with **existing** placeholder nodes, so that the literal argumentsin the graph... | 12 | 30 | 4 | 185 | 7 | 988 | 1,072 | 988 | null | ['arg', 'exclude_literals', 'phs', 'ph_idx', 'ph_node', 'new_args', 'literal_to_ph_idx'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_replace_literals_with_existing_placeholders) defined within the public class called public.The function start at line 988 and ends at 1072. It contains 30 lines of code and it has a cyclomatic complexity of 12. It takes 4 parameters, represented as [988.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _disallow_eval_train._train | def _train(self, mode: bool = True):raise NotImplementedError(error_message) | 1 | 2 | 2 | 16 | 0 | 1,093 | 1,094 | 1,093 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_disallow_eval_train._train) defined within the public class called public.The function start at line 1093 and ends at 1094. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1093.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _disallow_eval_train._eval | def _eval(self, mode: bool = True):raise NotImplementedError(error_message) | 1 | 2 | 2 | 16 | 0 | 1,096 | 1,097 | 1,096 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_disallow_eval_train._eval) defined within the public class called public.The function start at line 1096 and ends at 1097. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1096.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _disallow_eval_train | def _disallow_eval_train(model: GraphModule):"""Disallow calling `model.train()` or `model.eval()` on the given GraphModule.This is useful for exported models, where these methods don't actually behave as expected."""error_message = """Calling train() or eval() is not supported for exported models.Please call `torchao.... | 1 | 16 | 1 | 41 | 1 | 1,077 | 1,101 | 1,077 | null | ['error_message'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_disallow_eval_train) defined within the public class called public.The function start at line 1077 and ends at 1101. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_sym_size_node | def _is_sym_size_node(node: Node):return (node.op == "call_function"and node.target == torch.ops.aten.sym_size.defaultor node.target == torch.ops.aten.sym_numel.defaultor node.target == torch.ops.aten.sym_numelor node.target == torch.ops.aten.sym_size) | 5 | 8 | 1 | 67 | 0 | 1,104 | 1,111 | 1,104 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_sym_size_node) defined within the public class called public.The function start at line 1104 and ends at 1111. It contains 8 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 | _filter_sym_size_users | def _filter_sym_size_users(node: torch.fx.Node) -> list[torch.fx.Node]:node_users = list(filter((lambda x: (_is_sym_size_node(x) is False)), node.users))return node_users | 1 | 3 | 1 | 47 | 1 | 1,114 | 1,116 | 1,114 | null | ['node_users'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_filter_sym_size_users) defined within the public class called public.The function start at line 1114 and ends at 1116. 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 | _get_pattern_output_dtype | def _get_pattern_output_dtype(match: Match):"""Get the pattern's output dtype from node's metaAssume only 1 output node in this matched pattern."""pattern_output_nodes = match.output_nodes()assert len(pattern_output_nodes) == 1output_node = pattern_output_nodes[0]assert isinstance(output_node, torch.fx.Node)output_dtyp... | 1 | 8 | 1 | 71 | 3 | 55 | 66 | 55 | null | ['output_dtype', 'output_node', 'pattern_output_nodes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_pattern_output_dtype) defined within the public class called public.The function start at line 55 and ends at 66. 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 | _may_generate_pattern_with_dtype_convert | def _may_generate_pattern_with_dtype_convert(pattern, dtype=Arg(), with_dtype_convert=True, users=1):if with_dtype_convert:return CallFunction(prims.convert_element_type.default,pattern,dtype,_users=users,)else:return pattern | 2 | 12 | 2 | 44 | 0 | 69 | 80 | 69 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_may_generate_pattern_with_dtype_convert) defined within the public class called public.The function start at line 69 and ends at 80. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [69.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _may_generate_pattern_with_reshape | def _may_generate_pattern_with_reshape(pattern, reshape_size=Arg(), with_reshape=True):if with_reshape:return CallFunction(torch.ops.aten.reshape.default,pattern,reshape_size,)else:return pattern | 2 | 9 | 2 | 40 | 0 | 83 | 91 | 83 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_may_generate_pattern_with_reshape) defined within the public class called public.The function start at line 83 and ends at 91. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [83.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_linear_t_pattern | def _generate_linear_t_pattern(_dequant_per_channel_pattern,dtype,):assert dtype in [torch.float32, torch.bfloat16]t_pattern = CallFunction(aten.permute.default,_may_generate_pattern_with_dtype_convert(_dequant_per_channel_pattern,KeywordArg("autocast_wgt_dtype"),dtype == torch.bfloat16,),KeywordArg("permute_axes"),)re... | 1 | 15 | 2 | 55 | 1 | 94 | 108 | 94 | null | ['t_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_linear_t_pattern) defined within the public class called public.The function start at line 94 and ends at 108. It contains 15 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.. |
pytorch_ao | public | public | 0 | 0 | _unary_fusion_pattern | def _unary_fusion_pattern(unary_fusion, call_fn, users, is_bf16):# only insert to_dtype if is_bf16 is Truecomputation_call = _may_generate_pattern_with_dtype_convert(call_fn, dtype=KeywordArg("to_float"), with_dtype_convert=is_bf16, users=users)return unary_fusion(computation_call) | 1 | 5 | 4 | 37 | 1 | 111 | 116 | 111 | null | ['computation_call'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_unary_fusion_pattern) defined within the public class called public.The function start at line 111 and ends at 116. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [111.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_dequantize_per_tensor_activation_pattern | def get_dequantize_per_tensor_activation_pattern(is_tensor_overload=False):dequantize_per_tensor_activation_pattern = CallFunction(quantized_decomposed.dequantize_per_tensor.tensorif is_tensor_overloadelse quantized_decomposed.dequantize_per_tensor.default,KeywordArg("x"),KeywordArg("x_scale"),KeywordArg("x_zp"),Keywor... | 2 | 13 | 1 | 58 | 1 | 119 | 131 | 119 | null | ['dequantize_per_tensor_activation_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_dequantize_per_tensor_activation_pattern) defined within the public class called public.The function start at line 119 and ends at 131. It contains 13 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_qconv_pt2e_pattern | def get_qconv_pt2e_pattern(users=1):return CallFunction(torch.ops.onednn.qconv_pointwise.default,KeywordArg("x"),KeywordArg("x_scale"),KeywordArg("x_zp"),KeywordArg("packed_weight"),KeywordArg("w_scale"),KeywordArg("w_zp"),KeywordArg("b"),KeywordArg("stride"),KeywordArg("padding"),KeywordArg("dilation"),KeywordArg("gro... | 1 | 22 | 1 | 110 | 0 | 165 | 186 | 165 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_qconv_pt2e_pattern) defined within the public class called public.The function start at line 165 and ends at 186. It contains 22 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_qconv2d_binary_pt2e_pattern | def get_qconv2d_binary_pt2e_pattern(users=1):return CallFunction(torch.ops.onednn.qconv2d_pointwise.binary,KeywordArg("x"),KeywordArg("x_scale"),KeywordArg("x_zp"),KeywordArg("packed_weight"),KeywordArg("w_scale"),KeywordArg("w_zp"),KeywordArg("accum"),KeywordArg("b"),KeywordArg("stride"),KeywordArg("padding"),KeywordA... | 1 | 27 | 1 | 135 | 0 | 189 | 215 | 189 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_qconv2d_binary_pt2e_pattern) defined within the public class called public.The function start at line 189 and ends at 215. 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 | get_qlinear_pt2e_pattern | def get_qlinear_pt2e_pattern(x_scale_zp_are_tensors, users=1):qlinear_op = (torch.ops.onednn.qlinear_pointwise.tensorif x_scale_zp_are_tensorselse torch.ops.onednn.qlinear_pointwise.default)return CallFunction(qlinear_op,KeywordArg("x"),KeywordArg("x_scale"),KeywordArg("x_zp"),KeywordArg("packed_weight"),KeywordArg("w_... | 2 | 23 | 2 | 109 | 1 | 218 | 240 | 218 | null | ['qlinear_op'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_qlinear_pt2e_pattern) defined within the public class called public.The function start at line 218 and ends at 240. It contains 23 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [218.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_qlinear_binary_pt2e_pattern | def get_qlinear_binary_pt2e_pattern(x_scale_zp_are_tensors, users=1):qlinear_op = (torch.ops.onednn.qlinear_pointwise.binary_tensorif x_scale_zp_are_tensorselse torch.ops.onednn.qlinear_pointwise.binary)return CallFunction(qlinear_op,KeywordArg("x"),KeywordArg("x_scale"),KeywordArg("x_zp"),KeywordArg("packed_weight"),K... | 2 | 28 | 2 | 134 | 1 | 243 | 270 | 243 | null | ['qlinear_op'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_qlinear_binary_pt2e_pattern) defined within the public class called public.The function start at line 243 and ends at 270. It contains 28 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [243.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | generate_pattern_with_binary | def generate_pattern_with_binary(binary_post_op,computation_call,extra_input_pattern,dtype_convert=False,swap_inputs=False,):binary_pattern = (CallFunction(binary_post_op,extra_input_pattern,computation_call,)if swap_inputselse CallFunction(binary_post_op,computation_call,extra_input_pattern,))return _may_generate_patt... | 2 | 25 | 5 | 56 | 1 | 284 | 308 | 284 | null | ['binary_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (generate_pattern_with_binary) defined within the public class called public.The function start at line 284 and ends at 308. It contains 25 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [284.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | generate_pattern_with_unary | def generate_pattern_with_unary(computation_call, unary_post_op):if unary_post_op is not None:return CallFunction(unary_post_op,computation_call,)return computation_call | 2 | 7 | 2 | 23 | 0 | 311 | 317 | 311 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (generate_pattern_with_unary) defined within the public class called public.The function start at line 311 and ends at 317. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [311.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | generate_pattern_with_output_quant | def generate_pattern_with_output_quant(computation_call, with_dtype_convert=False):quantized_op_output_pattern_pt2e = CallFunction(quantized_decomposed.quantize_per_tensor.default,_may_generate_pattern_with_dtype_convert(computation_call,Arg(),with_dtype_convert,),KeywordArg("o_inv_scale"),KeywordArg("o_zp"),KeywordArg... | 1 | 15 | 2 | 59 | 1 | 320 | 334 | 320 | null | ['quantized_op_output_pattern_pt2e'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (generate_pattern_with_output_quant) defined within the public class called public.The function start at line 320 and ends at 334. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [320.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _check_node_kwarg_arg_value | def _check_node_kwarg_arg_value(check_node, kwarg_name, args_index, expected_value):if kwarg_name in check_node.kwargs:actual_value = check_node.kwargs[kwarg_name]return actual_value == expected_valueelse:assert len(check_node.args) >= (args_index + 1)actual_value = check_node.args[args_index]return actual_value == exp... | 2 | 8 | 4 | 57 | 1 | 337 | 344 | 337 | null | ['actual_value'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_check_node_kwarg_arg_value) defined within the public class called public.The function start at line 337 and ends at 344. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [337.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_quantized_conv_optimization_pattern.fn | def fn(match):output_dtype = _get_pattern_output_dtype(match)if output_dtype in [torch.float32, torch.bfloat16]:# Only keep matched pattern with same output_dtypeqconv_node_after_weight_prepack = filter_nodes(match.nodes, torch.ops.onednn.qconv_pointwise)[0]return _check_node_kwarg_arg_value(qconv_node_after_weight_pre... | 2 | 10 | 1 | 56 | 0 | 348 | 358 | 348 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_quantized_conv_optimization_pattern.fn) defined within the public class called public.The function start at line 348 and ends at 358. It contains 10 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 | _is_valid_quantized_conv_optimization_pattern | def _is_valid_quantized_conv_optimization_pattern():def fn(match):output_dtype = _get_pattern_output_dtype(match)if output_dtype in [torch.float32, torch.bfloat16]:# Only keep matched pattern with same output_dtypeqconv_node_after_weight_prepack = filter_nodes(match.nodes, torch.ops.onednn.qconv_pointwise)[0]return _ch... | 1 | 3 | 0 | 8 | 2 | 347 | 360 | 347 | null | ['output_dtype', 'qconv_node_after_weight_prepack'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_quantized_conv_optimization_pattern) defined within the public class called public.The function start at line 347 and ends at 360. 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 | _is_valid_qconv_post_op_fusion_pattern | def _is_valid_qconv_post_op_fusion_pattern(has_binary_post_op=False):return (_is_valid_qconv_binary_optimization_pattern()if has_binary_post_opelse _is_valid_quantized_conv_optimization_pattern()) | 2 | 6 | 1 | 19 | 0 | 363 | 368 | 363 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_qconv_post_op_fusion_pattern) defined within the public class called public.The function start at line 363 and ends at 368. It contains 6 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 | _is_valid_quantized_linear_optimization_pattern.fn | def fn(match):output_dtype = _get_pattern_output_dtype(match)if output_dtype in [torch.float32, torch.bfloat16]:# Only keep matched pattern with same output_dtypeqlinear_node_after_weight_prepack = filter_nodes(match.nodes, torch.ops.onednn.qlinear_pointwise)[0]return _check_node_kwarg_arg_value(qlinear_node_after_weig... | 2 | 10 | 1 | 56 | 0 | 372 | 382 | 372 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_quantized_linear_optimization_pattern.fn) defined within the public class called public.The function start at line 372 and ends at 382. It contains 10 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 | _is_valid_quantized_linear_optimization_pattern | def _is_valid_quantized_linear_optimization_pattern():def fn(match):output_dtype = _get_pattern_output_dtype(match)if output_dtype in [torch.float32, torch.bfloat16]:# Only keep matched pattern with same output_dtypeqlinear_node_after_weight_prepack = filter_nodes(match.nodes, torch.ops.onednn.qlinear_pointwise)[0]retu... | 1 | 3 | 0 | 8 | 2 | 371 | 384 | 371 | null | ['output_dtype', 'qlinear_node_after_weight_prepack'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_quantized_linear_optimization_pattern) defined within the public class called public.The function start at line 371 and ends at 384. 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 | _is_valid_qlinear_post_op_fusion_pattern | def _is_valid_qlinear_post_op_fusion_pattern(has_binary_post_op=False):return (_is_valid_qlinear_binary_optimization_pattern()if has_binary_post_opelse _is_valid_quantized_linear_optimization_pattern()) | 2 | 6 | 1 | 19 | 0 | 387 | 392 | 387 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_qlinear_post_op_fusion_pattern) defined within the public class called public.The function start at line 387 and ends at 392. It contains 6 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 | _is_valid_qconv_binary_optimization_pattern | def _is_valid_qconv_binary_optimization_pattern():return _is_valid_quantized_op_binary_optimization_pattern(torch.ops.onednn.qconv_pointwise) | 1 | 4 | 0 | 15 | 0 | 395 | 398 | 395 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_qconv_binary_optimization_pattern) defined within the public class called public.The function start at line 395 and ends at 398. 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 | _is_valid_qlinear_binary_optimization_pattern | def _is_valid_qlinear_binary_optimization_pattern():return _is_valid_quantized_op_binary_optimization_pattern(torch.ops.onednn.qlinear_pointwise,# we don't insert q-dq for extra input due to accuracy issuesextra_input_from_dequant=False,) | 1 | 5 | 0 | 20 | 0 | 401 | 406 | 401 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_qlinear_binary_optimization_pattern) defined within the public class called public.The function start at line 401 and ends at 406. 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 | _is_valid_quantized_op_binary_optimization_pattern.fn | def fn(match):output_dtype = _get_pattern_output_dtype(match)compute_node = filter_nodes(match.nodes, qop)[0]# qop_pointwise should only have one userif len(compute_node.users) != 1:return Falsebinary_node_inputs = next(iter(compute_node.users)).argsassert len(binary_node_inputs) == 2, "Expects binary node with 2 input... | 18 | 52 | 1 | 319 | 0 | 420 | 482 | 420 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_quantized_op_binary_optimization_pattern.fn) defined within the public class called public.The function start at line 420 and ends at 482. It contains 52 lines of code and it has a cyclomatic complexity of 18. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_quantized_op_binary_optimization_pattern | def _is_valid_quantized_op_binary_optimization_pattern(qop, extra_input_from_dequant=True):# Check if it's a valid Binary Pattern for qconv2d and qlinear:# * qop_pointwise should only has one users# * If extra_input_from_dequant is True, extra input of binary node should come from dequant pattern# * the two inputs of b... | 1 | 5 | 2 | 13 | 5 | 409 | 484 | 409 | null | ['binary_node_inputs', 'compute_node', 'extra_input_of_pattern', 'output_dtype', 'extra_input_of_binary_node'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_quantized_op_binary_optimization_pattern) defined within the public class called public.The function start at line 409 and ends at 484. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [409.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_dequant_promotion_pattern._inner | def _inner(match):assert dtype in [torch.float32, torch.bfloat16]dequant_pattern_end_node = match.output_node()if dequant_pattern_end_node.target not in [quantized_decomposed.dequantize_per_tensor.default,quantized_decomposed.dequantize_per_tensor.tensor,prims.convert_element_type.default,aten.reshape.default,]:return ... | 7 | 38 | 1 | 156 | 0 | 488 | 528 | 488 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_dequant_promotion_pattern._inner) defined within the public class called public.The function start at line 488 and ends at 528. It contains 38 lines of code and it has a cyclomatic complexity of 7. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_dequant_promotion_pattern | def _is_valid_dequant_promotion_pattern(dtype=torch.float32):def _inner(match):assert dtype in [torch.float32, torch.bfloat16]dequant_pattern_end_node = match.output_node()if dequant_pattern_end_node.target not in [quantized_decomposed.dequantize_per_tensor.default,quantized_decomposed.dequantize_per_tensor.tensor,prim... | 1 | 3 | 1 | 13 | 2 | 487 | 530 | 487 | null | ['dequant_node', 'dequant_pattern_end_node'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_dequant_promotion_pattern) defined within the public class called public.The function start at line 487 and ends at 530. 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 | _register_dequant_promotion_pass._register_dequant_promotion_pass.dequant_promotion.clone_to_new_node | def clone_to_new_node(graph, source_node, user_node):# Clone the source_node to a new node# Replace user_node's input from source_node to new_nodeassert source_node.op == "call_function", ("clone_to_new_node only support node.op call_function")with graph.inserting_before(user_node):new_node = graph.call_function(source... | 1 | 13 | 3 | 72 | 0 | 566 | 580 | 566 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_dequant_promotion_pass._register_dequant_promotion_pass.dequant_promotion.clone_to_new_node) defined within the public class called public.The function start at line 566 and ends at 580. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [... |
pytorch_ao | public | public | 0 | 0 | _register_dequant_promotion_pass._register_dequant_promotion_pass.dequant_promotion._find_first_node_in_dequant_pattern | def _find_first_node_in_dequant_pattern(_node):if _node.target in [quantized_decomposed.dequantize_per_tensor.default,quantized_decomposed.dequantize_per_tensor.tensor,]:# For a dequant pattern, we expect the start node is a dequantize_per_tensor nodereturn _nodeelse:assert len(_node.args) >= 1, ("In in dequant pattern... | 2 | 11 | 1 | 52 | 0 | 597 | 608 | 597 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_dequant_promotion_pass._register_dequant_promotion_pass.dequant_promotion._find_first_node_in_dequant_pattern) defined within the public class called public.The function start at line 597 and ends at 608. It contains 11 lines of code and it has a cyclomatic complexity of 2. The function does not... |
pytorch_ao | public | public | 0 | 0 | _register_dequant_promotion_pass.dequant_promotion | def dequant_promotion(match: Match, *args, **kwargs):# Dequant_promotion will transform# graph 1:#quant#+ - - - | - - - +#|dequant|#|/ \|#|node1node2 |#+ - | - - - | - +#quant quant# into:# graph 2:#quant#+ - - / - \ - - +#|dequant dequant|#||| |#| node1 node2 |#+ - | - - - | - +#quant quant# In graph 1, the dequant no... | 3 | 28 | 3 | 171 | 0 | 539 | 630 | 539 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_dequant_promotion_pass.dequant_promotion) defined within the public class called public.The function start at line 539 and ends at 630. It contains 28 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [539.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_dequant_promotion_pass | def _register_dequant_promotion_pass(pattern, pass_number, dtype=torch.float32):@register_freezing_graph_pattern(pattern,extra_check=_is_valid_dequant_promotion_pattern(dtype),pass_number=pass_number,)def dequant_promotion(match: Match, *args, **kwargs):# Dequant_promotion will transform# graph 1:#quant#+ - - - | - - -... | 1 | 7 | 3 | 32 | 7 | 533 | 630 | 533 | null | ['graph', 'new_node', 'dequant_pattern_end_node', '_user_node', 'user_node_list', '_source_node', 'dequant_pattern_start_node'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_dequant_promotion_pass) defined within the public class called public.The function start at line 533 and ends at 630. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [533.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_dequant_conv_pattern._inner | def _inner(match):# Here we do some further check to ensure:# 1. It's a conv2d node with dim of 4, since we only support lowering of conv2d now.# 2. The dequant pattern has only 1 user of conv2d node.# If these conditions don't meet, we will not# insert weight prepack node into the matched pattern.conv_node = match.out... | 8 | 21 | 1 | 163 | 0 | 634 | 665 | 634 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_dequant_conv_pattern._inner) defined within the public class called public.The function start at line 634 and ends at 665. It contains 21 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_dequant_conv_pattern | def _is_valid_dequant_conv_pattern(dtype):def _inner(match):# Here we do some further check to ensure:# 1. It's a conv2d node with dim of 4, since we only support lowering of conv2d now.# 2. The dequant pattern has only 1 user of conv2d node.# If these conditions don't meet, we will not# insert weight prepack node into... | 1 | 3 | 1 | 9 | 5 | 633 | 667 | 633 | null | ['convert_to_bf16', 'dequant_node', 'weight_meta_value', 'conv_node', 'input_meta_value'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_dequant_conv_pattern) defined within the public class called public.The function start at line 633 and ends at 667. 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 | _register_qconv_weight_prepack_pass.qconv_weight_prepack | def qconv_weight_prepack(match: Match, *args, **kwargs):"""Match the pattern:int8 activation|dequant_per_tensor|Conv2d <- optional(aten.clone.default) <- dequant_per_channel <- int8_weightInsert weight prepack node and change the pattern to:int8 activation|onednn.qconv_pointwise <- onednn.qconv_prepack <- int8_weight""... | 10 | 106 | 3 | 498 | 0 | 676 | 810 | 676 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qconv_weight_prepack_pass.qconv_weight_prepack) defined within the public class called public.The function start at line 676 and ends at 810. It contains 106 lines of code and it has a cyclomatic complexity of 10. It takes 3 parameters, represented as [676.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qconv_weight_prepack_pass | def _register_qconv_weight_prepack_pass(pattern, pass_number, dtype=torch.float32):@register_freezing_graph_pattern(pattern,extra_check=_is_valid_dequant_conv_pattern(dtype),pass_number=pass_number,)def qconv_weight_prepack(match: Match, *args, **kwargs):"""Match the pattern:int8 activation|dequant_per_tensor|Conv2d <-... | 1 | 7 | 3 | 32 | 13 | 670 | 810 | 670 | null | ['convert_to_bf16', 'weight_to_bf16_node', 'packed_weight_op', 'clone_node', 'dequant_node', 'has_clone_to_channel_last_node_in_pattern', 'graph', 'prepack_weight_node', 'new_conv_node', 'x_shape', 'conv_node', 'packed_weight_inputs', 'dequant_per_channel'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qconv_weight_prepack_pass) defined within the public class called public.The function start at line 670 and ends at 810. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [670.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_dequant_convolution_node_pattern | def _generate_dequant_convolution_node_pattern(_dequant_per_channel_pattern, dtype=torch.float32):assert dtype in [torch.float32, torch.bfloat16]dequant_convolution_node_pattern = CallFunction(aten.convolution.default,_may_generate_pattern_with_dtype_convert(get_dequantize_per_tensor_activation_pattern(),KeywordArg("au... | 1 | 21 | 2 | 92 | 1 | 813 | 833 | 813 | null | ['dequant_convolution_node_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_dequant_convolution_node_pattern) defined within the public class called public.The function start at line 813 and ends at 833. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [813.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_qconv_weight_prepack_patterns | def _generate_qconv_weight_prepack_patterns(dtype=torch.float32):assert dtype in [torch.float32, torch.bfloat16]return (_generate_dequant_convolution_node_pattern(dequantize_per_channel_weight_patternif dtype == torch.float32else dequantize_per_channel_to_bf16_weight_pattern,dtype,),# There is another pattern due to th... | 3 | 16 | 1 | 56 | 0 | 836 | 855 | 836 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_qconv_weight_prepack_patterns) defined within the public class called public.The function start at line 836 and ends at 855. It contains 16 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 | _get_linear_node | def _get_linear_node(match, input_dim_exceeds_two, input_contiguous):output_reshape_node = Noneif input_dim_exceeds_two:if input_contiguous:output_reshape_node = match.output_node()assert output_reshape_node.target is aten.reshape.defaultlinear_node = output_reshape_node.args[0]else:linear_nodes = filter_nodes(match.no... | 3 | 19 | 3 | 110 | 3 | 858 | 877 | 858 | null | ['linear_node', 'output_reshape_node', 'linear_nodes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_linear_node) defined within the public class called public.The function start at line 858 and ends at 877. It contains 19 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [858.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_linear_dq_node | def _get_linear_dq_node(linear_node, input_index, dtype, input_dim_exceeds_two, input_contiguous):act_reshape_node = Noneactivation_to_bf16_node = Noneact_expand_node = Noneif input_dim_exceeds_two:if input_contiguous:act_reshape_node = linear_node.args[input_index]assert act_reshape_node.target is aten.reshape.default... | 6 | 30 | 5 | 175 | 4 | 880 | 914 | 880 | null | ['act_expand_node', 'activation_to_bf16_node', 'act_reshape_node', 'dequant_node'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_linear_dq_node) defined within the public class called public.The function start at line 880 and ends at 914. It contains 30 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [880.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_dequant_linear_pattern._inner | def _inner(match):# Check dequant pattern has only 1 user.(linear_node,_,) = _get_linear_node(match, input_dim_exceeds_two, input_contiguous)input_index = 1 if linear_node.target is aten.addmm.default else 0assert dtype in [torch.float32, torch.bfloat16](dequant_node,_,_,_,) = _get_linear_dq_node(linear_node, input_ind... | 16 | 46 | 1 | 325 | 0 | 918 | 984 | 918 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_dequant_linear_pattern._inner) defined within the public class called public.The function start at line 918 and ends at 984. It contains 46 lines of code and it has a cyclomatic complexity of 16. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_dequant_linear_pattern | def _is_valid_dequant_linear_pattern(dtype, input_dim_exceeds_two, input_contiguous):def _inner(match):# Check dequant pattern has only 1 user.(linear_node,_,) = _get_linear_node(match, input_dim_exceeds_two, input_contiguous)input_index = 1 if linear_node.target is aten.addmm.default else 0assert dtype in [torch.float... | 1 | 3 | 3 | 13 | 6 | 917 | 986 | 917 | null | ['act_node', 'qweight_node', 'wgt_permute_dims', 'act_expand_size', 'wgt_expand_size', 'input_index'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_dequant_linear_pattern) defined within the public class called public.The function start at line 917 and ends at 986. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [917.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qlinear_weight_prepack_pass.qlinear_weight_prepack | def qlinear_weight_prepack(match: Match, *args, **kwargs):"""Match the pattern:int8 activation|dequant_per_tensor|mm/addmm <- t <- dequant_per_channel <- int8_weightInsert weight prepack node and change the pattern to:int8 activation|onednn.qlinear_pointwise <- onednn.qlinear_prepack <- int8_weight"""assert dtype in [t... | 20 | 118 | 3 | 617 | 0 | 1,003 | 1,151 | 1,003 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qlinear_weight_prepack_pass.qlinear_weight_prepack) defined within the public class called public.The function start at line 1003 and ends at 1151. It contains 118 lines of code and it has a cyclomatic complexity of 20. It takes 3 parameters, represented as [1003.0] and does not return any value... |
pytorch_ao | public | public | 0 | 0 | _register_qlinear_weight_prepack_pass | def _register_qlinear_weight_prepack_pass(pattern,pass_number,dtype=torch.float32,input_dim_exceeds_two=False,input_contiguous=True,):@register_freezing_graph_pattern(pattern,extra_check=_is_valid_dequant_linear_pattern(dtype, input_dim_exceeds_two, input_contiguous),pass_number=pass_number,)def qlinear_weight_prepack(... | 1 | 15 | 5 | 45 | 15 | 989 | 1,151 | 989 | null | ['weight_to_bf16_node', 'packed_weight_op', 'graph', 'output_add_node_for_bias', 't_node', 'prepack_weight_node', 'weight_index', 'x_shape', 'Node', 'bias', 'wgt_expand_node', 'new_linear_node', 'packed_weight_inputs', 'dequant_per_channel', 'input_index'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qlinear_weight_prepack_pass) defined within the public class called public.The function start at line 989 and ends at 1151. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [989.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_dequant_linear_node_pattern | def _generate_dequant_linear_node_pattern(_dequant_per_channel_pattern,dtype=torch.float32,input_dim_exceeds_two=False,is_tensor_overload=False,):assert dtype in [torch.float32, torch.bfloat16]t_pattern = _generate_linear_t_pattern(_dequant_per_channel_pattern, dtype)dequant_linear_bias_pattern = _may_generate_pattern_... | 1 | 44 | 4 | 159 | 3 | 1,154 | 1,197 | 1,154 | null | ['dequant_linear_bias_pattern', 't_pattern', 'dequant_linear_no_bias_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_dequant_linear_node_pattern) defined within the public class called public.The function start at line 1154 and ends at 1197. It contains 44 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1154.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_dequant_bmm_node_pattern._generate_pattern_with_output_add | def _generate_pattern_with_output_add(_dequant_bmm_pattern, _with_bias):if _with_bias:return CallFunction(aten.add.Tensor,_dequant_bmm_pattern,KeywordArg("b"),)else:return _dequant_bmm_pattern | 2 | 9 | 2 | 31 | 0 | 1,228 | 1,236 | 1,228 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_dequant_bmm_node_pattern._generate_pattern_with_output_add) defined within the public class called public.The function start at line 1228 and ends at 1236. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1228.0] and does not return any ... |
pytorch_ao | public | public | 0 | 0 | _generate_dequant_bmm_node_pattern | def _generate_dequant_bmm_node_pattern(_dequant_per_channel_pattern,dtype=torch.float32,with_bias=False,is_tensor_overload=False,):# When activation of linear dim exceed 2 and not contiguoust_pattern = _generate_linear_t_pattern(_dequant_per_channel_pattern, dtype)assert dtype in [torch.float32, torch.bfloat16]dequant_... | 1 | 27 | 4 | 112 | 2 | 1,200 | 1,238 | 1,200 | null | ['t_pattern', 'dequant_bmm_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_dequant_bmm_node_pattern) defined within the public class called public.The function start at line 1200 and ends at 1238. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1200.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_qlinear_weight_prepack_patterns | def _generate_qlinear_weight_prepack_patterns(dtype=torch.float32,input_dim_exceeds_two=False,input_contiguous=True,with_bias=False,is_tensor_overload=False,):if input_dim_exceeds_two and not input_contiguous:return _generate_dequant_bmm_node_pattern(dequantize_per_channel_weight_pattern,dtype,with_bias,is_tensor_overl... | 3 | 21 | 5 | 58 | 0 | 1,241 | 1,261 | 1,241 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_qlinear_weight_prepack_patterns) defined within the public class called public.The function start at line 1241 and ends at 1261. It contains 21 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [1241.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_linear_dynamic_fp16_pattern | def _generate_linear_dynamic_fp16_pattern(_dequant_weight_pattern,input_dim_exceeds_two=False,input_contiguous=True,relu_fused=False,):dtype = torch.float32t_pattern = _generate_linear_t_pattern(_dequant_weight_pattern, dtype)if input_dim_exceeds_two and not input_contiguous:# pattern is# x -> expand -> bmm (-> add) (-... | 6 | 62 | 4 | 240 | 7 | 1,264 | 1,330 | 1,264 | null | ['dequant_linear_bias_pattern', 'pattern_with_bias', 't_pattern', 'dtype', 'x_pattern_with_reshape', 'pattern_no_bias', 'dequant_linear_no_bias_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_linear_dynamic_fp16_pattern) defined within the public class called public.The function start at line 1264 and ends at 1330. It contains 62 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [1264.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_dequant_promotion | def _register_dequant_promotion():dequant_pattern_cases = itertools.product([torch.float32, torch.bfloat16], [True, False], [True, False])for dtype, input_dim_exceeds_two, is_tensor_overload in dequant_pattern_cases:# 4 dequantization patterns will be matched based on the dtype and input dimension size.# Case 1: int8-m... | 2 | 20 | 0 | 87 | 1 | 1,333 | 1,372 | 1,333 | null | ['dequant_pattern_cases'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_dequant_promotion) defined within the public class called public.The function start at line 1333 and ends at 1372. It contains 20 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 | _register_qconv_weight_prepack | def _register_qconv_weight_prepack():for dtype in [torch.float32, torch.bfloat16]:weight_prepack_patterns = _generate_qconv_weight_prepack_patterns(dtype)for weight_prepack_pattern in weight_prepack_patterns:# Register to pass_number 1, so we can do dequant promotion in pass_number 0._register_qconv_weight_prepack_pass... | 3 | 7 | 0 | 40 | 1 | 1,375 | 1,382 | 1,375 | null | ['weight_prepack_patterns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qconv_weight_prepack) defined within the public class called public.The function start at line 1375 and ends at 1382. It contains 7 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 | _register_qlinear_weight_prepack | def _register_qlinear_weight_prepack():# 6 Linear related patterns will be matched based on the dtype, input dimension size and input contiguous.# Then convert the pattern into a QLinear node with int8_fp32/bf16.# Case 1: int8-mixed-fp32, input dim size is 2# Case 2: int8-mixed-fp32, input dim size exceeds 2 and contig... | 5 | 36 | 0 | 160 | 3 | 1,385 | 1,464 | 1,385 | null | ['weight_prepack_patterns', 'linear_weight_prepack_cases', 'bmm_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qlinear_weight_prepack) defined within the public class called public.The function start at line 1385 and ends at 1464. It contains 36 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 | _register_linear_dynamic_fp16_weight_prepack_pass._extra_check_fn | def _extra_check_fn(match: Match):return match.kwargs["dtype_fp16"] == torch.float16 | 1 | 2 | 1 | 18 | 0 | 1,474 | 1,475 | 1,474 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_linear_dynamic_fp16_weight_prepack_pass._extra_check_fn) defined within the public class called public.The function start at line 1474 and ends at 1475. 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 | _register_linear_dynamic_fp16_weight_prepack_pass.linear_dynamic_fp16_weight_prepack | def linear_dynamic_fp16_weight_prepack(match: Match, *args, **kwargs):"""Match the pattern:fp32 activation|mm/addmm <- t <- to_fp32 <- to_fp16 <- weight|(reshape) <- (relu)ORfp32 activation|expand| bmm <- expand <- t <- to_fp32 <- to_fp16 <- weight|(add) <- (relu)Insert weight prepack node and change the pattern to:fp3... | 18 | 104 | 3 | 673 | 0 | 1,482 | 1,625 | 1,482 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_linear_dynamic_fp16_weight_prepack_pass.linear_dynamic_fp16_weight_prepack) defined within the public class called public.The function start at line 1482 and ends at 1625. It contains 104 lines of code and it has a cyclomatic complexity of 18. It takes 3 parameters, represented as [1482.0] and d... |
pytorch_ao | public | public | 0 | 0 | _register_linear_dynamic_fp16_weight_prepack_pass | def _register_linear_dynamic_fp16_weight_prepack_pass(pattern,pass_number,input_dim_exceeds_two=False,input_contiguous=True,relu_fused=False,):def _extra_check_fn(match: Match):return match.kwargs["dtype_fp16"] == torch.float16@register_freezing_graph_pattern(pattern,extra_check=_extra_check_fn,pass_number=pass_number,... | 1 | 14 | 5 | 38 | 25 | 1,467 | 1,625 | 1,467 | null | ['expand_x_node', 'w_to_fp32_node', 'bias', 'linear_op', 'w_to_fp16_node', 'weight_index', 'linear_nodes', 'w', 'packed_weight_inputs', 'act_reshape_node', 'linear_node', 'output_reshape_node', 'packed_weight_op', 'graph', 't_node', 'prepack_weight_node', 'x_shape', 'out_node', 'x', 'new_linear_node', 'relu_node', 'exp... | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_linear_dynamic_fp16_weight_prepack_pass) defined within the public class called public.The function start at line 1467 and ends at 1625. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [1467.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_linear_dynamic_fp16_weight_prepack | def _register_linear_dynamic_fp16_weight_prepack():to_dtype_op = torch.ops.quantized_decomposed.convert_element_type.no_fuseweight_pattern = CallFunction(to_dtype_op,CallFunction(to_dtype_op,KeywordArg("w"),KeywordArg("dtype_fp16"),),KeywordArg("dtype_fp32"),)cases = itertools.product([False, True],# input_dim_exceeds_... | 4 | 31 | 0 | 120 | 4 | 1,628 | 1,658 | 1,628 | null | ['to_dtype_op', 'cases', 'patterns', 'weight_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_linear_dynamic_fp16_weight_prepack) defined within the public class called public.The function start at line 1628 and ends at 1658. It contains 31 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_smooth_quant_int_mm_pattern.get_pattern_no_bias | def get_pattern_no_bias(expand_a_scale: bool, reshape_a: bool = True):return CallFunction(aten.mul.Tensor,CallFunction(aten.mul.Tensor,CallFunction(prims.convert_element_type.default,CallFunction(aten._int_mm.default,CallFunction(aten.reshape.default,KeywordArg("a"),KeywordArg("in_shape"),)if reshape_aelse KeywordArg("... | 3 | 32 | 2 | 123 | 0 | 1,671 | 1,702 | 1,671 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_smooth_quant_int_mm_pattern.get_pattern_no_bias) defined within the public class called public.The function start at line 1671 and ends at 1702. It contains 32 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1671.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_smooth_quant_int_mm_pattern._with_outer_reshape | def _with_outer_reshape(pattern):return CallFunction(aten.reshape.default, pattern, KeywordArg("out_shape_no_bias")) | 1 | 4 | 1 | 21 | 0 | 1,704 | 1,707 | 1,704 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_smooth_quant_int_mm_pattern._with_outer_reshape) defined within the public class called public.The function start at line 1704 and ends at 1707. 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 | _register_smooth_quant_int_mm_pattern._validate_pattern | def _validate_pattern(match: Match):if len(match.nodes) not in [4, 5, 6, 7, 10]:return False# Make sure weight is a constantaten_int_mm_node = filter_nodes(match.nodes, aten._int_mm.default)[0]if not isinstance(aten_int_mm_node.args[1], torch.fx.node.Node):return Falseif aten_int_mm_node.args[1].op != "get_attr":return... | 12 | 21 | 1 | 221 | 0 | 1,744 | 1,768 | 1,744 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_smooth_quant_int_mm_pattern._validate_pattern) defined within the public class called public.The function start at line 1744 and ends at 1768. It contains 21 lines of code and it has a cyclomatic complexity of 12. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_smooth_quant_int_mm_pattern._int_mm_weight_prepack | def _int_mm_weight_prepack(match: Match, *args, **kwargs):bias = kwargs.get("bias", None)x = kwargs["a"]weight = kwargs["b"]dtype = kwargs["dtype"]x_scale = kwargs["x_scale"]w_scale = kwargs["w_scale"]x_shape = x.meta.get("tensor_meta").shapeif has_free_symbols(x_shape):# For dynamic shape case, we can't get activation... | 12 | 119 | 3 | 620 | 0 | 1,785 | 1,915 | 1,785 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_smooth_quant_int_mm_pattern._int_mm_weight_prepack) defined within the public class called public.The function start at line 1785 and ends at 1915. It contains 119 lines of code and it has a cyclomatic complexity of 12. It takes 3 parameters, represented as [1785.0] and does not return any value... |
pytorch_ao | public | public | 0 | 0 | _register_smooth_quant_int_mm_pattern | def _register_smooth_quant_int_mm_pattern():"""The pattern is:(no bias) reshape -> _int_mm -> convert_element_type -> (expand ->) mul -> mul -> reshapeor(with bias) pattern_no_bias -> add (-> reshape -> reshape)"""# When torch.compile'ing with dynamic=True, the expand node and the two tailing reshape nodes exist# When ... | 2 | 45 | 0 | 177 | 34 | 1,661 | 1,915 | 1,661 | null | ['pattern_no_bias_2', 'bias_node', 'w_scale', 'x_scale_is_scalar', 'bias', 'pattern_no_bias_1', 'new_out_node', 'pattern_with_bias_1', 'x_reshaped', 'x_scale_shape', 'pattern_with_bias_2', 'aten_int_mm_node', 'transpose_node', 'packed_weight_inputs', 'new_args', 'prod', 'packed_weight_op', 'pattern1_with_no_outer_or_ac... | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_smooth_quant_int_mm_pattern) defined within the public class called public.The function start at line 1661 and ends at 1915. It contains 45 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 | __init__ | def __init__(self,binary_op_name: str = "none",alpha=None,unary_op_name: str = "none",scalars_attr=None,algorithm_attr=None,) -> None:self.binary_op_name = binary_op_nameself.alpha = alpha if alpha else 1.0self.unary_op_name = unary_op_nameself.scalars_attr = scalars_attr if scalars_attr else []self.algorithm_attr = al... | 4 | 13 | 6 | 72 | 0 | 1,919 | 1,931 | 1,919 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 1919 and ends at 1931. It contains 13 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [1919.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qconv_post_op_fusion_pass.qconv | def qconv(match: Match, *args, **kwargs):# Activation QParamsx, x_scale, x_zp = (kwargs["x"],kwargs["x_scale"],kwargs["x_zp"],)# Weight QParamspacked_weight, w_scale, w_zp = (kwargs["packed_weight"],kwargs["w_scale"],kwargs["w_zp"],)# Conv Paramsb, stride, padding, dilation, groups = (kwargs["b"],kwargs["stride"],kwarg... | 13 | 118 | 3 | 505 | 0 | 1,947 | 2,069 | 1,947 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qconv_post_op_fusion_pass.qconv) defined within the public class called public.The function start at line 1947 and ends at 2069. It contains 118 lines of code and it has a cyclomatic complexity of 13. It takes 3 parameters, represented as [1947.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qconv_post_op_fusion_pass | def _register_qconv_post_op_fusion_pass(pattern,pass_number,computation_op,post_op_attr,):has_binary_post_op = post_op_attr.binary_op_name != "none"@register_freezing_graph_pattern(pattern,extra_check=_is_valid_qconv_post_op_fusion_pattern(has_binary_post_op),pass_number=pass_number,)def qconv(match: Match, *args, **kw... | 1 | 14 | 4 | 40 | 14 | 1,934 | 2,071 | 1,934 | null | ['count_key', 'new_conv_node', 'out_node', 'has_binary_post_op', 'min_value', 'o_zero_point', 'output_dtype', 'max_value', 'accum_scale', 'accum_zp', 'nodes_key', 'o_inv_scale', 'computation_args', 'accum'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qconv_post_op_fusion_pass) defined within the public class called public.The function start at line 1934 and ends at 2071. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1934.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qconv_unary_fusion | def _register_qconv_unary_fusion():from torch._inductor.fx_passes.mkldnn_fusion import (_hardswish_fusion,_hardtanh_fusion,_silu_fusion,)for original_pattern_output_dtype in [torch.float32, torch.bfloat16]:# Priority 1 to match: QConv2d Unary pattern with int8 output# If a pattern1 is a sub-set of pattern2, we should t... | 8 | 110 | 0 | 436 | 3 | 2,074 | 2,193 | 2,074 | null | ['is_bf16', 'conv_unary_replace_float_out_patterns', 'conv_unary_replace_patterns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qconv_unary_fusion) defined within the public class called public.The function start at line 2074 and ends at 2193. It contains 110 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qconv_binary_fusion | def _register_qconv_binary_fusion():for int8_mixed_bf16_with_inplace_add in [False, True]:# Priority 1 to match: QConv2d Binary or Binary-Unary pattern with int8 outputswap_binary_inputs_list = [False, True]binary_replace_patterns = {}for swap_inputs in swap_binary_inputs_list:binary_replace_patterns.update({PostOpAttr... | 10 | 100 | 0 | 381 | 3 | 2,196 | 2,303 | 2,196 | null | ['binary_replace_float_out_patterns', 'binary_replace_patterns', 'swap_binary_inputs_list'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qconv_binary_fusion) defined within the public class called public.The function start at line 2196 and ends at 2303. It contains 100 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 | _register_qlinear_post_op_fusion_pass.qlinear_post_op_fusion | def qlinear_post_op_fusion(match: Match, *args, **kwargs):"""Match the pattern:qlinear - post op"""output_dtype = _get_pattern_output_dtype(match)# Activation QParamsx, x_scale, x_zp = (kwargs["x"],kwargs["x_scale"],kwargs["x_zp"],)# Weight QParamspacked_weight, w_scale, w_zp = (kwargs["packed_weight"],kwargs["w_scale"... | 9 | 85 | 3 | 365 | 0 | 2,319 | 2,414 | 2,319 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qlinear_post_op_fusion_pass.qlinear_post_op_fusion) defined within the public class called public.The function start at line 2319 and ends at 2414. It contains 85 lines of code and it has a cyclomatic complexity of 9. It takes 3 parameters, represented as [2319.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qlinear_post_op_fusion_pass | def _register_qlinear_post_op_fusion_pass(pattern,pass_number,computation_op,post_op_attr,):has_binary_post_op = post_op_attr.binary_op_name != "none"@register_freezing_graph_pattern(pattern,extra_check=_is_valid_qlinear_post_op_fusion_pattern(has_binary_post_op),pass_number=pass_number,)def qlinear_post_op_fusion(matc... | 1 | 13 | 4 | 38 | 13 | 2,306 | 2,414 | 2,306 | null | ['count_key', 'x2_zp', 'out_node', 'has_binary_post_op', 'o_zero_point', 'output_dtype', 'b', 'new_linear_node', 'other', 'o_inv_scale', 'nodes_key', 'computation_args', 'x2_scale'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qlinear_post_op_fusion_pass) defined within the public class called public.The function start at line 2306 and ends at 2414. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [2306.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qlinear_unary_fusion | def _register_qlinear_unary_fusion():from torch._inductor.fx_passes.mkldnn_fusion import (_gelu_fusion_1 as _gelu_fusion_erf,)from torch._inductor.fx_passes.mkldnn_fusion import (_gelu_fusion_2 as _gelu_fusion_tanh,)for original_pattern_output_dtype in [torch.float32, torch.bfloat16]:is_bf16 = original_pattern_output_d... | 10 | 101 | 0 | 396 | 5 | 2,417 | 2,523 | 2,417 | null | ['qlinear_pattern', 'computation_op', 'is_bf16', 'linear_unary_replace_patterns', 'linear_unary_replace_float_out_patterns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qlinear_unary_fusion) defined within the public class called public.The function start at line 2417 and ends at 2523. It contains 101 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 | _register_qlinear_binary_fusion | def _register_qlinear_binary_fusion():r"""Supported linear-binary(-unary) patternslinear(X) extra input \ /Add |Optional(relu) | Y1. int8-mixed-fp32+---+---------------+-----------+------------------------------+---------+| # | Add type| Quant out | Pattern| Post op |+---+---------------+-----------+-------------------... | 15 | 152 | 0 | 566 | 9 | 2,526 | 2,740 | 2,526 | null | ['unary_postop_list', 'unary_postop_dict', 'qlinear_binary_op', 'swap_binary_inputs_list', 'int8_mixed_bf16_list', 'qlinear_binary_replace_patterns', 'binary_replace_float_out_patterns', 'convert_dtype_after_binary_list', 'combinations'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qlinear_binary_fusion) defined within the public class called public.The function start at line 2526 and ends at 2740. It contains 152 lines of code and it has a cyclomatic complexity of 15. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_quantization_weight_pack_pass | def _register_quantization_weight_pack_pass():# Step 1: Dequant promotion for int8-mixed-fp32/bf16_register_dequant_promotion()# Step 2: QConv weight prepack_register_qconv_weight_prepack()# Step 3: QLinear weight prepack_register_qlinear_weight_prepack()_register_linear_dynamic_fp16_weight_prepack()# Step 4: weight pr... | 2 | 11 | 0 | 43 | 0 | 2,744 | 2,764 | 2,744 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_quantization_weight_pack_pass) defined within the public class called public.The function start at line 2744 and ends at 2764. 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 | quant_lift_up.is_view_op | def is_view_op(node):return node.op == "call_function" and node.target in _VIEW_OPS | 2 | 2 | 1 | 17 | 0 | 2,802 | 2,803 | 2,802 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (quant_lift_up.is_view_op) defined within the public class called public.The function start at line 2802 and ends at 2803. It contains 2 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 | quant_lift_up.maybe_replace_node | def maybe_replace_node(n: torch.fx.Node) -> torch.fx.Node:if n == input_node_of_quant:return input_nodeelse:return n | 2 | 5 | 1 | 28 | 0 | 2,842 | 2,846 | 2,842 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (quant_lift_up.maybe_replace_node) defined within the public class called public.The function start at line 2842 and ends at 2846. 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 | quant_lift_up | def quant_lift_up(module_graph: torch.fx.graph.Graph):"""Lift up the quant node before view like nodes. It can benefit performanceof Attention like block. For example, we have the pattern as: DQDQ LINEARLINEAR VIEWVIEW PERMUTEPERMUTETRANSPOSEQQDQ DQ MatmulDIVADDSOFTMAXWe want to lift up the the quant nodes from matmul ... | 10 | 31 | 1 | 191 | 8 | 2,767 | 2,852 | 2,767 | null | ['new_quant_node', 'could_lift_up', 'current_node', 'quant_node', 'input_node', 'input_node_of_quant', 'new_args', 'new_kwargs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (quant_lift_up) defined within the public class called public.The function start at line 2767 and ends at 2852. It contains 31 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 | _create_module_name_filter.check_all_nodes_from_module | def check_all_nodes_from_module(nodes: list[Node]) -> bool:all_nodes_from_module_name: bool = all(filter_fn(n) for n in nodes)return all_nodes_from_module_name | 2 | 3 | 1 | 29 | 0 | 95 | 97 | 95 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_create_module_name_filter.check_all_nodes_from_module) defined within the public class called public.The function start at line 95 and ends at 97. It contains 3 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 | _create_module_name_filter | def _create_module_name_filter(module_name: str) -> FilterFn:"""Create a filter function for a given module name.The filter function takes a list of nodes (as determined by the annotate function)and return True if *all* nodes come from the specified module name, False otherwise.For example:linear_1: "f32[3, 10]" = torc... | 1 | 4 | 1 | 20 | 1 | 78 | 99 | 78 | null | ['filter_fn'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_create_module_name_filter) defined within the public class called public.The function start at line 78 and ends at 99. 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 | _create_operator_type_filter.operator_type_filter | def operator_type_filter(nodes: list[Node]):num_nodes_with_operator_type = sum(node.target == operator_type for node in nodes)if num_nodes_with_operator_type > 1:raise NotImplementedError(f"Several nodes within a single pattern are {operator_type}.")return num_nodes_with_operator_type == 1 | 3 | 9 | 1 | 39 | 0 | 119 | 127 | 119 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_create_operator_type_filter.operator_type_filter) defined within the public class called public.The function start at line 119 and ends at 127. It contains 9 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 | _create_operator_type_filter | def _create_operator_type_filter(operator_type: Callable,) -> FilterFn:"""Create a filter function for a given operator type.The filter function takes a list of nodes and returns True if it containsexactly one node with the specified operator type, False otherwise.For example:linear_1: "f32[3, 10]" = torch.ops.aten.lin... | 1 | 5 | 1 | 15 | 1 | 102 | 129 | 102 | null | ['num_nodes_with_operator_type'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_create_operator_type_filter) defined within the public class called public.The function start at line 102 and ends at 129. 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 | _global_config_filter | def _global_config_filter(nodes: List[Node]) -> bool:"""Filter function for global configuration.This filter function takes a list of nodes and returns True if there is exactly one nodein the list that is a default quantizable operation, False otherwise."""num_nodes_in_default_quantizable_ops = sum(node.target in defau... | 3 | 9 | 1 | 41 | 1 | 132 | 145 | 132 | null | ['num_nodes_in_default_quantizable_ops'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_global_config_filter) defined within the public class called public.The function start at line 132 and ends at 145. It contains 9 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 | _map_module_function_to_aten_operator_type | def _map_module_function_to_aten_operator_type():module_function_to_aten_operator: Dict[Callable, torch._ops.OpOverloadPacket] = {}map_list = (([torch.nn.Conv2d, F.conv2d], torch.ops.aten.conv2d.default),([torch.nn.Linear, F.linear], torch.ops.aten.linear.default),([torch.matmul,],torch.ops.aten.matmul.default,),)for m... | 2 | 15 | 0 | 117 | 1 | 148 | 162 | 148 | null | ['map_list'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_map_module_function_to_aten_operator_type) defined within the public class called public.The function start at line 148 and ends at 162. It contains 15 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_default_arm_inductor_quantization_config | def get_default_arm_inductor_quantization_config(is_qat: bool = False,is_dynamic: bool = False,):extra_args: Dict[str, Any] = {"eps": 2**-12}if is_qat:if is_dynamic:act_observer_or_fake_quant_ctr = FakeQuantizedynamic_quant_observer = MovingAverageMinMaxObserver.with_args(averaging_constant=1)extra_args["observer"] = d... | 6 | 53 | 2 | 196 | 6 | 166 | 222 | 166 | null | ['act_quantization_spec', 'act_observer_or_fake_quant_ctr', 'quantization_config', 'bias_quantization_spec', 'dynamic_quant_observer', 'weight_quantization_spec'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_default_arm_inductor_quantization_config) defined within the public class called public.The function start at line 166 and ends at 222. It contains 53 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [166.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _config_checker.wrapper | def wrapper(quantizer: "ArmInductorQuantizer",name: Any,quantization_config: Optional["QuantizationConfig"],) -> "ArmInductorQuantizer":if quantizer._need_skip_config(quantization_config):warnings.warn(f"Skip the quantization config for {name}.",)return quantizerreturn method(quantizer, name, quantization_config) | 2 | 11 | 3 | 48 | 0 | 227 | 237 | 227 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_config_checker.wrapper) defined within the public class called public.The function start at line 227 and ends at 237. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [227.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _config_checker | def _config_checker(method: Callable) -> Callable:@functools.wraps(method)def wrapper(quantizer: "ArmInductorQuantizer",name: Any,quantization_config: Optional["QuantizationConfig"],) -> "ArmInductorQuantizer":if quantizer._need_skip_config(quantization_config):warnings.warn(f"Skip the quantization config for {name}.",... | 1 | 4 | 1 | 20 | 0 | 225 | 239 | 225 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_config_checker) defined within the public class called public.The function start at line 225 and ends at 239. 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 | get_global_quantization_config | def get_global_quantization_config(self):if not isinstance(self.global_config, QuantizationConfig):warnings.warn("The global_config for ArmInductorQuantizer is currently invalid. \Please ensure that you use set_global to establish the global quantization configuration.")return self.global_config | 2 | 7 | 1 | 26 | 0 | 245 | 251 | 245 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_global_quantization_config) defined within the public class called public.The function start at line 245 and ends at 251. It contains 7 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 | set_function_type_qconfig | def set_function_type_qconfig(self,function_type: Callable,quantization_config: Optional[QuantizationConfig],) -> "ArmInductorQuantizer":if function_type in ArmInductorQuantizer.module_function_to_aten_operator_type:self._set_aten_operator_qconfig(ArmInductorQuantizer.module_function_to_aten_operator_type[function_type... | 2 | 17 | 3 | 51 | 0 | 254 | 270 | 254 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (set_function_type_qconfig) defined within the public class called public.The function start at line 254 and ends at 270. It contains 17 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [254.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | set_module_type_qconfig | def set_module_type_qconfig(self,module_type: torch.nn.Module,quantization_config: Optional[QuantizationConfig],) -> "ArmInductorQuantizer":if module_type in ArmInductorQuantizer.module_function_to_aten_operator_type:self._set_aten_operator_qconfig(ArmInductorQuantizer.module_function_to_aten_operator_type[module_type]... | 2 | 15 | 3 | 55 | 0 | 273 | 287 | 273 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (set_module_type_qconfig) defined within the public class called public.The function start at line 273 and ends at 287. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [273.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | set_module_name_qconfig | def set_module_name_qconfig(self, module_name: str, quantization_config: Optional[QuantizationConfig]):"""Set quantization_config for a submodule with name: `module_name`, for example:quantizer.set_module_name_qconfig("blocks.sub"), it will quantize all supported operator/operatorpatterns in the submodule with this mod... | 1 | 5 | 3 | 27 | 0 | 290 | 300 | 290 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (set_module_name_qconfig) defined within the public class called public.The function start at line 290 and ends at 300. It contains 5 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 | _set_aten_operator_qconfig | def _set_aten_operator_qconfig(self,operator_type: torch._ops.OpOverloadPacket,quantization_config: Optional[QuantizationConfig],) -> "ArmInductorQuantizer":if operator_type in quantizable_ops:self.operator_type_qconfig[operator_type] = quantization_configelse:warnings.warn(f"operator: Unable to quantize {operator} by ... | 2 | 12 | 3 | 47 | 0 | 302 | 313 | 302 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_set_aten_operator_qconfig) defined within the public class called public.The function start at line 302 and ends at 313. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [302.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | annotate | def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:"""Annotate the given model with quantization configurations.Annotation contracts:1. Annotate each node according to the user's qconfig in the following order:`module_name_qconfig`, `operator_type_qconfig`, and `global_config`.2. Avoid re-annotatin... | 4 | 16 | 2 | 92 | 0 | 315 | 346 | 315 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (annotate) defined within the public class called public.The function start at line 315 and ends at 346. It contains 16 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [315.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _annotate_with_config | def _annotate_with_config(self,model: torch.fx.GraphModule,quantization_config: Optional[QuantizationConfig],filter_fn: FilterFn,) -> None:"""Annotate the model with the given quantization configuration.High-level description of quantization recipe for Arm Inductor Backend:Apply quantization recipe for fusion patterns ... | 1 | 9 | 4 | 58 | 0 | 348 | 363 | 348 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_annotate_with_config) defined within the public class called public.The function start at line 348 and ends at 363. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [348.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _annotate_qat_conv2d_fusion_pattern | def _annotate_qat_conv2d_fusion_pattern(self,model: torch.fx.GraphModule,quantization_config: Optional[QuantizationConfig],filter_fn: Optional[FilterFn] = None,):# Annotate QAT Specific patternsself._annotate_qat_conv2d_bn_binary(model, quantization_config, filter_fn)self._annotate_qat_conv2d_bn(model, quantization_con... | 1 | 8 | 4 | 50 | 0 | 365 | 373 | 365 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_annotate_qat_conv2d_fusion_pattern) defined within the public class called public.The function start at line 365 and ends at 373. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [365.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _annotate_conv2d_fusion_pattern | def _annotate_conv2d_fusion_pattern(self,model: torch.fx.GraphModule,quantization_config: Optional[QuantizationConfig],filter_fn: Optional[FilterFn] = None,):if (quantization_config is None) or (quantization_config.is_qat):# Annotate QAT specific pattern: mainly due to BN not folded in prepare_qatself._annotate_qat_con... | 3 | 12 | 4 | 73 | 0 | 375 | 387 | 375 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_annotate_conv2d_fusion_pattern) defined within the public class called public.The function start at line 375 and ends at 387. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [375.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _annotate_linear_fusion_pattern | def _annotate_linear_fusion_pattern(self,model: torch.fx.GraphModule,quantization_config: Optional[QuantizationConfig],filter_fn: Optional[FilterFn] = None,):self._annotate_linear_unary(model, quantization_config, filter_fn)self._annotate_linear(model, quantization_config, filter_fn) | 1 | 8 | 4 | 50 | 0 | 389 | 396 | 389 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_annotate_linear_fusion_pattern) defined within the public class called public.The function start at line 389 and ends at 396. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [389.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, quantizers: list[Quantizer]):super().__init__()self.quantizers = quantizersself._graph_annotations: dict[Node, QuantizationAnnotation] = {} | 1 | 4 | 2 | 37 | 0 | 44 | 47 | 44 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 44 and ends at 47. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [44.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _record_and_validate_annotations | def _record_and_validate_annotations(self, gm: torch.fx.GraphModule, quantizer: Quantizer) -> None:for n in gm.graph.nodes:if Q_ANNOTATION_KEY in n.meta:# check if the annotation has been changed by# comparing QuantizationAnnotation object idif n in self._graph_annotations and (id(self._graph_annotations[n]) != id(n.me... | 6 | 18 | 3 | 100 | 0 | 49 | 68 | 49 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_record_and_validate_annotations) defined within the public class called public.The function start at line 49 and ends at 68. It contains 18 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [49.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | annotate | def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:"""just handling global spec for now"""for quantizer in self.quantizers:quantizer.annotate(model)self._record_and_validate_annotations(model, quantizer)return model | 2 | 5 | 2 | 43 | 0 | 70 | 75 | 70 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (annotate) defined within the public class called public.The function start at line 70 and ends at 75. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [70.0] and does not return any value.. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.