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
_apply_fn_to_data
def _apply_fn_to_data(self, fn):return self.__class__(fn(self.packed_weight),fn(self.scale_and_zero) if self.scale_and_zero is not None else None,self.transposed,self._layout,fn(self.scale) if self.scale is not None else None,fn(self.zero) if self.zero is not None else None,)
4
9
2
76
0
301
309
301
null
[]
None
null
0
0
0
null
0
null
The function (_apply_fn_to_data) defined within the public class called public.The function start at line 301 and ends at 309. It contains 9 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [301.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):kwargs = {} if kwargs is None else kwargsif func is aten.detach.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._apply_fn_to_data(torch.detach))if func is aten.clone.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._appl...
9
55
5
447
0
312
378
312
null
[]
None
null
0
0
0
null
0
null
The function (__torch_dispatch__) defined within the public class called public.The function start at line 312 and ends at 378. It contains 55 lines of code and it has a cyclomatic complexity of 9. It takes 5 parameters, represented as [312.0] and does not return any value..
pytorch_ao
public
public
0
0
get_plain
def get_plain(self) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:from torchao.quantization.quant_primitives import (_quantize_affine_tinygemm,quantize_affine,)from torchao.quantization.utils import unpack_tinygemm_scales_and_zerosif self.scale_and_zero is not None:scale, zero = unpack_tinygemm_scales_and_zeros(se...
4
61
1
373
0
382
445
382
null
[]
None
null
0
0
0
null
0
null
The function (get_plain) defined within the public class called public.The function start at line 382 and ends at 445. It contains 61 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
get_layout
def get_layout(self) -> Layout:return self._layout
1
2
1
11
0
447
448
447
null
[]
None
null
0
0
0
null
0
null
The function (get_layout) defined within the public class called public.The function start at line 447 and ends at 448. 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
dequantize
def dequantize(self, output_dtype: Optional[torch.dtype] = None) -> torch.Tensor:if output_dtype is None:output_dtype = self.dtypeint_data, s_group, s_channel = self.tensor_impl.get_plain()nbits = int(math.log2(self.quant_max - self.quant_min + 1))group_size = max(self.block_size)return _dequantize_affine_qqq(int_data,...
2
9
2
85
0
44
53
44
null
[]
None
null
0
0
0
null
0
null
The function (dequantize) defined within the public class called public.The function start at line 44 and ends at 53. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [44.0] and does not return any value..
pytorch_ao
public
public
0
0
from_hp_to_intx
def from_hp_to_intx(cls,input_float: torch.Tensor,block_size: Tuple[int, ...],quant_min: Optional[int] = None,quant_max: Optional[int] = None,zero_point_domain: ZeroPointDomain = ZeroPointDomain.INT,_layout: Optional[Layout] = None,):"""Converts a floating point tensor to a Marlin QQQ quantized tensor."""if zero_point_...
2
29
7
160
0
56
85
56
null
[]
None
null
0
0
0
null
0
null
The function (from_hp_to_intx) defined within the public class called public.The function start at line 56 and ends at 85. It contains 29 lines of code and it has a cyclomatic complexity of 2. It takes 7 parameters, represented as [56.0] and does not return any value..
pytorch_ao
public
public
0
0
__new__
def __new__(cls,int_data: torch.Tensor,s_group: torch.Tensor,s_channel: torch.Tensor,_layout: Layout,original_shape: torch.Size,group_size: int,num_bits: int,):kwargs = {}kwargs["device"] = int_data.devicekwargs["layout"] = (kwargs.get("layout") if kwargs.get("layout", False) else int_data.layout)kwargs["dtype"] = int_...
2
19
8
113
0
116
134
116
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 116 and ends at 134. It contains 19 lines of code and it has a cyclomatic complexity of 2. It takes 8 parameters, represented as [116.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,int_data: torch.Tensor,s_group: torch.Tensor,s_channel: torch.Tensor,_layout: Layout,original_shape: torch.Size,group_size: int,num_bits: int,):self.int_data = int_dataself.s_group = s_groupself.s_channel = s_channelself._layout = _layoutself.original_shape = original_shapeself.group_size = group_size...
1
17
8
77
0
136
152
136
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 136 and ends at 152. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [136.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):kwargs = {} if kwargs is None else kwargsif func is aten.detach.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._apply_fn_to_data(torch.detach))raise NotImplementedError(f"MarlinQQQAQTTensorImpl dispatch: attempting to run {func}, this is not...
3
9
5
59
0
155
165
155
null
[]
None
null
0
0
0
null
0
null
The function (__torch_dispatch__) defined within the public class called public.The function start at line 155 and ends at 165. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [155.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self):return ["int_data", "s_group", "s_channel"], [self._layout,self.original_shape,self.group_size,self.num_bits,]
1
7
1
32
0
167
173
167
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_flatten__) defined within the public class called public.The function start at line 167 and ends at 173. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
__tensor_unflatten__
def __tensor_unflatten__(cls, tensor_data_dict, tensor_attributes, outer_size, outer_stride):int_data = tensor_data_dict["int_data"]s_group = tensor_data_dict["s_group"]s_channel = tensor_data_dict["s_channel"]_layout, original_shape, group_size, num_bits = tensor_attributesreturn cls(int_data, s_group, s_channel, _lay...
1
10
5
57
0
176
185
176
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_unflatten__) defined within the public class called public.The function start at line 176 and ends at 185. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [176.0] and does not return any value..
pytorch_ao
public
public
0
0
get_plain
def get_plain(self):from torchao.quantization.marlin_qqq import (unpack_from_marlin_qqq,)int_data_expanded, s_group_expanded, s_channel_expanded = (unpack_from_marlin_qqq(self.int_data,self.s_group,self.s_channel,self.original_shape,self.num_bits,self.group_size,))int_data_expanded_t = int_data_expanded.t()s_group_expa...
1
18
1
78
0
187
205
187
null
[]
None
null
0
0
0
null
0
null
The function (get_plain) defined within the public class called public.The function start at line 187 and ends at 205. It contains 18 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
from_plain
def from_plain(cls,int_data: torch.Tensor,s_group: torch.Tensor,s_channel: torch.Tensor,_layout: Layout,):from torchao.quantization.marlin_qqq import (const,pack_to_marlin_qqq,)assert isinstance(_layout, MarlinQQQLayout)# Linear layers are (in_features, out_features) but the int_data that is reaching this point# is (ou...
10
60
5
290
0
208
281
208
null
[]
None
null
0
0
0
null
0
null
The function (from_plain) defined within the public class called public.The function start at line 208 and ends at 281. It contains 60 lines of code and it has a cyclomatic complexity of 10. It takes 5 parameters, represented as [208.0] and does not return any value..
pytorch_ao
public
public
0
0
get_layout
def get_layout(self) -> Layout:return self._layout
1
2
1
11
0
283
284
283
null
[]
None
null
0
0
0
null
0
null
The function (get_layout) defined within the public class called public.The function start at line 283 and ends at 284. 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
_apply_fn_to_data
def _apply_fn_to_data(self, fn):self.int_data = fn(self.int_data)self.s_group = fn(self.s_group)self.s_channel = fn(self.s_channel)return self
1
5
2
39
0
286
290
286
null
[]
None
null
0
0
0
null
0
null
The function (_apply_fn_to_data) defined within the public class called public.The function start at line 286 and ends at 290. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [286.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_int8_act_int4_weight_marlin_qqq_check
def _linear_int8_act_int4_weight_marlin_qqq_check(input_tensor, weight_tensor, bias):return (isinstance(input_tensor, AffineQuantizedTensor)and _aqt_is_int8_reduced_range(input_tensor)and input_tensor.dtype == torch.float16and input_tensor.tensor_impl.scale.dtype == torch.float32and len(input_tensor.tensor_impl.scale.s...
9
12
3
98
0
293
304
293
null
[]
None
null
0
0
0
null
0
null
The function (_linear_int8_act_int4_weight_marlin_qqq_check) defined within the public class called public.The function start at line 293 and ends at 304. It contains 12 lines of code and it has a cyclomatic complexity of 9. It takes 3 parameters, represented as [293.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_int8_act_int4_weight_marlin_qqq_impl
def _linear_int8_act_int4_weight_marlin_qqq_impl(input_tensor, weight_tensor, bias):from torchao.ops import marlin_qqq_gemmfrom torchao.quantization.marlin_qqq import marlin_qqq_workspaceassert isinstance(input_tensor, AffineQuantizedTensor)assert isinstance(weight_tensor, AffineQuantizedTensor)input = input_tensor.ten...
2
32
3
206
12
307
348
307
null
['s_group', 'out', 'input', 'workspace_qqq', 'size_n', 'input_scale', 'size_k', 's_channel', 'size_m', 'input_2d', 'original_shape', 'w_int4']
None
null
0
0
0
null
0
null
The function (_linear_int8_act_int4_weight_marlin_qqq_impl) defined within the public class called public.The function start at line 307 and ends at 348. It contains 32 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [307.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_fp_act_int4_weight_sparse_marlin_check
def _linear_fp_act_int4_weight_sparse_marlin_check(input_tensor, weight_tensor, bias):return (isinstance(weight_tensor, AffineQuantizedTensor)and _aqt_is_tensor_core_tile_uint4(weight_tensor)and input_tensor.dtype == torch.float16and len(weight_tensor.shape) == 2and weight_tensor.zero_point_domain == ZeroPointDomain.IN...
6
9
3
57
0
27
35
27
null
[]
None
null
0
0
0
null
0
null
The function (_linear_fp_act_int4_weight_sparse_marlin_check) defined within the public class called public.The function start at line 27 and ends at 35. It contains 9 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [27.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_fp_act_int4_weight_sparse_marlin_impl
def _linear_fp_act_int4_weight_sparse_marlin_impl(input_tensor, weight_tensor, bias):from torchao.ops import marlin_24_gemmfrom torchao.sparsity.marlin import marlin_24_workspaceassert isinstance(weight_tensor, AffineQuantizedTensor)sparse_w_int4 = weight_tensor.tensor_impl.int_datascale = weight_tensor.tensor_impl.sca...
2
29
3
181
11
38
75
38
null
['out', 'original_shape', 'size_n', 'workspace_24', 'size_k', 'scale', 'num_bits', 'size_m', 'input_2d', 'meta', 'sparse_w_int4']
None
null
0
0
0
null
0
null
The function (_linear_fp_act_int4_weight_sparse_marlin_impl) defined within the public class called public.The function start at line 38 and ends at 75. It contains 29 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [38.0] and does not return any value..
pytorch_ao
public
public
0
0
pre_process
def pre_process(self, input: torch.Tensor) -> torch.Tensor:"""Preprocess the input tensor to be in the correct format for the Marlin sparse kernel.- 1º: the input tensor is transposed since the linear layer keeps the weights in a transposed format- 2º: tensor is injected with 2:4 sparsity- 3º: transposes it again becau...
1
5
2
50
0
91
107
91
null
[]
None
null
0
0
0
null
0
null
The function (pre_process) defined within the public class called public.The function start at line 91 and ends at 107. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [91.0] and does not return any value..
pytorch_ao
public
public
0
0
__new__
def __new__(cls,int_data: torch.Tensor,scale: torch.Tensor,zero: torch.Tensor,meta: torch.Tensor,_layout: Layout,original_shape: torch.Size,group_size: int,num_bits: int,):kwargs = {}kwargs["device"] = int_data.devicekwargs["layout"] = (kwargs.get("layout") if kwargs.get("layout", False) else int_data.layout)kwargs["dt...
2
20
9
119
0
130
149
130
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 130 and ends at 149. It contains 20 lines of code and it has a cyclomatic complexity of 2. It takes 9 parameters, represented as [130.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,int_data: torch.Tensor,scale: torch.Tensor,zero: torch.Tensor,meta: torch.Tensor,_layout: Layout,original_shape: torch.Size,group_size: int,num_bits: int,):warnings.warn("Models quantized with version 1 of Int4WeightOnlyConfig is deprecated and will no longer be supported in a future release, please u...
1
23
9
99
0
151
173
151
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 151 and ends at 173. It contains 23 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [151.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):kwargs = {} if kwargs is None else kwargsif func is aten.detach.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._apply_fn_to_data(torch.detach))raise NotImplementedError(f"MarlinSparseAQTTensorImpl dispatch: attempting to run {func}, this is ...
3
9
5
59
0
176
186
176
null
[]
None
null
0
0
0
null
0
null
The function (__torch_dispatch__) defined within the public class called public.The function start at line 176 and ends at 186. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [176.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self):return ["int_data", "scale", "zero", "meta"], [self._layout,self.original_shape,self.group_size,self.num_bits,]
1
7
1
34
0
188
194
188
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_flatten__) defined within the public class called public.The function start at line 188 and ends at 194. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
__tensor_unflatten__
def __tensor_unflatten__(cls, tensor_data_dict, tensor_attributes, outer_size, outer_stride):int_data = tensor_data_dict["int_data"]scale = tensor_data_dict["scale"]zero = tensor_data_dict["zero"]meta = tensor_data_dict["meta"]_layout, original_shape, group_size, num_bits = tensor_attributesreturn cls(int_data,scale,ze...
1
18
5
66
0
197
214
197
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_unflatten__) defined within the public class called public.The function start at line 197 and ends at 214. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [197.0] and does not return any value..
pytorch_ao
public
public
0
0
get_plain
def get_plain(self):from torchao.sparsity.marlin import (unpack_from_marlin_24,)int_data_expanded, scales_expanded = unpack_from_marlin_24(self.int_data,self.scale,self.meta,self.original_shape,self.group_size,self.num_bits,)int_data_expanded_t = int_data_expanded.t()scales_expanded_t = scales_expanded.t()return int_da...
1
15
1
69
0
216
231
216
null
[]
None
null
0
0
0
null
0
null
The function (get_plain) defined within the public class called public.The function start at line 216 and ends at 231. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
from_plain
def from_plain(cls,int_data: torch.Tensor,scale: torch.Tensor,zero: torch.Tensor,_layout: Layout,):from torchao.sparsity.marlin import (const,pack_to_marlin_24,)assert isinstance(_layout, MarlinSparseLayout)# Linear layers are (in_features, out_features) but the int_data that is reaching this point# is (out_features, i...
10
53
5
246
0
234
305
234
null
[]
None
null
0
0
0
null
0
null
The function (from_plain) defined within the public class called public.The function start at line 234 and ends at 305. It contains 53 lines of code and it has a cyclomatic complexity of 10. It takes 5 parameters, represented as [234.0] and does not return any value..
pytorch_ao
public
public
0
0
get_layout
def get_layout(self) -> Layout:return self._layout
1
2
1
11
0
307
308
307
null
[]
None
null
0
0
0
null
0
null
The function (get_layout) defined within the public class called public.The function start at line 307 and ends at 308. 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
_apply_fn_to_data
def _apply_fn_to_data(self, fn):self.int_data = fn(self.int_data)self.scale = fn(self.scale)self.zero = fn(self.zero)self.meta = fn(self.meta)return self
1
6
2
49
0
310
315
310
null
[]
None
null
0
0
0
null
0
null
The function (_apply_fn_to_data) defined within the public class called public.The function start at line 310 and ends at 315. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [310.0] and does not return any value..
pytorch_ao
public
public
0
0
target_to_str
def target_to_str(target: Target) -> str:target_to_str = {t: s for t, s in _TARGET_AND_STR}return target_to_str[target]
2
3
1
27
1
58
60
58
null
['target_to_str']
None
null
0
0
0
null
0
null
The function (target_to_str) defined within the public class called public.The function start at line 58 and ends at 60. 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
target_from_str
def target_from_str(target: str) -> Target:str_to_target = {s: t for t, s in _TARGET_AND_STR}if target.lower() in str_to_target:return str_to_target[target.lower()]raise ValueError(f"Invalid target: {target}")
3
5
1
46
1
63
67
63
null
['str_to_target']
None
null
0
0
0
null
0
null
The function (target_from_str) defined within the public class called public.The function start at line 63 and ends at 67. It contains 5 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,target: Union[str, Target] = "auto",):warnings.warn("Models quantized with version 1 of IntxWeightOnlyConfig/Int8DynamicActivationIntxWeightConfig are deprecated and will no longer be supported in a future release, please upgrade torchao and quantize again, or download a newer torchao checkpoint, see ...
2
14
2
82
0
77
94
77
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 77 and ends at 94. It contains 14 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [77.0] and does not return any value..
pytorch_ao
public
public
0
0
extra_repr
def extra_repr(self):return f"group_size={self.group_size}, bit_width={self.bit_width}, has_weight_zeros={self.has_weight_zeros}, has_bias={self.has_bias}, target={self.target}"
1
2
1
8
0
96
97
96
null
[]
None
null
0
0
0
null
0
null
The function (extra_repr) defined within the public class called public.The function start at line 96 and ends at 97. 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
has_params_set
def has_params_set(self) -> bool:return ((self.bit_width is not None)and (self.group_size is not None)and (self.has_weight_zeros is not None)and (self.has_bias is not None)and (self.target is not None))
5
8
1
54
0
99
106
99
null
[]
None
null
0
0
0
null
0
null
The function (has_params_set) defined within the public class called public.The function start at line 99 and ends at 106. 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
set_params
def set_params(self, bit_width: int, group_size: int, has_weight_zeros: bool, has_bias: bool):assert bit_width >= 1 and bit_width <= 8, "bit_width must be 1 to 8"assert group_size >= 1, f"group_size must be positive, got {group_size}"self.bit_width = bit_widthself.group_size = group_sizeself.has_weight_zeros = has_weig...
2
10
5
64
0
108
118
108
null
[]
None
null
0
0
0
null
0
null
The function (set_params) defined within the public class called public.The function start at line 108 and ends at 118. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [108.0] and does not return any value..
pytorch_ao
public
public
0
0
__new__
def __new__(cls,packed_weight: torch.Tensor,_layout: Layout,):kwargs = {}kwargs["device"] = packed_weight.devicekwargs["dtype"] = packed_weight.dtypeassert not packed_weight.requires_gradkwargs["requires_grad"] = Falseshape = packed_weight.shapereturn torch.Tensor._make_wrapper_subclass(cls, shape, **kwargs)# type: ign...
1
12
3
66
0
123
134
123
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 123 and ends at 134. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [123.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,packed_weight: torch.Tensor,_layout: Layout,):assert isinstance(_layout, PackedLinearInt8DynamicActivationIntxWeightLayout)self.packed_weight = packed_weightself._layout = _layout
1
8
3
33
0
136
143
136
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 136 and ends at 143. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [136.0] and does not return any value..
pytorch_ao
public
public
0
0
__repr__
def __repr__(self):return f"{self.__class__.__name__}(packed_weight={str(self.packed_weight)}, layout={self.get_layout()})"
1
2
1
8
0
145
146
145
null
[]
None
null
0
0
0
null
0
null
The function (__repr__) defined within the public class called public.The function start at line 145 and ends at 146. 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
get_layout
def get_layout(self) -> Layout:return self._layout
1
2
1
11
0
148
149
148
null
[]
None
null
0
0
0
null
0
null
The function (get_layout) defined within the public class called public.The function start at line 148 and ends at 149. 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
get_plain
def get_plain(self) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]:raise NotImplementedError("get_plain is not implemented for PackedLinearInt8DynamicActivationIntxWeightAQTTensorImpl")
1
4
1
28
0
151
154
151
null
[]
None
null
0
0
0
null
0
null
The function (get_plain) defined within the public class called public.The function start at line 151 and ends at 154. 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
from_plain
def from_plain(cls,int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],layout: Layout,bias: Optional[torch.Tensor] = None,*,validate_inputs: bool = True,):assert isinstance(layout, PackedLinearInt8DynamicActivationIntxWeightLayout)assert layout.target in [t for t, _ in _TARGET_AND_STR], (f"Une...
20
116
7
774
0
157
291
157
null
[]
None
null
0
0
0
null
0
null
The function (from_plain) defined within the public class called public.The function start at line 157 and ends at 291. It contains 116 lines of code and it has a cyclomatic complexity of 20. It takes 7 parameters, represented as [157.0] and does not return any value..
pytorch_ao
public
public
0
0
_apply_fn_to_data
def _apply_fn_to_data(self, fn):self.packed_weight = fn(self.packed_weight)return self
1
3
2
19
0
293
295
293
null
[]
None
null
0
0
0
null
0
null
The function (_apply_fn_to_data) defined within the public class called public.The function start at line 293 and ends at 295. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [293.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):kwargs = {} if kwargs is None else kwargsif func is torch.ops.aten.detach.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._apply_fn_to_data(torch.detach))if func is torch.ops.aten.clone.default:return return_and_correct_aliasing(func, args, k...
4
13
5
97
0
298
312
298
null
[]
None
null
0
0
0
null
0
null
The function (__torch_dispatch__) defined within the public class called public.The function start at line 298 and ends at 312. It contains 13 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [298.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self):return ["packed_weight"], [self.get_layout()]
1
2
1
17
0
314
315
314
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_flatten__) defined within the public class called public.The function start at line 314 and ends at 315. 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
__tensor_unflatten__
def __tensor_unflatten__(cls, tensor_data_dict, tensor_attributes, outer_size, outer_stride):packed_weight = tensor_data_dict["packed_weight"](layout,) = tensor_attributesreturn cls(packed_weight, layout)
1
6
5
32
0
318
323
318
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_unflatten__) defined within the public class called public.The function start at line 318 and ends at 323. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [318.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_check
def _linear_check(input_tensor, weight_tensor, bias):layout = weight_tensor.tensor_impl.get_layout()return isinstance(layout, PackedLinearInt8DynamicActivationIntxWeightLayout)
1
3
3
25
1
326
328
326
null
['layout']
None
null
0
0
0
null
0
null
The function (_linear_check) defined within the public class called public.The function start at line 326 and ends at 328. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [326.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_impl._impl_2d_non_aten
def _impl_2d_non_aten(input_tensor, weight_tensor):assert input_tensor.dim() == 2assert weight_tensor.dim() == 2m, k = input_tensor.shapen, k_ = weight_tensor.shapeassert k_ == kgroup_size = weight_tensor.tensor_impl.get_layout().group_sizeargs = (input_tensor,weight_tensor.tensor_impl.packed_weight,group_size,n,k,)ass...
1
21
2
124
0
332
356
332
null
[]
None
null
0
0
0
null
0
null
The function (_linear_impl._impl_2d_non_aten) defined within the public class called public.The function start at line 332 and ends at 356. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [332.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_impl._impl_2d_aten
def _impl_2d_aten(input_tensor, weight_tensor):assert input_tensor.dim() == 2assert weight_tensor.dim() == 2m, k = input_tensor.shapen, k_ = weight_tensor.shapeassert k_ == kgroup_size = weight_tensor.tensor_impl.get_layout().group_sizepacked_weight = weight_tensor.tensor_impl.packed_weightreturn torch.ops.aten._dyn_qu...
1
11
2
78
0
358
370
358
null
[]
None
null
0
0
0
null
0
null
The function (_linear_impl._impl_2d_aten) defined within the public class called public.The function start at line 358 and ends at 370. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [358.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_impl
def _linear_impl(input_tensor, weight_tensor, bias):def _impl_2d_non_aten(input_tensor, weight_tensor):assert input_tensor.dim() == 2assert weight_tensor.dim() == 2m, k = input_tensor.shapen, k_ = weight_tensor.shapeassert k_ == kgroup_size = weight_tensor.tensor_impl.get_layout().group_sizeargs = (input_tensor,weight_...
6
27
3
179
8
331
401
331
null
['packed_weight', 'args', 'target', 'res', 'group_size', 'bit_width', '_impl_2d', 'lead_shape']
None
null
0
0
0
null
0
null
The function (_linear_impl) defined within the public class called public.The function start at line 331 and ends at 401. It contains 27 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [331.0] and does not return any value..
pytorch_ao
public
public
0
0
make_packed_linear_int8_dynamic_activation_intx_weight_tensor
def make_packed_linear_int8_dynamic_activation_intx_weight_tensor(int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],bias: Optional[torch.Tensor],data_dtype: torch.dtype,target: Union[str, Target] = "auto",*,validate_inputs: bool = True,) -> AffineQuantizedTensor:"""Constructs an AffineQuanti...
4
44
7
234
8
410
463
410
null
['zero_point_min', 'has_weight_zeros', 'layout', 'group_size', 'tensor_impl', 'zero_point_max', 'bit_width', 'has_bias']
None
null
0
0
0
null
0
null
The function (make_packed_linear_int8_dynamic_activation_intx_weight_tensor) defined within the public class called public.The function start at line 410 and ends at 463. It contains 44 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [410.0] and does not return any value..
pytorch_ao
public
public
0
0
_same_metadata
def _same_metadata(self: "PlainAQTTensorImpl", src: "PlainAQTTensorImpl") -> bool:return (isinstance(self, PlainAQTTensorImpl)and isinstance(src, PlainAQTTensorImpl)and self.shape == src.shapeand self.int_data.shape == src.int_data.shapeand self.scale.shape == src.scale.shapeand (self.zero_point is None and src.zero_po...
11
15
2
117
0
30
44
30
null
[]
None
null
0
0
0
null
0
null
The function (_same_metadata) defined within the public class called public.The function start at line 30 and ends at 44. It contains 15 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [30.0] and does not return any value..
pytorch_ao
public
public
0
0
__new__
def __new__(cls,int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],_layout: Layout,):kwargs = {}kwargs["device"] = int_data.devicekwargs["layout"] = (kwargs.get("layout") if kwargs.get("layout", False) else int_data.layout)kwargs["dtype"] = int_data.dtypekwargs["requires_grad"] = Falseshape =...
2
16
5
102
0
59
74
59
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 59 and ends at 74. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [59.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],_layout: Layout,):self.int_data = int_dataself.scale = scaleself.zero_point = zero_pointself._layout = _layout
1
11
5
51
0
76
86
76
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 76 and ends at 86. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [76.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self):if self.zero_point is None:return ["int_data", "scale"], [self._layout]return ["int_data", "scale", "zero_point"], [self._layout]
2
4
1
38
0
88
91
88
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_flatten__) defined within the public class called public.The function start at line 88 and ends at 91. It contains 4 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
__tensor_unflatten__
def __tensor_unflatten__(cls, tensor_data_dict, tensor_attributes, outer_size, outer_stride):int_data, scale, zero_point = (tensor_data_dict["int_data"],tensor_data_dict["scale"],tensor_data_dict.get("zero_point", None),)(_layout,) = tensor_attributesreturn cls(int_data, scale, zero_point, _layout)
1
10
5
57
0
94
103
94
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_unflatten__) defined within the public class called public.The function start at line 94 and ends at 103. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [94.0] and does not return any value..
pytorch_ao
public
public
0
0
to
def to(self, *args, **kwargs):kwargs = self._get_to_kwargs(*args, **kwargs)return self.__class__(self.int_data.to(kwargs["device"]),self.scale.to(kwargs["device"]),self.zero_point.to(kwargs["device"])if self.zero_point is not Noneelse None,self._layout,)
2
10
3
78
0
105
114
105
null
[]
None
null
0
0
0
null
0
null
The function (to) defined within the public class called public.The function start at line 105 and ends at 114. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [105.0] and does not return any value..
pytorch_ao
public
public
0
0
_apply_fn_to_data
def _apply_fn_to_data(self, fn):return self.__class__(fn(self.int_data),fn(self.scale),fn(self.zero_point) if self.zero_point is not None else None,self._layout,)
2
7
2
47
0
116
122
116
null
[]
None
null
0
0
0
null
0
null
The function (_apply_fn_to_data) defined within the public class called public.The function start at line 116 and ends at 122. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [116.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):kwargs = {} if kwargs is None else kwargsif func is aten.detach.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._apply_fn_to_data(torch.detach))elif func is aten.clone.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._ap...
13
62
5
424
0
125
193
125
null
[]
None
null
0
0
0
null
0
null
The function (__torch_dispatch__) defined within the public class called public.The function start at line 125 and ends at 193. It contains 62 lines of code and it has a cyclomatic complexity of 13. It takes 5 parameters, represented as [125.0] and does not return any value..
pytorch_ao
public
public
0
0
get_plain
def get_plain(self) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]:return self.int_data, self.scale, self.zero_point
1
2
1
35
0
197
198
197
null
[]
None
null
0
0
0
null
0
null
The function (get_plain) defined within the public class called public.The function start at line 197 and ends at 198. 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
get_layout
def get_layout(self) -> Layout:return self._layout
1
2
1
11
0
200
201
200
null
[]
None
null
0
0
0
null
0
null
The function (get_layout) defined within the public class called public.The function start at line 200 and ends at 201. 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
from_plain
def from_plain(cls,int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],_layout: Layout,):assert isinstance(_layout, PlainLayout)return cls(int_data, scale, zero_point, _layout)
1
9
5
49
0
204
212
204
null
[]
None
null
0
0
0
null
0
null
The function (from_plain) defined within the public class called public.The function start at line 204 and ends at 212. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [204.0] and does not return any value..
pytorch_ao
public
public
0
0
_aqt_is_int8
def _aqt_is_int8(aqt):"""Check if an AffineQuantizedTensor is int8 quantized Tensor"""return (aqt.tensor_impl.dtype == torch.int8and (aqt.quant_min is None or aqt.quant_min == -128)and (aqt.quant_max is None or aqt.quant_max == 127))
5
6
1
47
0
215
221
215
null
[]
None
null
0
0
0
null
0
null
The function (_aqt_is_int8) defined within the public class called public.The function start at line 215 and ends at 221. It contains 6 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
_aqt_is_int8_reduced_range
def _aqt_is_int8_reduced_range(aqt):return (aqt.tensor_impl.dtype == torch.int8and aqt.quant_min == -127and (aqt.quant_max is None or aqt.quant_max == 127))
4
6
1
38
0
224
229
224
null
[]
None
null
0
0
0
null
0
null
The function (_aqt_is_int8_reduced_range) defined within the public class called public.The function start at line 224 and ends at 229. It contains 6 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
_linear_fp_act_int8_weight_check
def _linear_fp_act_int8_weight_check(input_tensor, weight_tensor, bias):return (# input is native float tensornot is_traceable_wrapper_subclass(input_tensor)and input_tensor.is_floating_point()and# weight is int8 per channel quantized affine quantized tensorisinstance(weight_tensor, AffineQuantizedTensor)and _aqt_is_in...
10
14
3
93
0
232
247
232
null
[]
None
null
0
0
0
null
0
null
The function (_linear_fp_act_int8_weight_check) defined within the public class called public.The function start at line 232 and ends at 247. It contains 14 lines of code and it has a cyclomatic complexity of 10. It takes 3 parameters, represented as [232.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_fp_act_int8_weight_impl
def _linear_fp_act_int8_weight_impl(input_tensor, weight_tensor, bias):# TODO: enable cpu and mps efficient path# is_cpu and is_mps only, some issue with is_contiguous() currently# return torch.ops.aten._weight_int8pack_mm(input_tensor.contiguous(), w_vals_int8_t, weight_tensor.tensor_impl.scale)# per channel int8 weig...
2
12
3
113
4
250
266
250
null
['scale', 'm', 'y', 'w_vals_int8_t']
None
null
0
0
0
null
0
null
The function (_linear_fp_act_int8_weight_impl) defined within the public class called public.The function start at line 250 and ends at 266. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [250.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_int8_act_int8_weight_check
def _linear_int8_act_int8_weight_check(input_tensor, weight_tensor, bias):return (isinstance(input_tensor, AffineQuantizedTensor)and _aqt_is_int8_reduced_range(input_tensor)and isinstance(weight_tensor, AffineQuantizedTensor)and _aqt_is_int8(weight_tensor)and input_tensor.dtype == weight_tensor.dtypeand isinstance(inpu...
7
10
3
61
0
269
278
269
null
[]
None
null
0
0
0
null
0
null
The function (_linear_int8_act_int8_weight_check) defined within the public class called public.The function start at line 269 and ends at 278. It contains 10 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [269.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_int8_act_int8_weight_impl
def _linear_int8_act_int8_weight_impl(input_tensor, weight_tensor, bias):## 1. do the matrix form of dot(X_i, W_j)### 2. rescale the output## in cases with large matrices, y_dot_int32 can grow sufficiently# large that y_dot_int32 * a float16 scale is greater than the maximum# value of a float 16, (which results in a va...
3
20
3
163
10
281
315
281
null
['tmp', 'y_dot_scaled', 'x_scales', 'w_vals_int8_t', 'intermediate_dtype', 'output_dtype', 'x_scales_dtype', 'x_vals_int8', 'y', 'w_scales']
None
null
0
0
0
null
0
null
The function (_linear_int8_act_int8_weight_impl) defined within the public class called public.The function start at line 281 and ends at 315. It contains 20 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [281.0] and does not return any value..
pytorch_ao
public
public
0
0
_same_metadata
def _same_metadata(self: "QDQTensorImpl", src: "QDQTensorImpl") -> bool:return (isinstance(self, QDQTensorImpl)and isinstance(src, QDQTensorImpl)and self.shape == src.shapeand self.int_data.shape == src.int_data.shapeand self.scale.shape == src.scale.shapeand (self.zero_point is None and src.zero_point is None)or (self...
11
15
2
117
0
46
60
46
null
[]
None
null
0
0
0
null
0
null
The function (_same_metadata) defined within the public class called public.The function start at line 46 and ends at 60. It contains 15 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [46.0] and does not return any value..
pytorch_ao
public
public
0
0
__new__
def __new__(cls,int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],_layout: Layout,):kwargs = {}kwargs["device"] = int_data.devicekwargs["layout"] = (kwargs.get("layout") if kwargs.get("layout", False) else int_data.layout)kwargs["dtype"] = int_data.dtypekwargs["requires_grad"] = Falseshape =...
2
16
5
102
0
75
90
75
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 75 and ends at 90. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [75.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],_layout: Layout,):warnings.warn("Models quantized with version 1 of IntxWeightOnlyConfig/Int8DynamicActivationIntxWeightConfig are deprecated and will no longer be supported in a future release, please upgrade torchao and qu...
1
14
5
57
0
92
105
92
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 92 and ends at 105. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [92.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self):if self.zero_point is None:return ["int_data", "scale"], [self._layout]return ["int_data", "scale", "zero_point"], [self._layout]
2
4
1
38
0
107
110
107
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_flatten__) defined within the public class called public.The function start at line 107 and ends at 110. It contains 4 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
__tensor_unflatten__
def __tensor_unflatten__(cls, tensor_data_dict, tensor_attributes, outer_size, outer_stride):int_data, scale, zero_point = (tensor_data_dict["int_data"],tensor_data_dict["scale"],tensor_data_dict.get("zero_point", None),)(_layout,) = tensor_attributesreturn cls(int_data, scale, zero_point, _layout)
1
10
5
57
0
113
122
113
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_unflatten__) defined within the public class called public.The function start at line 113 and ends at 122. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [113.0] and does not return any value..
pytorch_ao
public
public
0
0
to
def to(self, *args, **kwargs):kwargs = self._get_to_kwargs(*args, **kwargs)return self.__class__(self.int_data.to(kwargs["device"]),self.scale.to(kwargs["device"]),self.zero_point.to(kwargs["device"])if self.zero_point is not Noneelse None,self._layout,)
2
10
3
78
0
124
133
124
null
[]
None
null
0
0
0
null
0
null
The function (to) defined within the public class called public.The function start at line 124 and ends at 133. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [124.0] and does not return any value..
pytorch_ao
public
public
0
0
_apply_fn_to_data
def _apply_fn_to_data(self, fn):return self.__class__(fn(self.int_data),fn(self.scale),fn(self.zero_point) if self.zero_point is not None else None,self._layout,)
2
7
2
47
0
135
141
135
null
[]
None
null
0
0
0
null
0
null
The function (_apply_fn_to_data) defined within the public class called public.The function start at line 135 and ends at 141. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [135.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):kwargs = {} if kwargs is None else kwargsif func is aten.detach.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._apply_fn_to_data(torch.detach))elif func is aten.clone.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._ap...
11
51
5
395
0
144
201
144
null
[]
None
null
0
0
0
null
0
null
The function (__torch_dispatch__) defined within the public class called public.The function start at line 144 and ends at 201. It contains 51 lines of code and it has a cyclomatic complexity of 11. It takes 5 parameters, represented as [144.0] and does not return any value..
pytorch_ao
public
public
0
0
get_plain
def get_plain(self) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]:return self.int_data, self.scale, self.zero_point
1
2
1
35
0
205
206
205
null
[]
None
null
0
0
0
null
0
null
The function (get_plain) defined within the public class called public.The function start at line 205 and ends at 206. 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
get_layout
def get_layout(self) -> Layout:return self._layout
1
2
1
11
0
208
209
208
null
[]
None
null
0
0
0
null
0
null
The function (get_layout) defined within the public class called public.The function start at line 208 and ends at 209. 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
from_plain
def from_plain(cls,int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],_layout: Layout,):assert isinstance(_layout, QDQLayout)return cls(int_data, scale, zero_point, _layout)
1
9
5
49
0
212
220
212
null
[]
None
null
0
0
0
null
0
null
The function (from_plain) defined within the public class called public.The function start at line 212 and ends at 220. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [212.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_check
def _linear_check(input_tensor, weight_tensor, bias):layout = weight_tensor.tensor_impl.get_layout()return isinstance(layout, QDQLayout)
1
3
3
25
1
223
225
223
null
['layout']
None
null
0
0
0
null
0
null
The function (_linear_check) defined within the public class called public.The function start at line 223 and ends at 225. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [223.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_impl
def _linear_impl(input_tensor, weight_tensor, bias):if isinstance(input_tensor, AffineQuantizedTensor):input_tensor = input_tensor.dequantize()if isinstance(weight_tensor, AffineQuantizedTensor):weight_tensor = weight_tensor.dequantize()return torch.nn.functional.linear(input_tensor, weight_tensor, bias)
3
6
3
54
2
228
233
228
null
['weight_tensor', 'input_tensor']
None
null
0
0
0
null
0
null
The function (_linear_impl) defined within the public class called public.The function start at line 228 and ends at 233. It contains 6 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [228.0] and does not return any value..
pytorch_ao
public
public
0
0
_embedding_check
def _embedding_check(args, kwargs):_, weight_tensor = argslayout = weight_tensor.tensor_impl.get_layout()return isinstance(layout, QDQLayout)
1
4
2
28
1
236
239
236
null
['layout']
None
null
0
0
0
null
0
null
The function (_embedding_check) defined within the public class called public.The function start at line 236 and ends at 239. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [236.0] and does not return any value..
pytorch_ao
public
public
0
0
_embedding_impl
def _embedding_impl(args, kwargs):input_tensor, weight_tensor = argsif isinstance(weight_tensor, AffineQuantizedTensor):weight_tensor = weight_tensor.dequantize()return torch.nn.functional.embedding(input_tensor, weight_tensor, **kwargs)
2
5
2
43
1
242
246
242
null
['weight_tensor']
None
null
0
0
0
null
0
null
The function (_embedding_impl) defined within the public class called public.The function start at line 242 and ends at 246. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [242.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_int8_act_int8_weight_semi_structured_sparse_check
def _linear_int8_act_int8_weight_semi_structured_sparse_check(input_tensor, weight_tensor, bias):return (isinstance(input_tensor, AffineQuantizedTensor)and _aqt_is_int8_reduced_range(input_tensor)and isinstance(weight_tensor, AffineQuantizedTensor)and weight_tensor.is_cudaand input_tensor.dtype == weight_tensor.dtypean...
7
12
3
60
0
27
38
27
null
[]
None
null
0
0
0
null
0
null
The function (_linear_int8_act_int8_weight_semi_structured_sparse_check) defined within the public class called public.The function start at line 27 and ends at 38. It contains 12 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [27.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_int8_act_int8_weight_semi_structured_sparse_impl
def _linear_int8_act_int8_weight_semi_structured_sparse_impl(input_tensor, weight_tensor, bias):x_vals_int8 = input_tensor.tensor_impl.int_datax_scales = input_tensor.tensor_impl.scalew_vals_int8 = weight_tensor.tensor_impl.int_dataw_scales = weight_tensor.tensor_impl.scaletmp = x_vals_int8.reshape(-1, x_vals_int8.shap...
2
25
3
181
9
41
69
41
null
['tmp', 'y_dot_bf16_w_scales_fused', 'x_scales', 'tmp_padded', 'output_dtype', 'x_vals_int8', 'y', 'w_vals_int8', 'w_scales']
None
null
0
0
0
null
0
null
The function (_linear_int8_act_int8_weight_semi_structured_sparse_impl) defined within the public class called public.The function start at line 41 and ends at 69. It contains 25 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [41.0] and does not return any value..
pytorch_ao
public
public
0
0
pre_process
def pre_process(self, input: torch.Tensor) -> torch.Tensor:# prune to 2:4 if not alreadytemp = input.detach()pruning_inds = temp.abs().view(-1, 4).argsort(dim=1)[:, :2]temp.view(-1, 4).scatter_(1, pruning_inds, value=0)return temp
1
5
2
72
0
81
86
81
null
[]
None
null
0
0
0
null
0
null
The function (pre_process) defined within the public class called public.The function start at line 81 and ends at 86. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [81.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):kwargs = {} if kwargs is None else kwargsif func is aten.detach.default:return return_and_correct_aliasing(func, args, kwargs, args[0]._apply_fn_to_data(torch.detach))raise NotImplementedError(f"SparseAQTTensorImpl dispatch: attempting to run {func}, this is not su...
3
9
5
59
0
96
106
96
null
[]
None
null
0
0
0
null
0
null
The function (__torch_dispatch__) defined within the public class called public.The function start at line 96 and ends at 106. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [96.0] and does not return any value..
pytorch_ao
public
public
0
0
get_plain
def get_plain(self):# Currently we don't have cuSPARSELt expansion routines, so we matmul by# the identity matrix to get the original dense matrix. This is slow though.cols = self.int_data.numel() * 16 // (10 * self.scale.shape[0])int_data_expanded = torch._cslt_sparse_mm(self.int_data,torch.eye(cols, dtype=self.int_da...
1
7
1
65
0
108
116
108
null
[]
None
null
0
0
0
null
0
null
The function (get_plain) defined within the public class called public.The function start at line 108 and ends at 116. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
from_plain
def from_plain(cls,int_data: torch.Tensor,scale: torch.Tensor,zero_point: Optional[torch.Tensor],_layout: Layout,):assert isinstance(_layout, SemiSparseLayout)int_data_compressed = torch._cslt_compress(int_data)return cls(int_data_compressed, scale, zero_point, _layout)
1
10
5
57
0
119
128
119
null
[]
None
null
0
0
0
null
0
null
The function (from_plain) defined within the public class called public.The function start at line 119 and ends at 128. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [119.0] and does not return any value..
pytorch_ao
public
public
0
0
_aqt_is_tensor_core_tile_uint4
def _aqt_is_tensor_core_tile_uint4(aqt):"""Check if an AffineQuantizedTensor is uint4 quantized Tensor"""# TODO: use torch.uint4return (aqt.tensor_impl.dtype == torch.int32and aqt.quant_min == 0and aqt.quant_max == 15)
3
6
1
30
0
35
42
35
null
[]
None
null
0
0
0
null
0
null
The function (_aqt_is_tensor_core_tile_uint4) defined within the public class called public.The function start at line 35 and ends at 42. It contains 6 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
_same_metadata
def _same_metadata(self: "TensorCoreTiledAQTTensorImpl", src: "TensorCoreTiledAQTTensorImpl") -> bool:return (isinstance(self, TensorCoreTiledAQTTensorImpl)and isinstance(src, TensorCoreTiledAQTTensorImpl)and self.shape == src.shapeand self.packed_weight.shape == src.packed_weight.shapeand self.scale_and_zero.shape == ...
7
12
2
83
0
45
56
45
null
[]
None
null
0
0
0
null
0
null
The function (_same_metadata) defined within the public class called public.The function start at line 45 and ends at 56. It contains 12 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [45.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_bf16_act_uint4_weight_check
def _linear_bf16_act_uint4_weight_check(input_tensor, weight_tensor, bias):return (# input is native bfloat16 tensornot is_traceable_wrapper_subclass(input_tensor)and input_tensor.dtype == torch.bfloat16and# weight is uint4, group quantized tensor_core_tiled tensor impl affine quantized tensorisinstance(weight_tensor, ...
8
12
3
71
0
59
72
59
null
[]
None
null
0
0
0
null
0
null
The function (_linear_bf16_act_uint4_weight_check) defined within the public class called public.The function start at line 59 and ends at 72. It contains 12 lines of code and it has a cyclomatic complexity of 8. It takes 3 parameters, represented as [59.0] and does not return any value..
pytorch_ao
public
public
0
0
_linear_bf16_act_uint4_weight_impl
def _linear_bf16_act_uint4_weight_impl(input_tensor, weight_tensor, bias):assert weight_tensor.block_size[0] == 1, (f"Requires groupwise quantization, got block_size: {weight_tensor.block_size}")assert input_tensor.shape[-1] == weight_tensor.shape[1], (f"need input_tensor shape: {input_tensor.shape} final"f"dim to matc...
3
29
3
233
9
75
115
75
null
['packed_weight', 'groupsize', 'scale_and_zero', 'orig_act_size', 'orig_out_features', 'act_mat', 'y', 'pad_size', 'orig_dtype']
None
null
0
0
0
null
0
null
The function (_linear_bf16_act_uint4_weight_impl) defined within the public class called public.The function start at line 75 and ends at 115. It contains 29 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [75.0] and does not return any value..
pytorch_ao
public
public
0
0
pre_process
def pre_process(self, input: torch.Tensor) -> torch.Tensor:orig_out_features, orig_in_features = input.shape[-2:]in_features = find_multiple(orig_in_features, 1024)out_features = find_multiple(orig_out_features, 8)input = torch.nn.functional.pad(input,(0, in_features - orig_in_features, 0, out_features - orig_out_featu...
1
9
2
72
0
128
136
128
null
[]
None
null
0
0
0
null
0
null
The function (pre_process) defined within the public class called public.The function start at line 128 and ends at 136. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [128.0] and does not return any value..
pytorch_ao
public
public
0
0
pre_process_static
def pre_process_static(self,input: torch.Tensor,scale: torch.Tensor,zero_point: torch.Tensor,block_size: Tuple[int, ...],) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:input = self.pre_process(input)orig_qparam_shape = scale.shapenew_qparam_shape, reduction_dims = _get_reduction_params(block_size, input.size())fo...
4
24
5
156
0
138
161
138
null
[]
None
null
0
0
0
null
0
null
The function (pre_process_static) defined within the public class called public.The function start at line 138 and ends at 161. It contains 24 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [138.0] and does not return any value..
pytorch_ao
public
public
0
0
post_process
def post_process(self,input: torch.Tensor,scale: torch.Tensor,zero_point: torch.Tensor,block_size: Tuple[int, ...],) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:orig_out_features, orig_in_features = input.shape[-2:]in_features = find_multiple(orig_in_features, 1024)out_features = find_multiple(orig_out_features,...
2
24
5
188
0
163
186
163
null
[]
None
null
0
0
0
null
0
null
The function (post_process) defined within the public class called public.The function start at line 163 and ends at 186. It contains 24 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [163.0] and does not return any value..
pytorch_ao
public
public
0
0
extra_repr
def extra_repr(self):return f"inner_k_tiles={self.inner_k_tiles}"
1
2
1
8
0
188
189
188
null
[]
None
null
0
0
0
null
0
null
The function (extra_repr) defined within the public class called public.The function start at line 188 and ends at 189. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
__new__
def __new__(cls,packed_weight: torch.Tensor,scale_and_zero: torch.Tensor,transposed: bool,_layout: Layout,):kwargs = {}kwargs["device"] = packed_weight.devicekwargs["layout"] = (kwargs.get("layout")if kwargs.get("layout", False)else packed_weight.layout)kwargs["dtype"] = packed_weight.dtypekwargs["requires_grad"] = Fal...
2
18
5
97
0
215
232
215
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 215 and ends at 232. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [215.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,packed_weight: torch.Tensor,scale_and_zero: torch.Tensor,transposed: bool,_layout: Layout,):warnings.warn("Models quantized with version 1 of Int4WeightOnlyConfig is deprecated and will no longer be supported in a future release, please upgrade torchao and quantize again, or download a newer torchao c...
1
14
5
52
0
234
247
234
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 234 and ends at 247. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [234.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self):return ["packed_weight", "scale_and_zero"], [self.transposed, self._layout]
1
2
1
21
0
249
250
249
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_flatten__) defined within the public class called public.The function start at line 249 and ends at 250. 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
__tensor_unflatten__
def __tensor_unflatten__(cls, tensor_data_dict, tensor_attributes, outer_size, outer_stride):packed_weight, scale_and_zero = (tensor_data_dict["packed_weight"],tensor_data_dict["scale_and_zero"],)(transposed,_layout,) = tensor_attributesreturn cls(packed_weight, scale_and_zero, transposed, _layout)
1
12
5
48
0
253
264
253
null
[]
None
null
0
0
0
null
0
null
The function (__tensor_unflatten__) defined within the public class called public.The function start at line 253 and ends at 264. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [253.0] and does not return any value..