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
_gemlite_uintx_weight_only_transform
def _gemlite_uintx_weight_only_transform(module: torch.nn.Module, config: GemliteUIntXWeightOnlyConfig):group_size = config.group_sizebit_width = config.bit_widthpacking_bitwidth = config.packing_bitwidthmode = config.modeif config.set_inductor_config:torchao.quantization.utils.recommended_inductor_config_setter()weigh...
3
26
2
137
7
1,082
1,110
1,082
null
['use_hqq', 'mode', 'group_size', 'bit_width', 'packing_bitwidth', 'new_weight', 'weight']
None
null
0
0
0
null
0
null
The function (_gemlite_uintx_weight_only_transform) defined within the public class called public.The function start at line 1082 and ends at 1110. It contains 26 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1082.0] and does not return any value..
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
2
1
13
0
1,154
1,155
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 1154 and ends at 1155. 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
_int4_weight_only_quantize_tensor
def _int4_weight_only_quantize_tensor(weight, config):# TODO(future PR): perhaps move this logic to a different file, to keep the API# file clean of implementation details# for now, make these local variables to allow the rest of the function# to be a direct copy-pastegroup_size = config.group_sizelayout = config.layou...
18
112
2
481
15
1,163
1,295
1,163
null
['quant_min', 'use_hqq', 'layout', 'group_size', 'block_size', 'eps', 'target_dtype', 'new_weight', 'zero_point_domain', 'quant_max', 'mapping_type', 'int4_choose_qparams_algorithm', 'preserve_zero', 'int4_packing_format', 'zero_point_dtype']
None
null
0
0
0
null
0
null
The function (_int4_weight_only_quantize_tensor) defined within the public class called public.The function start at line 1163 and ends at 1295. It contains 112 lines of code and it has a cyclomatic complexity of 18. It takes 2 parameters, represented as [1163.0] and does not return any value..
pytorch_ao
public
public
0
0
_int4_weight_only_transform
def _int4_weight_only_transform(module: torch.nn.Module, config: Int4WeightOnlyConfig) -> torch.nn.Module:if config.set_inductor_config:torchao.quantization.utils.recommended_inductor_config_setter()assert hasattr(module, "weight"), ("applying int8 weight only quant requires module to have weight attribute"+ " but {mod...
2
13
2
88
1
1,299
1,312
1,299
null
['new_weight']
None
null
0
0
0
null
0
null
The function (_int4_weight_only_transform) defined within the public class called public.The function start at line 1299 and ends at 1312. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1299.0] and does not return any value..
pytorch_ao
public
public
0
0
_float8_dynamic_activation_int4_weight_transform
def _float8_dynamic_activation_int4_weight_transform(module: torch.nn.Module, config: Float8DynamicActivationInt4WeightConfig) -> torch.nn.Module:assert hasattr(module, "weight"), ("applying int8 weight only quant requires module to have weight attribute"+ " but {module} does not have one")int4_packing_format = config....
2
22
2
128
5
1,330
1,352
1,330
null
['block_size', 'group_size', 'new_weight', 'int4_packing_format', 'weight']
None
null
0
0
0
null
0
null
The function (_float8_dynamic_activation_int4_weight_transform) defined within the public class called public.The function start at line 1330 and ends at 1352. It contains 22 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1330.0] and does not return any value..
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
2
1
13
0
1,370
1,371
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 1370 and ends at 1371. 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
_int8_weight_only_quantize_tensor
def _int8_weight_only_quantize_tensor(weight, config):mapping_type = MappingType.SYMMETRICtarget_dtype = torch.int8eps = torch.finfo(torch.float32).epszero_point_dtype = torch.int64group_size = config.group_sizeif group_size is None:group_size = weight.shape[-1]block_size = tuple([1 for x in range(weight.dim() - 1)] + ...
3
18
2
101
7
1,378
1,395
1,378
null
['group_size', 'block_size', 'eps', 'target_dtype', 'new_weight', 'mapping_type', 'zero_point_dtype']
None
null
0
0
0
null
0
null
The function (_int8_weight_only_quantize_tensor) defined within the public class called public.The function start at line 1378 and ends at 1395. It contains 18 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1378.0] and does not return any value..
pytorch_ao
public
public
0
0
_int8_weight_only_transform
def _int8_weight_only_transform(module: torch.nn.Module, config: Int8WeightOnlyConfig):if config.set_inductor_config:torchao.quantization.utils.recommended_inductor_config_setter()assert hasattr(module, "weight"), ("applying int8 weight only quant requires module to have weight attribute"+ " but {module} does not have ...
2
11
2
82
1
1,399
1,410
1,399
null
['new_weight']
None
null
0
0
0
null
0
null
The function (_int8_weight_only_transform) defined within the public class called public.The function start at line 1399 and ends at 1410. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1399.0] and does not return any value..
pytorch_ao
public
public
0
0
_int8_symm_per_token_reduced_range_quant
def _int8_symm_per_token_reduced_range_quant(x: torch.Tensor) -> torch.Tensor:mapping_type = MappingType.SYMMETRICtarget_dtype = torch.int8eps = 1e-5quant_min = -127quant_max = 127return to_affine_quantized_intx(x,mapping_type,_get_per_token_block_size(x),target_dtype,eps=eps,quant_min=quant_min,quant_max=quant_max,sca...
2
16
1
78
5
1,413
1,428
1,413
null
['mapping_type', 'eps', 'target_dtype', 'quant_max', 'quant_min']
None
null
0
0
0
null
0
null
The function (_int8_symm_per_token_reduced_range_quant) defined within the public class called public.The function start at line 1413 and ends at 1428. It contains 16 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
_int8_symm_per_token_reduced_range_quant_noop_decode
def _int8_symm_per_token_reduced_range_quant_noop_decode(x: torch.Tensor,) -> torch.Tensor:mapping_type = MappingType.SYMMETRICtarget_dtype = torch.int8eps = 1e-5quant_min = -127quant_max = 127if x.shape[1] == 1:return xelse:return to_affine_quantized_intx(x,mapping_type,_get_per_token_block_size(x),target_dtype,eps=ep...
3
21
1
93
5
1,431
1,451
1,431
null
['mapping_type', 'eps', 'target_dtype', 'quant_max', 'quant_min']
None
null
0
0
0
null
0
null
The function (_int8_symm_per_token_reduced_range_quant_noop_decode) defined within the public class called public.The function start at line 1431 and ends at 1451. It contains 21 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
_int8_symm_cutlass_quant
def _int8_symm_cutlass_quant(x: torch.Tensor) -> torch.Tensor:return to_affine_quantized_intx(x,mapping_type=MappingType.SYMMETRIC,block_size=_get_per_token_block_size(x),target_dtype=torch.int8,scale_dtype=torch.float32,eps=torch.finfo(torch.float32).eps,zero_point_domain=ZeroPointDomain.NONE,)
1
10
1
63
0
1,454
1,463
1,454
null
[]
None
null
0
0
0
null
0
null
The function (_int8_symm_cutlass_quant) defined within the public class called public.The function start at line 1454 and ends at 1463. 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
_int4_symm_cutlass_quant
def _int4_symm_cutlass_quant(x: torch.Tensor) -> torch.Tensor:return to_affine_quantized_intx(x,mapping_type=MappingType.SYMMETRIC,block_size=_get_per_token_block_size(x),target_dtype=torch.int8,quant_min=-8,quant_max=7,scale_dtype=torch.float32,eps=torch.finfo(torch.float32).eps,zero_point_domain=ZeroPointDomain.NONE,...
1
13
1
78
0
1,466
1,478
1,466
null
[]
None
null
0
0
0
null
0
null
The function (_int4_symm_cutlass_quant) defined within the public class called public.The function start at line 1466 and ends at 1478. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_float8_cutlass_quant
def _float8_cutlass_quant(x: torch.Tensor,target_dtype: torch.dtype,) -> torch.Tensor:return to_affine_quantized_floatx(x,block_size=_get_per_token_block_size(x),scale_dtype=torch.float32,target_dtype=target_dtype,_layout=Float8Layout(mm_config=None),)
1
11
2
52
0
1,481
1,491
1,481
null
[]
None
null
0
0
0
null
0
null
The function (_float8_cutlass_quant) defined within the public class called public.The function start at line 1481 and ends at 1491. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1481.0] and does not return any value..
pytorch_ao
public
public
0
0
_float8_cutlass_quant_sparse
def _float8_cutlass_quant_sparse(x: torch.Tensor,target_dtype: torch.dtype,) -> (torch.Tensor, torch.Tensor):return to_affine_quantized_floatx(x,block_size=_get_per_token_block_size(x),scale_dtype=torch.float32,target_dtype=target_dtype,_layout=CutlassSemiSparseLayout(),)
1
11
2
55
0
1,494
1,504
1,494
null
[]
None
null
0
0
0
null
0
null
The function (_float8_cutlass_quant_sparse) defined within the public class called public.The function start at line 1494 and ends at 1504. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1494.0] and does not return any value..
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
4
1
13
0
1,529
1,532
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 1529 and ends at 1532. 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
_int8_dynamic_activation_int8_weight_quantize_tensor.get_weight_block_size
def get_weight_block_size(x):return tuple([1 for _ in range(x.dim() - 1)] + [x.shape[-1]])
2
2
1
35
0
1,559
1,560
1,559
null
[]
None
null
0
0
0
null
0
null
The function (_int8_dynamic_activation_int8_weight_quantize_tensor.get_weight_block_size) defined within the public class called public.The function start at line 1559 and ends at 1560. 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...
pytorch_ao
public
public
0
0
_int8_dynamic_activation_int8_weight_quantize_tensor
def _int8_dynamic_activation_int8_weight_quantize_tensor(weight, config):layout = config.layoutact_mapping_type = config.act_mapping_typeweight_only_decode = config.weight_only_decodein_features = weight.shape[-1]# int8 dynamic quantization only has benefit when in_feature > 16if in_features <= 16:logger.info(f"Skippin...
4
37
2
149
12
1,541
1,587
1,541
null
['weight_only_decode', 'weight_zero_point_domain', 'layout', 'block_size', 'eps', 'in_features', 'act_mapping_type', 'target_dtype', 'new_weight', 'mapping_type', 'zero_point_dtype', 'input_quant_func']
None
null
0
0
0
null
0
null
The function (_int8_dynamic_activation_int8_weight_quantize_tensor) defined within the public class called public.The function start at line 1541 and ends at 1587. It contains 37 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [1541.0] and does not return any value..
pytorch_ao
public
public
0
0
_int8_dynamic_activation_int8_weight_transform
def _int8_dynamic_activation_int8_weight_transform(module: torch.nn.Module, config: Int8DynamicActivationInt8WeightConfig) -> torch.nn.Module:if config.set_inductor_config:torchao.quantization.utils.recommended_inductor_config_setter()assert hasattr(module, "weight"), ("applying int8 dynamic activation int8 weight quan...
2
15
2
88
1
1,591
1,606
1,591
null
['new_weight']
None
null
0
0
0
null
0
null
The function (_int8_dynamic_activation_int8_weight_transform) defined within the public class called public.The function start at line 1591 and ends at 1606. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1591.0] and does not return any value..
pytorch_ao
public
public
0
0
int8_dynamic_activation_int8_semi_sparse_weight
def int8_dynamic_activation_int8_semi_sparse_weight():"""Applies int8 dnynamic symmetric per-token activation and int8 per-channel weightquantization + 2:4 sparsity to linear layers."""warnings.warn("""int8_dyanmic_activation_int8_semi_sparse_weight() will be deprecated at a later release. Please use the layout kwarg i...
1
8
0
20
0
1,609
1,621
1,609
null
[]
None
null
0
0
0
null
0
null
The function (int8_dynamic_activation_int8_semi_sparse_weight) defined within the public class called public.The function start at line 1609 and ends at 1621. 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
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
2
1
13
0
1,642
1,643
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 1642 and ends at 1643. 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
_float8_weight_only_quant_tensor
def _float8_weight_only_quant_tensor(weight, config):if config.version == 1:warnings.warn("Config Deprecation: version 1 of Float8WeightOnlyConfig is deprecated and will no longer be supported in a future release, please use version 2, see https://github.com/pytorch/ao/issues/2649 for more details")from torchao.dtypes ...
3
21
2
125
3
1,652
1,673
1,652
null
['weight_dtype', 'new_weight', 'block_size']
None
null
0
0
0
null
0
null
The function (_float8_weight_only_quant_tensor) defined within the public class called public.The function start at line 1652 and ends at 1673. It contains 21 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1652.0] and does not return any value..
pytorch_ao
public
public
0
0
_float8_weight_only_transform
def _float8_weight_only_transform(module: torch.nn.Module, config: Float8WeightOnlyConfig) -> torch.nn.Module:if config.set_inductor_config:torchao.quantization.utils.recommended_inductor_config_setter()assert hasattr(module, "weight"), ("applying int8 weight only quant requires module to have weight attribute"+ " but ...
2
13
2
88
1
1,677
1,691
1,677
null
['new_weight']
None
null
0
0
0
null
0
null
The function (_float8_weight_only_transform) defined within the public class called public.The function start at line 1677 and ends at 1691. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1677.0] and does not return any value..
pytorch_ao
public
public
0
0
_input_activation_quant_func_fp8
def _input_activation_quant_func_fp8(x: torch.Tensor,activation_granularity: FP8Granularity,activation_dtype: torch.dtype,scale: Optional[torch.Tensor] = None,zero_point: Optional[torch.Tensor] = None,):"""This function is used to quantize the input activation tensor for an aqt_float variant. If scaleis not provided it...
3
35
5
163
2
1,694
1,732
1,694
null
['activation', 'block_size']
None
null
0
0
0
null
0
null
The function (_input_activation_quant_func_fp8) defined within the public class called public.The function start at line 1694 and ends at 1732. It contains 35 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [1694.0] and does not return any value..
pytorch_ao
public
public
0
0
_fp8_mm_compat
def _fp8_mm_compat(weight: torch.Tensor) -> bool:"""Check if a weight tensor meets float8 quantization requirements.Args:weight (torch.Tensor): The weight tensor to checkReturns:bool: True if the tensor can be quantized to float8, False otherwise"""assert weight.dim() in [2,3,], f"float8 quantization only works for 2/3...
3
13
1
72
1
1,735
1,759
1,735
null
['is_compatible']
None
null
0
0
0
null
0
null
The function (_fp8_mm_compat) defined within the public class called public.The function start at line 1735 and ends at 1759. It contains 13 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
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Float8DynamicActivationFloat8WeightConfig")if self.mm_config is None:self.mm_config = Float8MMConfig(use_fast_accum=True)activation_granularity, weight_granularity = _normalize_granularity(self.granularity)self.granularity = [activation_granular...
2
10
1
49
0
1,794
1,803
1,794
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 1794 and ends at 1803. 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
_float8_dynamic_activation_float8_weight_quantize_tensor
def _float8_dynamic_activation_float8_weight_quantize_tensor(weight, config):activation_dtype = config.activation_dtypeweight_dtype = config.weight_dtypegranularity = config.granularitymm_config = config.mm_configactivation_value_lb = config.activation_value_lbactivation_value_ub = config.activation_value_ubkernel_pref...
5
56
2
252
12
1,812
1,879
1,812
null
['activation_dtype', 'act_quant_kwargs', 'mm_config', 'granularity', 'kernel_preference', 'block_size', 'input_quant_kwargs', 'activation_value_lb', 'activation_value_ub', 'weight_dtype', 'quantized_weight', 'input_quant_func']
None
null
0
0
0
null
0
null
The function (_float8_dynamic_activation_float8_weight_quantize_tensor) defined within the public class called public.The function start at line 1812 and ends at 1879. It contains 56 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [1812.0] and does not return any value..
pytorch_ao
public
public
0
0
_float8_dynamic_activation_float8_weight_transform
def _float8_dynamic_activation_float8_weight_transform(module: torch.nn.Module, config: Float8DynamicActivationFloat8WeightConfig):assert is_sm_at_least_89() or is_MI300(), ("Float8 dynamic activation quantization is only supported on CUDA>=8.9 and MI300+")if config.set_inductor_config:torchao.quantization.utils.recomm...
3
18
2
95
1
1,883
1,901
1,883
null
['quantized_weight']
None
null
0
0
0
null
0
null
The function (_float8_dynamic_activation_float8_weight_transform) defined within the public class called public.The function start at line 1883 and ends at 1901. It contains 18 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1883.0] and does not return any value..
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
4
1
13
0
1,919
1,922
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 1919 and ends at 1922. 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
_float8_dynamic_activation_float8_semi_sparse_weight_transform
def _float8_dynamic_activation_float8_semi_sparse_weight_transform(module: torch.nn.Module, config: Float8DynamicActivationFloat8SemiSparseWeightConfig):assert is_sm_at_least_90(), "Float8 quantization is only supported on CUDA>=9.0"weight = module.weightweight_dtype = config.weight_dtypeactivation_dtype = config.activ...
2
21
2
111
4
1,926
1,950
1,926
null
['layout', 'weight_dtype', 'weight', 'activation_dtype']
None
null
0
0
0
null
0
null
The function (_float8_dynamic_activation_float8_semi_sparse_weight_transform) defined within the public class called public.The function start at line 1926 and ends at 1950. It contains 21 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1926.0] and does not return any value...
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
4
1
13
0
1,975
1,978
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 1975 and ends at 1978. 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
_float8_static_activation_float8_weight_transform
def _float8_static_activation_float8_weight_transform(module: torch.nn.Module, config: Float8StaticActivationFloat8WeightConfig):assert is_sm_at_least_89() or is_MI300(), ("Float8 static activation quantization is only supported on CUDA 8.9 and above")scale = config.scaleactivation_dtype = config.activation_dtypeweight...
4
43
2
207
10
1,988
2,038
1,988
null
['activation_dtype', 'mm_config', 'granularity', 'block_size', 'scale', 'input_quant_kwargs', 'weight_dtype', 'weight', 'quantized_weight', 'input_quant_func']
None
null
0
0
0
null
0
null
The function (_float8_static_activation_float8_weight_transform) defined within the public class called public.The function start at line 1988 and ends at 2038. It contains 43 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [1988.0] and does not return any value..
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
2
1
13
0
2,062
2,063
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 2062 and ends at 2063. 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
_uintx_weight_only_transform
def _uintx_weight_only_transform(module: torch.nn.Module, config: UIntXWeightOnlyConfig):dtype = config.dtypegroup_size = config.group_sizepack_dim = config.pack_dimuse_hqq = config.use_hqqif config.set_inductor_config:torchao.quantization.utils.recommended_inductor_config_setter()weight = module.weightfrom torchao.qua...
4
60
2
286
14
2,073
2,138
2,073
null
['use_hqq', '_layout', 'group_size', 'block_size', 'SUPPORTED_DTYPES', 'eps', 'pack_dim', 'dtype', 'zero_point_domain', 'new_weight', 'mapping_type', 'preserve_zero', 'zero_point_dtype', 'weight']
None
null
0
0
0
null
0
null
The function (_uintx_weight_only_transform) defined within the public class called public.The function start at line 2073 and ends at 2138. It contains 60 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [2073.0] and does not return any value..
pytorch_ao
public
public
0
0
_adjust_scale_dtype_in_intx_unpacked_tensor
def _adjust_scale_dtype_in_intx_unpacked_tensor(intx_unpacked_tensor: IntxUnpackedToInt8Tensor,hp_tensor: torch.Tensor,scale_dtype: torch.dtype,) -> None:"""Adjusts the scale_dtype on IntxUnpackedToInt8Tensor.Updating the scale dtype requires updating the qdata because qdata is calculated after the scale.This is used i...
1
17
3
87
0
2,141
2,163
2,141
null
[]
None
null
0
0
0
null
0
null
The function (_adjust_scale_dtype_in_intx_unpacked_tensor) defined within the public class called public.The function start at line 2141 and ends at 2163. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [2141.0] and does not return any value..
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.IntxWeightOnlyConfig")assert self.weight_dtype in [getattr(torch, f"int{b}") for b in range(1, 9)], (f"weight_dtype must be torch.intx, where 1 <= x <= 8, but got {self.weight_dtype}")assert isinstance(self.granularity, (PerAxis, PerGroup)), (f"...
3
19
1
106
0
2,204
2,222
2,204
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 2204 and ends at 2222. It contains 19 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
_intx_weight_only_quantize_tensor
def _intx_weight_only_quantize_tensor(weight,config,*,custom_scale: Optional[torch.Tensor] = None,custom_zero_point: Optional[torch.Tensor] = None,):weight_dtype = config.weight_dtypegranularity = config.granularitymapping_type = config.mapping_typescale_dtype = config.scale_dtypelayout = config.layoutintx_packing_form...
9
69
4
330
12
2,225
2,299
2,225
null
['scale_dtype', 'granularity', 'layout', 'intx_packing_format', 'group_size', 'block_size', 'custom_zero_point', 'new_weight', 'mapping_type', 'weight_dtype', 'weight', 'intx_choose_qparams_algorithm']
None
null
0
0
0
null
0
null
The function (_intx_weight_only_quantize_tensor) defined within the public class called public.The function start at line 2225 and ends at 2299. It contains 69 lines of code and it has a cyclomatic complexity of 9. It takes 4 parameters, represented as [2225.0] and does not return any value..
pytorch_ao
public
public
0
0
_intx_weight_only_transform
def _intx_weight_only_transform(module: torch.nn.Module,config: IntxWeightOnlyConfig,*,custom_scale: Optional[torch.Tensor] = None,custom_zero_point: Optional[torch.Tensor] = None,) -> torch.nn.Module:assert hasattr(module, "weight"), ("applying intx weight only quant requires module to have weight attribute"+ " but {m...
3
23
4
140
1
2,303
2,327
2,303
null
['new_weight']
None
null
0
0
0
null
0
null
The function (_intx_weight_only_transform) defined within the public class called public.The function start at line 2303 and ends at 2327. It contains 23 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [2303.0] and does not return any value..
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
2
1
13
0
2,346
2,347
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 2346 and ends at 2347. 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
_fpx_weight_only_transform
def _fpx_weight_only_transform(module: torch.nn.Module, config: FPXWeightOnlyConfig) -> torch.nn.Module:ebits = config.ebitsmbits = config.mbitsweight = module.weightif config.set_inductor_config:torchao.quantization.utils.recommended_inductor_config_setter()from torchao.dtypes import to_affine_quantized_fpxfrom torcha...
4
24
2
157
5
2,355
2,381
2,355
null
['_layout', 'new_weight', 'mbits', 'ebits', 'weight']
None
null
0
0
0
null
0
null
The function (_fpx_weight_only_transform) defined within the public class called public.The function start at line 2355 and ends at 2381. It contains 24 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [2355.0] and does not return any value..
pytorch_ao
public
public
0
0
__post_init__
def __post_init__(self):torch._C._log_api_usage_once("torchao.quantization.Int8DynamicActivationInt4WeightConfig")
1
2
1
13
0
2,400
2,401
635
null
[]
None
null
0
0
0
null
0
null
The function (__post_init__) defined within the public class called public.The function start at line 2400 and ends at 2401. 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
_module_fqn_to_config_handler
def _module_fqn_to_config_handler(module: torch.nn.Module, module_fqn: str, config: ModuleFqnToConfig):c = Noneif module_fqn in config.module_fqn_to_config:# Maybe: we can add module type specific config in the future, in neededc = config.module_fqn_to_config[module_fqn]else:# fallback to use default if no module speci...
3
12
3
75
2
2,404
2,419
2,404
null
['c', 'handler']
None
null
0
0
0
null
0
null
The function (_module_fqn_to_config_handler) defined within the public class called public.The function start at line 2404 and ends at 2419. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [2404.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(ctx, x: torch.Tensor) -> torch.Tensor:return torch.round(x)
1
2
2
22
0
215
216
215
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 215 and ends at 216. It contains 2 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
backward
def backward(ctx, gy: torch.Tensor) -> torch.Tensor:return gy
1
2
2
17
0
219
220
219
null
[]
None
null
0
0
0
null
0
null
The function (backward) defined within the public class called public.The function start at line 219 and ends at 220. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [219.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(ctx, x: torch.Tensor, float8_dtype: torch.dtype) -> torch.Tensor:return x.to(float8_dtype)
1
2
3
28
0
229
230
229
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 229 and ends at 230. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [229.0] and does not return any value..
pytorch_ao
public
public
0
0
backward
def backward(ctx, gy: torch.Tensor) -> torch.Tensor:return gy, None
1
2
2
19
0
233
234
233
null
[]
None
null
0
0
0
null
0
null
The function (backward) defined within the public class called public.The function start at line 233 and ends at 234. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [233.0] and does not return any value..
pytorch_ao
public
public
0
0
_get_and_check_qmin_qmax
def _get_and_check_qmin_qmax(dtype, quant_min, quant_max):"""Get quant_min and quant_max args based on dtype and also verify bounds.Args:dtype: Target quantization dtype (e.g., torch.uint8, torch.int8, or FP8 types)quant_min: Minimum quantized value, or None to use dtype defaultquant_max: Maximum quantized value, or No...
5
23
3
101
2
238
276
238
null
['quant_max', 'quant_min']
None
null
0
0
0
null
0
null
The function (_get_and_check_qmin_qmax) defined within the public class called public.The function start at line 238 and ends at 276. It contains 23 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [238.0] and does not return any value..
pytorch_ao
public
public
0
0
_get_reduction_params
def _get_reduction_params(block_size, input_size):"""Given block_size and input size find the parameters for reduction:Output:shape_for_reduction: the shape we use to `view` input to prepare it for reductionreduction_dims: the dims we'll do reduction overExample::Input:block_size: (3, 3, 2, 10)input_size: (3, 3, 10, 10...
5
20
2
136
3
279
317
279
null
['reduction_dims', 'cur_dim', 'shape_for_reduction']
None
null
0
0
0
null
0
null
The function (_get_reduction_params) defined within the public class called public.The function start at line 279 and ends at 317. It contains 20 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [279.0] and does not return any value..
pytorch_ao
public
public
0
0
quantize_affine
def quantize_affine(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],output_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,) -> torch.Tensor:"""Args:input (torch.Tensor): original float32, float16 or bf...
1
18
7
91
0
321
365
321
null
[]
None
null
0
0
0
null
0
null
The function (quantize_affine) defined within the public class called public.The function start at line 321 and ends at 365. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [321.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine
def _quantize_affine(input: torch.Tensor,block_size: List[int],scale: torch.Tensor,zero_point: Optional[torch.Tensor],output_dtype: torch.dtype,quant_min: Optional[Union[int, float, bool]] = None,quant_max: Optional[Union[int, float, bool]] = None,) -> torch.Tensor:"""Quantize tensor using affine quantization with inte...
2
20
7
118
1
369
410
369
null
['output_dtype']
None
null
0
0
0
null
0
null
The function (_quantize_affine) defined within the public class called public.The function start at line 369 and ends at 410. It contains 20 lines of code and it has a cyclomatic complexity of 2. It takes 7 parameters, represented as [369.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_no_dtype_cast
def _quantize_affine_no_dtype_cast(input: torch.Tensor,block_size: List[int],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_min: Union[int, float],quant_max: Union[int, float],) -> torch.Tensor:"""Quantize tensor using affine quantization without dtype casting.Performs quantization with integer zero point...
4
34
6
206
6
413
474
413
null
['shape_after_reduction', 'input', 'zero_point', 'scale', 'quant', 'original_shape']
None
null
0
0
0
null
0
null
The function (_quantize_affine_no_dtype_cast) defined within the public class called public.The function start at line 413 and ends at 474. It contains 34 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [413.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_tinygemm
def _quantize_affine_tinygemm(input: torch.Tensor,block_size: List[int],scale: torch.Tensor,zero_point: Optional[torch.Tensor],output_dtype: torch.dtype,quant_min: Optional[Union[int, float, bool]] = None,quant_max: Optional[Union[int, float, bool]] = None,) -> torch.Tensor:"""Quantize tensor using affine quantization ...
2
20
7
118
1
477
524
477
null
['output_dtype']
None
null
0
0
0
null
0
null
The function (_quantize_affine_tinygemm) defined within the public class called public.The function start at line 477 and ends at 524. It contains 20 lines of code and it has a cyclomatic complexity of 2. It takes 7 parameters, represented as [477.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_tinygemm_no_dtype_cast
def _quantize_affine_tinygemm_no_dtype_cast(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,) -> torch.Tensor:"""Quantize tensor using affine quantization with float zero po...
4
34
6
232
8
527
588
527
null
['shape_after_reduction', 'input', 'zero_point', 'mid_point', 'scale', 'min_val', 'quant', 'original_shape']
None
null
0
0
0
null
0
null
The function (_quantize_affine_tinygemm_no_dtype_cast) defined within the public class called public.The function start at line 527 and ends at 588. It contains 34 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [527.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_no_zero_point
def _quantize_affine_no_zero_point(input: torch.Tensor,block_size: List[int],scale: torch.Tensor,zero_point: Optional[torch.Tensor],output_dtype: torch.dtype,quant_min: Optional[Union[int, float, bool]] = None,quant_max: Optional[Union[int, float, bool]] = None,) -> torch.Tensor:"""Quantize tensor using affine quantiza...
2
20
7
118
1
591
639
591
null
['output_dtype']
None
null
0
0
0
null
0
null
The function (_quantize_affine_no_zero_point) defined within the public class called public.The function start at line 591 and ends at 639. It contains 20 lines of code and it has a cyclomatic complexity of 2. It takes 7 parameters, represented as [591.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_no_zero_point_no_dtype_cast
def _quantize_affine_no_zero_point_no_dtype_cast(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,) -> torch.Tensor:"""Quantize tensor using affine quantization without zero ...
4
32
6
216
6
642
701
642
null
['shape_after_reduction', 'input', 'zero_point', 'scale', 'quant', 'original_shape']
None
null
0
0
0
null
0
null
The function (_quantize_affine_no_zero_point_no_dtype_cast) defined within the public class called public.The function start at line 642 and ends at 701. It contains 32 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [642.0] and does not return any value..
pytorch_ao
public
public
0
0
dequantize_affine
def dequantize_affine(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],input_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,*,output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"""Args:input (t...
1
21
8
107
0
704
741
704
null
[]
None
null
0
0
0
null
0
null
The function (dequantize_affine) defined within the public class called public.The function start at line 704 and ends at 741. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [704.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine
def _dequantize_affine(input: torch.Tensor,block_size: List[int],scale: torch.Tensor,zero_point: Optional[torch.Tensor],input_dtype: torch.dtype,quant_min: Optional[Union[int, float, bool]] = None,quant_max: Optional[Union[int, float, bool]] = None,output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"""Dequanti...
2
29
8
152
0
745
791
745
null
[]
None
null
0
0
0
null
0
null
The function (_dequantize_affine) defined within the public class called public.The function start at line 745 and ends at 791. It contains 29 lines of code and it has a cyclomatic complexity of 2. It takes 8 parameters, represented as [745.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_no_dtype_check
def _dequantize_affine_no_dtype_check(input: torch.Tensor,block_size: List[int],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_min: Union[int, float],quant_max: Union[int, float],output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"""Dequantize tensor using affine dequantization without dtype chec...
4
28
7
189
6
794
848
794
null
['shape_after_reduction', 'input', 'zero_point', 'scale', 'original_shape', 'dequant']
None
null
0
0
0
null
0
null
The function (_dequantize_affine_no_dtype_check) defined within the public class called public.The function start at line 794 and ends at 848. It contains 28 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [794.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_no_zero_point_no_dtype_check
def _dequantize_affine_no_zero_point_no_dtype_check(input: torch.Tensor,block_size: List[int],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_min: Union[int, float],quant_max: Union[int, float],output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"""Dequantize tensor using affine dequantization with...
2
27
7
163
5
851
901
851
null
['shape_after_reduction', 'input', 'scale', 'original_shape', 'dequant']
None
null
0
0
0
null
0
null
The function (_dequantize_affine_no_zero_point_no_dtype_check) defined within the public class called public.The function start at line 851 and ends at 901. It contains 27 lines of code and it has a cyclomatic complexity of 2. It takes 7 parameters, represented as [851.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_no_zero_point
def _dequantize_affine_no_zero_point(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],input_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,*,output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"...
2
30
8
152
0
904
951
904
null
[]
None
null
0
0
0
null
0
null
The function (_dequantize_affine_no_zero_point) defined within the public class called public.The function start at line 904 and ends at 951. It contains 30 lines of code and it has a cyclomatic complexity of 2. It takes 8 parameters, represented as [904.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_tinygemm_no_dtype_check
def _dequantize_affine_tinygemm_no_dtype_check(input: torch.Tensor,block_size: List[int],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_min: Union[int, float],quant_max: Union[int, float],output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"""This function converts AQT tensors to their high precis...
4
30
7
193
7
954
996
954
null
['shape_after_reduction', 'input', 'zero_point', 'mid_point', 'scale', 'original_shape', 'dequant']
None
null
0
0
0
null
0
null
The function (_dequantize_affine_tinygemm_no_dtype_check) defined within the public class called public.The function start at line 954 and ends at 996. It contains 30 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [954.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_tinygemm
def _dequantize_affine_tinygemm(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],input_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,*,output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"""Arg...
2
30
8
152
0
999
1,046
999
null
[]
None
null
0
0
0
null
0
null
The function (_dequantize_affine_tinygemm) defined within the public class called public.The function start at line 999 and ends at 1046. It contains 30 lines of code and it has a cyclomatic complexity of 2. It takes 8 parameters, represented as [999.0] and does not return any value..
pytorch_ao
public
public
0
0
_fake_quantize_affine
def _fake_quantize_affine(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,zero_point_domain: ZeroPointDomain = ZeroPointDomain.INT,) -> torch.Tensor...
4
25
8
135
0
1,049
1,094
1,049
null
[]
None
null
0
0
0
null
0
null
The function (_fake_quantize_affine) defined within the public class called public.The function start at line 1049 and ends at 1094. It contains 25 lines of code and it has a cyclomatic complexity of 4. It takes 8 parameters, represented as [1049.0] and does not return any value..
pytorch_ao
public
public
0
0
_fake_quantize_affine_cachemask
def _fake_quantize_affine_cachemask(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,zero_point_domain: ZeroPointDomain = ZeroPointDomain.INT,) -> Tu...
4
26
8
162
1
1,097
1,141
1,097
null
['mask']
None
null
0
0
0
null
0
null
The function (_fake_quantize_affine_cachemask) defined within the public class called public.The function start at line 1097 and ends at 1141. It contains 26 lines of code and it has a cyclomatic complexity of 4. It takes 8 parameters, represented as [1097.0] and does not return any value..
pytorch_ao
public
public
0
0
_do_fake_quantize_affine
def _do_fake_quantize_affine(input: torch.Tensor,block_size: Tuple[int, ...],scale: torch.Tensor,zero_point: Optional[torch.Tensor],quant_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,zero_point_domain: ZeroPointDomain = ZeroPointDomain.INT,) -> Tuple[tor...
4
41
8
196
5
1,144
1,205
1,144
null
['input_dtype', 'q', '_quantize_affine', '_dequantize_affine', 'dq']
None
null
0
0
0
null
0
null
The function (_do_fake_quantize_affine) defined within the public class called public.The function start at line 1144 and ends at 1205. It contains 41 lines of code and it has a cyclomatic complexity of 4. It takes 8 parameters, represented as [1144.0] and does not return any value..
pytorch_ao
public
public
0
0
choose_qparams_affine
def choose_qparams_affine(input: torch.Tensor,mapping_type: MappingType,block_size: Tuple[int],target_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,eps: Optional[float] = None,scale_dtype: Optional[torch.dtype] = None,zero_point_dtype: Optional[torch.dtyp...
1
22
9
124
0
1,209
1,249
1,209
null
[]
None
null
0
0
0
null
0
null
The function (choose_qparams_affine) defined within the public class called public.The function start at line 1209 and ends at 1249. It contains 22 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [1209.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_qparams_affine_tinygemm
def _choose_qparams_affine_tinygemm(input: torch.Tensor,mapping_type: MappingType,block_size: Tuple[int],target_dtype: torch.dtype,quant_min: Optional[Union[int, float]] = None,quant_max: Optional[Union[int, float]] = None,eps: Optional[float] = None,scale_dtype: Optional[torch.dtype] = None,zero_point_dtype: Optional[...
4
38
9
305
11
1,254
1,321
1,254
null
['scale_dtype', 'input', 'max_val', 'max_val_pos', 'zero_point', 'eps', 'min_val', 'min_val_neg', 'scale', 'mid_point', 'zero_point_dtype']
None
null
0
0
0
null
0
null
The function (_choose_qparams_affine_tinygemm) defined within the public class called public.The function start at line 1254 and ends at 1321. It contains 38 lines of code and it has a cyclomatic complexity of 4. It takes 9 parameters, represented as [1254.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_qparams_affine_dont_preserve_zero
def _choose_qparams_affine_dont_preserve_zero(input: torch.Tensor,mapping_type: MappingType,block_size: Tuple[int],target_dtype: torch.dtype,quant_min: Optional[Union[int, float, bool]] = None,quant_max: Optional[Union[int, float, bool]] = None,eps: Optional[float] = None,scale_dtype: Optional[torch.dtype] = None,zero_...
4
39
9
312
10
1,325
1,389
1,325
null
['scale_dtype', 'input', 'max_val', 'max_val_pos', 'zero_point', 'eps', 'min_val', 'min_val_neg', 'scale', 'zero_point_dtype']
None
null
0
0
0
null
0
null
The function (_choose_qparams_affine_dont_preserve_zero) defined within the public class called public.The function start at line 1325 and ends at 1389. It contains 39 lines of code and it has a cyclomatic complexity of 4. It takes 9 parameters, represented as [1325.0] and does not return any value..
pytorch_ao
public
public
0
0
choose_qparams_affine_with_min_max
def choose_qparams_affine_with_min_max(min_val: torch.Tensor,max_val: torch.Tensor,mapping_type: MappingType,block_size: Tuple[int, ...],target_dtype: torch.dtype,quant_min: Optional[int] = None,quant_max: Optional[int] = None,eps: Optional[float] = None,scale_dtype: Optional[torch.dtype] = None,zero_point_dtype: Optio...
16
87
12
566
12
1,393
1,509
1,393
null
['scale_dtype', 'smax', 'max_val_pos', 'zero_point', 'scale_device', 'eps', 'scale', 'min_val_neg', 'mask', 'mid_point', 'zero_point_dtype', 'smin']
None
null
0
0
0
null
0
null
The function (choose_qparams_affine_with_min_max) defined within the public class called public.The function start at line 1393 and ends at 1509. It contains 87 lines of code and it has a cyclomatic complexity of 16. It takes 12 parameters, represented as [1393.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_qparams_affine
def _choose_qparams_affine(input: Optional[torch.Tensor],mapping_type: str,block_size: List[int],target_dtype: torch.dtype,quant_min: Optional[Union[int, float, bool]] = None,quant_max: Optional[Union[int, float, bool]] = None,eps: Optional[float] = None,scale_dtype: Optional[torch.dtype] = None,zero_point_dtype: Optio...
7
58
9
493
13
1,513
1,592
1,513
null
['scale_dtype', 'input', 'smax', 'max_val', 'max_val_pos', 'zero_point', 'eps', 'min_val', 'min_val_neg', 'scale', 'mask', 'zero_point_dtype', 'smin']
None
null
0
0
0
null
0
null
The function (_choose_qparams_affine) defined within the public class called public.The function start at line 1513 and ends at 1592. It contains 58 lines of code and it has a cyclomatic complexity of 7. It takes 9 parameters, represented as [1513.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_qparams_and_quantize_affine_qqq.reshape_w
def reshape_w(w):w = w.reshape((size_n, size_k)).contiguous()return w
1
3
1
23
0
1,626
1,628
1,626
null
[]
None
null
0
0
0
null
0
null
The function (_choose_qparams_and_quantize_affine_qqq.reshape_w) defined within the public class called public.The function start at line 1626 and ends at 1628. 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
_choose_qparams_and_quantize_affine_qqq
def _choose_qparams_and_quantize_affine_qqq(w: torch.Tensor,num_bits: int,group_size: int,) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:assert num_bits == 4, f"Unsupported num_bits = {num_bits}"size_n, size_k = w.shapeassert group_size in [-1, 128, size_k], f"Unsupported groupsize = {group_size}"orig_device = w....
3
43
3
431
10
1,595
1,662
1,595
null
['s_group', 'max_q_val', 'half_q_val', 'group_size', 't_int8', 'orig_device', 'q_w', 's_channel', 'w', 'w_ref']
None
null
0
0
0
null
0
null
The function (_choose_qparams_and_quantize_affine_qqq) defined within the public class called public.The function start at line 1595 and ends at 1662. It contains 43 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [1595.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_qparams_gguf
def _choose_qparams_gguf(input: Optional[torch.Tensor],block_size: List[int],target_dtype: torch.dtype,) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:"""There are two sets of qparams: quantized_block_scale, quantized_block_min and super_block_scale_scale and super_block_min_scalethe relationship is ...
2
55
3
354
20
1,665
1,745
1,665
null
['shape_after_reduction', 'quant_max', 'super_block_scale_scale', 'super_block_scale_scale_view', 'max_val', 'min_val', 'quantized_block_scale', 'super_block_size', 'block_scale_absmax', 'input', 'block_min_absmax', 'super_block_min_scale_view', 'quantized_block_min', 'dtype', 'qparam_quant_min', 'block_min', 'super_bl...
None
null
0
0
0
null
0
null
The function (_choose_qparams_gguf) defined within the public class called public.The function start at line 1665 and ends at 1745. It contains 55 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [1665.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_gguf
def _quantize_gguf(input: torch.Tensor,block_size: List[int],target_dtype: torch.dtype,super_block_scale_scale: torch.Tensor,super_block_min_scale: torch.Tensor,quantized_block_scale: torch.Tensor,quantized_block_min: torch.Tensor,) -> torch.Tensor:assert target_dtype == torch.uint4# step 1: first order quantization# j...
3
50
7
236
12
1,748
1,807
1,748
null
['input', 'block_qparam_shape_after_reduction', 'int_data', 'block_min', 'quantized_block_min', 'super_block_min_scale', 'quantized_block_scale', 'super_block_size', 'super_block_qparam_shape_after_reduction', 'super_block_scale_scale', 'original_shape', 'block_scale']
None
null
0
0
0
null
0
null
The function (_quantize_gguf) defined within the public class called public.The function start at line 1748 and ends at 1807. It contains 50 lines of code and it has a cyclomatic complexity of 3. It takes 7 parameters, represented as [1748.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_gguf
def _dequantize_gguf(input: torch.Tensor,block_size: List[int],target_dtype: torch.dtype,super_block_scale_scale: torch.Tensor,super_block_min_scale: torch.Tensor,quantized_block_scale: torch.Tensor,quantized_block_min: torch.Tensor,output_dtype: Optional[torch.dtype] = None,) -> torch.Tensor:# step 1. reshape input an...
4
52
8
253
12
1,810
1,870
1,810
null
['input', 'block_qparam_shape_after_reduction', 'block_min', 'dequant', 'quantized_block_min', 'super_block_min_scale', 'quantized_block_scale', 'super_block_size', 'super_block_qparam_shape_after_reduction', 'super_block_scale_scale', 'original_shape', 'block_scale']
None
null
0
0
0
null
0
null
The function (_dequantize_gguf) defined within the public class called public.The function start at line 1810 and ends at 1870. It contains 52 lines of code and it has a cyclomatic complexity of 4. It takes 8 parameters, represented as [1810.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_qqq.reshape_w
def reshape_w(w):w = w.reshape((size_n, size_k)).contiguous()return w
1
3
1
23
0
1,898
1,900
1,898
null
[]
None
null
0
0
0
null
0
null
The function (_dequantize_affine_qqq.reshape_w) defined within the public class called public.The function start at line 1898 and ends at 1900. 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
_dequantize_affine_qqq
def _dequantize_affine_qqq(w: torch.Tensor,s_group: torch.Tensor,s_channel: torch.Tensor,num_bits: int,group_size: int,output_dtype: Optional[torch.dtype] = None,):assert num_bits == 4, f"Unsupported num_bits = {num_bits}"size_n, size_k = w.shapeassert group_size in [-1, 128, size_k], f"Unsupported groupsize = {group_s...
4
29
6
200
7
1,873
1,913
1,873
null
['s_group', 'max_q_val', 'w_dq', 'half_q_val', 'group_size', 's_channel', 'w']
None
null
0
0
0
null
0
null
The function (_dequantize_affine_qqq) defined within the public class called public.The function start at line 1873 and ends at 1913. It contains 29 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [1873.0] and does not return any value..
pytorch_ao
public
public
0
0
_shrink_lp_op
def _shrink_lp_op(x: torch.Tensor, beta: float, lp_norm: float) -> torch.Tensor:if lp_norm == 1:return torch.sign(x) * torch.nn.functional.relu(torch.abs(x) - 1.0 / beta)else:return torch.sign(x) * torch.nn.functional.relu(torch.abs(x) - (1.0 / beta) * torch.pow(torch.abs(x), lp_norm - 1))
2
7
3
104
0
1,919
1,925
1,919
null
[]
None
null
0
0
0
null
0
null
The function (_shrink_lp_op) defined within the public class called public.The function start at line 1919 and ends at 1925. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [1919.0] and does not return any value..
pytorch_ao
public
public
0
0
optimize_weights_proximal_legacy
def optimize_weights_proximal_legacy(tensor: torch.Tensor,scale: torch.Tensor,zero: torch.Tensor,min_max: list,axis: int = 0,dtype: Union[torch.dtype, None] = None,device: Union[str, None] = None,verbose: bool = False,opt_params: dict = {"lp_norm": 0.7,"beta": 1e1,"kappa": 1.01,"iters": 20,"early_stop": True,},) -> tup...
8
51
13
417
10
1,930
1,987
1,930
null
['current_error', 'zero', 'W_f', 'best_error', 'W_e', 'device', 'W_r', 'scale', 'dtype', 'W_q']
None
null
0
0
0
null
0
null
The function (optimize_weights_proximal_legacy) defined within the public class called public.The function start at line 1930 and ends at 1987. It contains 51 lines of code and it has a cyclomatic complexity of 8. It takes 13 parameters, represented as [1930.0] and does not return any value..
pytorch_ao
public
public
0
0
_is_divisible
def _is_divisible(val1: int, val2: int) -> bool:return int(val2 * math.ceil(val1 / val2)) == val1
1
2
2
29
0
1,991
1,992
1,991
null
[]
None
null
0
0
0
null
0
null
The function (_is_divisible) defined within the public class called public.The function start at line 1991 and ends at 1992. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1991.0] and does not return any value..
pytorch_ao
public
public
0
0
_convert_to_affinequantized_format
def _convert_to_affinequantized_format(W_q: torch.Tensor,scale: torch.Tensor,zero: torch.Tensor,nbits: int,shape: Union[List, Tuple, torch.Size],) -> Tuple:quant_min = 0quant_max = 2**nbits - 1mid_point = (quant_max + quant_min + 1) / 2zero_ao = ((mid_point - zero.float()) * scale.float()).to(zero.dtype)scale_ao = scal...
1
14
5
105
6
1,996
2,009
1,996
null
['zero_ao', 'scale_ao', 'mid_point', 'quant_max', 'quant_min', 'W_q_ao']
None
null
0
0
0
null
0
null
The function (_convert_to_affinequantized_format) defined within the public class called public.The function start at line 1996 and ends at 2009. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [1996.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_qparams_and_quantize_affine_hqq
def _choose_qparams_and_quantize_affine_hqq(tensor: torch.Tensor,nbits: float = 4,group_size: int = 64,optimize: bool = True,axis: int = 1,compute_dtype: torch.dtype = torch.float16,device: str = "cuda",verbose: bool = False,# to check the optimizer errorraw_output: bool = False,# If True, it will return the quant para...
8
66
10
520
10
2,013
2,126
2,013
null
['zero', '_min', 'max_v', 'min_max', 'shape', 'scale', 'min_v', 'W_q', 'W', '_max']
None
null
0
0
0
null
0
null
The function (_choose_qparams_and_quantize_affine_hqq) defined within the public class called public.The function start at line 2013 and ends at 2126. It contains 66 lines of code and it has a cyclomatic complexity of 8. It takes 10 parameters, represented as [2013.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_qparams_and_quantize_scale_only_hqq.round_det
def round_det(x: torch.Tensor) -> torch.Tensor:# ties-to-even; fine for PTQreturn x.round()
1
2
1
19
0
2,169
2,171
2,169
null
[]
None
null
0
0
0
null
0
null
The function (_choose_qparams_and_quantize_scale_only_hqq.round_det) defined within the public class called public.The function start at line 2169 and ends at 2171. 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
_choose_qparams_and_quantize_scale_only_hqq.round_stoch
def round_stoch(x: torch.Tensor) -> torch.Tensor:# unbiased stochastic roundingreturn torch.floor(x + torch.rand_like(x))
1
2
1
27
0
2,173
2,175
2,173
null
[]
None
null
0
0
0
null
0
null
The function (_choose_qparams_and_quantize_scale_only_hqq.round_stoch) defined within the public class called public.The function start at line 2173 and ends at 2175. 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
_choose_qparams_and_quantize_scale_only_hqq
def _choose_qparams_and_quantize_scale_only_hqq(hp_tensor: torch.Tensor,block_size: List[int],qmin: int,qmax: int,*,iters: int = 20,stochastic: bool = False,early_stop_tol: float = 1e-5,) -> Tuple[torch.Tensor, torch.Tensor]:"""Half-Quadratic Quantization (scale-only, symmetric) for 2D weights with row-wise blocks.- hp...
7
51
7
434
16
2,130
2,219
2,130
null
['num', 'compute_eps', '_r', 'qabs', 'den', 'n_groups', 'group_size', 'rel', 'scale', 'prev_scale', 'qdata', 'out_dtype', 'Qg', 'W', 'compute_dtype', 'Wg']
None
null
0
0
0
null
0
null
The function (_choose_qparams_and_quantize_scale_only_hqq) defined within the public class called public.The function start at line 2130 and ends at 2219. It contains 51 lines of code and it has a cyclomatic complexity of 7. It takes 7 parameters, represented as [2130.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_qparams_affine_floatx
def _choose_qparams_affine_floatx(tensor: torch.Tensor, ebits: int, mbits: int) -> torch.Tensor:"""Choose quantization parameters for floatx quantization.Calculates scale parameter for quantizing to custom floating point format.Args:tensor: Input tensor to quantize (float32, float16, or bfloat16)ebits: Number of expone...
1
11
3
99
5
2,222
2,255
2,222
null
['tensor', 'exp_bias', 'scale', 'dtype', 'max_normal']
None
null
0
0
0
null
0
null
The function (_choose_qparams_affine_floatx) defined within the public class called public.The function start at line 2222 and ends at 2255. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [2222.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_floatx
def _quantize_affine_floatx(tensor: torch.Tensor, scale: torch.Tensor, ebits: int, mbits: int) -> torch.Tensor:"""Quantizes the float32 high precision floating point tensor to low precision floating point number andconverts the result to unpacked floating point format with the format of 00SEEEMM (for fp6_e3m2) where S ...
1
6
4
57
2
2,258
2,266
2,258
null
['tensor', 'tensor_floatx']
None
null
0
0
0
null
0
null
The function (_quantize_affine_floatx) defined within the public class called public.The function start at line 2258 and ends at 2266. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [2258.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_floatx
def _dequantize_affine_floatx(tensor: torch.Tensor,scale: torch.Tensor,ebits: int,mbits: int,output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:tensor = _floatx_unpacked_to_f32(tensor, ebits, mbits)tensor = tensor * scale.float().view(-1, 1)tensor = tensor.to(dtype=output_dtype)return tensor
1
11
5
77
1
2,269
2,279
2,269
null
['tensor']
None
null
0
0
0
null
0
null
The function (_dequantize_affine_floatx) defined within the public class called public.The function start at line 2269 and ends at 2279. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [2269.0] and does not return any value..
pytorch_ao
public
public
0
0
_choose_scale_float8
def _choose_scale_float8(tensor: torch.Tensor,block_size: List[int],float8_dtype: torch.dtype = torch.float8_e4m3fn,scale_dtype: torch.dtype = torch.float32,hp_value_lb: Optional[float] = None,hp_value_ub: Optional[float] = None,) -> torch.Tensor:"""Calculates float8 scaling factor for the given high precision tensor.A...
7
31
6
252
5
2,283
2,329
2,283
null
['max_abs', 'scale', 'tensor_reshaped', 'output_shape', 'quant_max']
None
null
0
0
0
null
0
null
The function (_choose_scale_float8) defined within the public class called public.The function start at line 2283 and ends at 2329. It contains 31 lines of code and it has a cyclomatic complexity of 7. It takes 6 parameters, represented as [2283.0] and does not return any value..
pytorch_ao
public
public
0
0
_maybe_expand_scale_to_tensor_shape
def _maybe_expand_scale_to_tensor_shape(scale: torch.Tensor, target_shape: torch.Size) -> torch.Tensor:"""Expand a scale tensor to match the target tensor shape for block-wise quantization.If this is rowwise quantization, however, just return the scale as is.Args:scale (torch.Tensor): Scale tensor with shape correspond...
11
29
2
168
2
2,332
2,385
2,332
null
['expanded_scale', 'block_sizes']
None
null
0
0
0
null
0
null
The function (_maybe_expand_scale_to_tensor_shape) defined within the public class called public.The function start at line 2332 and ends at 2385. It contains 29 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [2332.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_float8
def _quantize_affine_float8(tensor: torch.Tensor,scale: torch.Tensor,float8_dtype: torch.dtype = torch.float8_e4m3fn,) -> torch.Tensor:"""Quantizes the high precision floating point tensor to a float8 tensor, using the given scaling factor."""tensor_fp32 = tensor.to(torch.float32)# Expand scale to match tensor dimensio...
1
11
3
90
5
2,388
2,404
2,388
null
['tensor_fp32', 'scale_expanded', 'max_value', 'tensor_clamped', 'tensor_scaled']
None
null
0
0
0
null
0
null
The function (_quantize_affine_float8) defined within the public class called public.The function start at line 2388 and ends at 2404. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [2388.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_float8
def _dequantize_affine_float8(tensor: torch.Tensor,scale: torch.Tensor,output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"""Dequantizes the float8 tensor to high precision tensor."""fp8_tensor = tensor.to(torch.float32)# Expand scale to match tensor dimensions for block-wise quantizationscale_expanded = _mayb...
1
9
3
63
3
2,407
2,421
2,407
null
['scale_expanded', 'hp_tensor', 'fp8_tensor']
None
null
0
0
0
null
0
null
The function (_dequantize_affine_float8) defined within the public class called public.The function start at line 2407 and ends at 2421. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [2407.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_float8_non_decomposed
def _quantize_affine_float8_non_decomposed(tensor: torch.Tensor,scale: torch.Tensor,float8_dtype: torch.dtype = torch.float8_e4m3fn,) -> torch.Tensor:"""Quantizes the high precision floating point tensor to a float8 tensor, using the given scaling factor."""return _quantize_affine_float8(tensor=tensor,scale=scale,float...
1
10
3
47
0
2,425
2,437
2,425
null
[]
None
null
0
0
0
null
0
null
The function (_quantize_affine_float8_non_decomposed) defined within the public class called public.The function start at line 2425 and ends at 2437. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [2425.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantize_affine_float8_meta
def _quantize_affine_float8_meta(tensor: torch.Tensor,scale: torch.Tensor,float8_dtype: torch.dtype = torch.float8_e4m3fn,) -> torch.Tensor:return torch.empty_like(tensor, dtype=float8_dtype)
1
6
3
41
0
2,441
2,446
2,441
null
[]
None
null
0
0
0
null
0
null
The function (_quantize_affine_float8_meta) defined within the public class called public.The function start at line 2441 and ends at 2446. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [2441.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_float8_non_decomposed
def _dequantize_affine_float8_non_decomposed(tensor: torch.Tensor,scale: torch.Tensor,output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:"""Dequantizes the float8 tensor to high precision tensor."""return _dequantize_affine_float8(tensor=tensor,scale=scale,output_dtype=output_dtype,)
1
10
3
47
0
2,450
2,462
2,450
null
[]
None
null
0
0
0
null
0
null
The function (_dequantize_affine_float8_non_decomposed) defined within the public class called public.The function start at line 2450 and ends at 2462. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [2450.0] and does not return any value..
pytorch_ao
public
public
0
0
_dequantize_affine_float8_meta
def _dequantize_affine_float8_meta(tensor: torch.Tensor,scale: torch.Tensor,output_dtype: torch.dtype = torch.float32,) -> torch.Tensor:return torch.empty_like(tensor, dtype=output_dtype)
1
6
3
41
0
2,466
2,471
2,466
null
[]
None
null
0
0
0
null
0
null
The function (_dequantize_affine_float8_meta) defined within the public class called public.The function start at line 2466 and ends at 2471. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [2466.0] and does not return any value..
pytorch_ao
public
public
0
0
get_scale
def get_scale(X_absmax, W_absmax, alpha=0.5):"""Calculate the scale based on abs(max(X)), abs(max(W)), and alpha.Args:X_absmax (torch.Tensor): Absolute maximum values of the input tensor X.W_absmax (torch.Tensor): Absolute maximum values of the weight tensor W.alpha (float, optional): Scaling factor. Defaults to 0.5.Re...
1
5
3
51
3
33
48
33
null
['div', 'X_pow', 'W_pow']
None
null
0
0
0
null
0
null
The function (get_scale) defined within the public class called public.The function start at line 33 and ends at 48. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [33.0] and does not return any value..
pytorch_ao
public
public
0
0
init_smoothquant_variables
def init_smoothquant_variables(self, alpha):self.calibrating = Trueself.x_running_abs_max = Noneself.register_buffer("smooth_scale", None)self.alpha = alpha# debug onlyself.debug_skip_scaling = False# self.debug_skip_scaling = True# Currently torch._int_mm cuBLAS underlying kernel does not work with# non-contiguous wei...
1
7
2
40
0
52
70
52
null
[]
None
null
0
0
0
null
0
null
The function (init_smoothquant_variables) defined within the public class called public.The function start at line 52 and ends at 70. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [52.0] and does not return any value..
pytorch_ao
public
public
0
0
update_x_running_abs_max
def update_x_running_abs_max(self, X):# update the running max of incoming activationsall_dims_except_last = tuple(range(len(X.shape) - 1))cur_abs_max = torch.amax(torch.abs(X), dim=all_dims_except_last)if self.x_running_abs_max is None:self.x_running_abs_max = cur_abs_maxelse:self.x_running_abs_max = torch.max(cur_abs...
2
7
2
68
0
72
79
72
null
[]
None
null
0
0
0
null
0
null
The function (update_x_running_abs_max) defined within the public class called public.The function start at line 72 and ends at 79. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [72.0] and does not return any value..
pytorch_ao
public
public
0
0
get_scaled_quantized_w
def get_scaled_quantized_w(self):# inferenceassert self.smooth_scale is not None, ("self.smooth_scale is None, did you turn on inference?")W = self.weight# scale weight# in the future, this can be done ahead of time instead of# during inferenceif not self.debug_skip_scaling:# TODO(future): do below in `to_inference` in...
2
14
1
90
0
81
104
81
null
[]
None
null
0
0
0
null
0
null
The function (get_scaled_quantized_w) defined within the public class called public.The function start at line 81 and ends at 104. 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
to_inference
def to_inference(self):raise NotImplementedError()
1
2
1
9
0
106
107
106
null
[]
None
null
0
0
0
null
0
null
The function (to_inference) defined within the public class called public.The function start at line 106 and ends at 107. 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..