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
get_layout
def get_layout(self) -> Layout:return self._layout
1
2
1
11
0
50
51
50
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 50 and ends at 51. 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,_layout: Layout,):"""Construct a tensor impl from plain tensors and a _layout, which main containextra metadata for packing etc."""pass
1
7
4
24
0
54
63
54
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 54 and ends at 63. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [54.0] and does not return any value..
pytorch_ao
public
public
0
0
__repr__
def __repr__(self):int_data, scale = self.get_plain()_layout = self.get_layout()return f"{self.__class__.__name__}(int_data={int_data}, scale={scale}, _layout={_layout})"
1
4
1
24
0
65
68
65
null
[]
None
null
0
0
0
null
0
null
The function (__repr__) defined within the public class called public.The function start at line 65 and ends at 68. 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
__new__
def __new__(cls,tensor_impl: MyDTypeTensorImpl,shape: torch.Size,dtype: Optional[torch.dtype] = None,requires_grad: bool = False,):kwargs = {}kwargs["device"] = tensor_impl.devicekwargs["layout"] = (kwargs.get("layout") if kwargs.get("layout", False) else tensor_impl.layout)kwargs["dtype"] = dtypekwargs["requires_grad"...
2
15
5
97
0
89
103
89
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 89 and ends at 103. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [89.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,tensor_impl: MyDTypeTensorImpl,shape: torch.Size,dtype: Optional[torch.dtype] = None,requires_grad: bool = False,):self.tensor_impl = tensor_impl
1
8
5
38
0
105
112
105
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 105 and ends at 112. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [105.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self):"""Given the class, returns the fields of the class as two listsThe first one contains any tensor fields such as int_data and scale as keys to a dictionaryThe second one contains all other non tensor type fields as values of a list"""return ["tensor_impl"], [self.shape, self.dtype, self.req...
1
2
1
24
0
119
125
119
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 119 and ends at 125. 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):"""Given the flattened data from above, returns a class instancetensor_data_dict contains the tensor fields of the class as a dictionarytensor_attributes contains all other non tensor type fields"""tensor_impl = tensor_data_dic...
2
11
5
49
0
128
143
128
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 128 and ends at 143. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [128.0] and does not return any value..
pytorch_ao
public
public
0
0
from_float
def from_float(cls,input_float: torch.Tensor,_layout: Layout = PlainLayout(),):mapping_type = MappingType.SYMMETRICblock_size = (1, input_float.shape[-1])dtype = torch.int16scale, zero_point = choose_qparams_affine(input_float, mapping_type, block_size, dtype)int_data = quantize_affine(input_float, block_size, scale, z...
1
15
3
99
0
149
163
149
null
[]
None
null
0
0
0
null
0
null
The function (from_float) defined within the public class called public.The function start at line 149 and ends at 163. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [149.0] and does not return any value..
pytorch_ao
public
public
0
0
_layout
def _layout(self) -> Layout:return self.tensor_impl._layout
1
2
1
13
0
169
170
169
null
[]
None
null
0
0
0
null
0
null
The function (_layout) defined within the public class called public.The function start at line 169 and ends at 170. It contains 2 lines of code and it has a cyclomatic complexity of 1. 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=None):"""We can define a dequantize method to convert the quantized tensor to a floating point tensor"""if output_dtype is None:output_dtype = torch.get_default_dtype()int_data, scale = self.tensor_impl.get_plain()transposed = Falseblock_size = (1, int_data.shape[-1])if hasattr(self.te...
5
14
2
100
0
172
186
172
null
[]
None
null
0
0
0
null
0
null
The function (dequantize) defined within the public class called public.The function start at line 172 and ends at 186. It contains 14 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [172.0] and does not return any value..
pytorch_ao
public
public
0
0
__repr__
def __repr__(self):return (f"{self.__class__.__name__}(data={self.dequantize()}, shape={self.shape}, "f"device={self.device}, dtype={self.dtype}, requires_grad={self.requires_grad})")
1
5
1
12
0
188
192
188
null
[]
None
null
0
0
0
null
0
null
The function (__repr__) defined within the public class called public.The function start at line 188 and ends at 192. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
_apply_fn_to_data
def _apply_fn_to_data(self, fn):"""Used for implementing aten ops by applying them only to the relevant tensor atributesIn this case we only want to call things like to() or view() on the tensor impl"""return self.__class__(fn(self.tensor_impl),self.shape,self.dtype,)
1
6
2
29
0
194
203
194
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 194 and ends at 203. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [194.0] and does not return any value..
pytorch_ao
public
public
0
0
__new__
def __new__(cls,tensor_impl: MyDTypeTensorImpl,shape: torch.Size,dtype: Optional[torch.dtype] = None,requires_grad: bool = False,):kwargs = {}kwargs["device"] = tensor_impl.devicekwargs["layout"] = (kwargs.get("layout") if kwargs.get("layout", False) else tensor_impl.layout)kwargs["dtype"] = dtypekwargs["requires_grad"...
2
16
5
97
0
227
242
89
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 227 and ends at 242. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [89.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self,int_data: torch.Tensor,scale: torch.Tensor,transposed: bool,_layout: Layout,):self.int_data = int_dataself.scale = scaleself.transposed = transposedself._layout = _layout
1
11
5
46
0
244
254
244
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 244 and ends at 254. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [244.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self):return ["int_data", "scale"], [self.transposed, self._layout]
1
2
1
21
0
256
257
256
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 256 and ends at 257. 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):int_data, scale = tensor_data_dict["int_data"], tensor_data_dict["scale"](transposed,_layout,) = tensor_attributesreturn cls(int_data, scale, transposed, _layout)
1
9
5
45
0
260
268
260
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 260 and ends at 268. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [260.0] 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,_layout: Layout,):"""Construct a tensor impl from plain tensors and a _layout, which main containextra metadata for packing etc."""assert isinstance(_layout, PlainLayout)return cls(int_data, scale, False, _layout)
1
8
4
41
0
271
281
271
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 271 and ends at 281. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [271.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),self.transposed,self._layout,)
1
7
2
35
0
283
289
283
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 283 and ends at 289. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [283.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))# Tensor parallel support STARTelif func in [aten._to_copy.default, aten.clone.default]:return ret...
11
62
5
425
0
292
359
292
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 292 and ends at 359. It contains 62 lines of code and it has a cyclomatic complexity of 11. It takes 5 parameters, represented as [292.0] and does not return any value..
pytorch_ao
public
public
0
0
_quantized_linear_op
def _quantized_linear_op(input_tensor, weight_tensor, bias):if isinstance(input_tensor, MyDTypeTensor):input_tensor = input_tensor.dequantize()if isinstance(weight_tensor, MyDTypeTensor):weight_tensor = weight_tensor.dequantize()return torch.nn.functional.linear(input_tensor, weight_tensor, bias)
3
6
3
54
2
369
374
369
null
['weight_tensor', 'input_tensor']
None
null
0
0
0
null
0
null
The function (_quantized_linear_op) defined within the public class called public.The function start at line 369 and ends at 374. It contains 6 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [369.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):input_tensor, weight_tensor, bias = (args[0],args[1],args[2] if len(args) > 2 else None,)# using try/except here so that we can have a general fallback when input_tensor/weight_tensor# is not picked up by any of the dispatch paths in `_quantized_linear_op`, this allows us to# make the b...
5
14
4
102
2
378
394
378
null
['weight_tensor', 'input_tensor']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 378 and ends at 394. It contains 14 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [378.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):# `return_and_correct_aliasing` should be used by wrapper tensor ``__torch_dispatch__`` subclasses that would like to# work with torch.compile. It ensures that the subclass properly implements the aliasing behavior of every op,# which is needed for correctness in AOTAutograd.# `_apply_f...
1
4
4
32
0
398
407
398
null
[]
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 398 and ends at 407. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [398.0] and does not return any value..
pytorch_ao
public
public
0
0
main.__init__
def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(1024, 128)
1
3
1
28
0
423
425
423
null
[]
None
null
0
0
0
null
0
null
The function (main.__init__) defined within the public class called public.The function start at line 423 and ends at 425. 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
main.forward
def forward(self, x: torch.Tensor) -> torch.Tensor:return self.linear(x)
1
2
2
22
0
427
428
427
null
[]
None
null
0
0
0
null
0
null
The function (main.forward) defined within the public class called public.The function start at line 427 and ends at 428. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [427.0] and does not return any value..
pytorch_ao
public
public
0
0
main
def main():from torchao.utils import benchmark_modelclass M(torch.nn.Module):def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(1024, 128)def forward(self, x: torch.Tensor) -> torch.Tensor:return self.linear(x)m = M()example_inputs = (100 * torch.randn(512, 1024),)NUM_WARMUPS = 10NUM_RUNS = 100f...
5
28
0
203
5
419
463
419
null
['NUM_WARMUPS', 'm', 'example_inputs', 'NUM_RUNS', 'compiled']
None
null
0
0
0
null
0
null
The function (main) defined within the public class called public.The function start at line 419 and ends at 463. It contains 28 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
_quantize
def _quantize(cls,input_float: torch.Tensor,_layout: Layout,) -> MyDTypeTensorImpl:"""Convert from a floating point tensor (fp32/fp16/bf16) to the desired dtype."""mapping_type = MappingType.SYMMETRICblock_size = (1, input_float.shape[-1])dtype = torch.int8scale, zero_point = choose_qparams_affine(input_float, mapping_...
1
14
3
90
0
43
59
43
null
[]
None
null
0
0
0
null
0
null
The function (_quantize) defined within the public class called public.The function start at line 43 and ends at 59. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [43.0] and does not return any value..
pytorch_ao
public
public
0
0
from_float
def from_float(cls,input_float: torch.Tensor,_layout: Layout = PlainLayout(),) -> "MyTrainableDTypeTensor":"""Main entry point for creating a `MyTrainableDTypeTensor`.This instantiates the tensor subclass in a differentiable constructorto ensure gradients are passed to the tensor subclass properly during training."""re...
1
6
3
32
0
62
73
62
null
[]
None
null
0
0
0
null
0
null
The function (from_float) defined within the public class called public.The function start at line 62 and ends at 73. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [62.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(ctx: torch.autograd.function.FunctionCtx,input_float: torch.Tensor,_layout: Layout,) -> "MyTrainableDTypeTensor":tensor_impl = MyTrainableDTypeTensor._quantize(input_float, _layout)return MyTrainableDTypeTensor(tensor_impl,input_float.shape,requires_grad=True,)
1
11
3
50
0
82
92
82
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 82 and ends at 92. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [82.0] and does not return any value..
pytorch_ao
public
public
0
0
backward
def backward(ctx, gy):return gy, None
1
2
2
11
0
95
96
95
null
[]
None
null
0
0
0
null
0
null
The function (backward) defined within the public class called public.The function start at line 95 and ends at 96. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [95.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(ctx: torch.autograd.function.FunctionCtx,input_tensor: torch.Tensor,weight_tensor: torch.Tensor,) -> torch.Tensor:assert isinstance(weight_tensor, MyTrainableDTypeTensor)ctx.save_for_backward(input_tensor, weight_tensor)weight_tensor = weight_tensor.dequantize()return torch.nn.functional.linear(input_tensor...
1
9
3
65
0
116
124
116
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 116 and ends at 124. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [116.0] and does not return any value..
pytorch_ao
public
public
0
0
backward
def backward(ctx, grad_output):input_tensor, weight_tensor = ctx.saved_tensorsgrad_input = torch.matmul(grad_output, weight_tensor.dequantize())grad_weight = torch.matmul(grad_output.view(-1, weight_tensor.shape[0]).T,input_tensor.view(-1, weight_tensor.shape[1]),)return grad_input, grad_weight
1
8
2
71
0
127
134
127
null
[]
None
null
0
0
0
null
0
null
The function (backward) defined within the public class called public.The function start at line 127 and ends at 134. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [127.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):"""Handle the linear op with quantized weights.For simplicity, we run both the forward and backward passes entirely in float."""assert isinstance(args[1], MyTrainableDTypeTensor)if len(args) > 2 and args[2] is not None:raise NotImplementedError("linear bias not yet supported")return _Qu...
3
5
4
58
0
138
146
138
null
[]
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 138 and ends at 146. It contains 5 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [138.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):"""Handle the in-place add op, called by the optimizer to updatethe quantized weight during training."""assert len(args) == 2assert isinstance(args[0], MyTrainableDTypeTensor)assert args[0].tensor_impl.int_data.dtype == torch.int8float0 = args[0].dequantize()float1 = (args[1].dequantize...
2
15
4
136
4
150
168
150
null
['float1', 'new_tensor_impl', 'new_value', 'float0']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 150 and ends at 168. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [150.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):"""Handle the add op, called by the optimizer during training."""assert len(args) == 2assert not isinstance(args[0], MyTrainableDTypeTensor)assert isinstance(args[1], MyTrainableDTypeTensor)out = torch.add(args[0], args[1].dequantize(), **kwargs)return return_and_correct_aliasing(func, ...
1
6
4
74
1
172
178
172
null
['out']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 172 and ends at 178. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [172.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self) -> None:super().__init__()self.linear = torch.nn.Linear(512, 1024, bias=False)
1
3
1
32
0
187
189
187
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 187 and ends at 189. 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
forward
def forward(self, x: torch.Tensor) -> torch.Tensor:return self.linear(x)
1
2
2
22
0
191
192
191
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 191 and ends at 192. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [191.0] and does not return any value..
pytorch_ao
public
public
0
0
main
def main():m = M().cuda()NUM_TRAIN_STEPS = 10VERBOSE = True# Convert weights to quantized weightsm.linear.weight = torch.nn.Parameter(to_my_trainable_dtype(m.linear.weight),requires_grad=True,)# Dummy training loopoptimizer = torch.optim.SGD(m.parameters(), lr=0.1, momentum=0.9, weight_decay=1e-5)loss_fn = torch.nn.Cro...
3
25
0
202
11
195
223
195
null
['target', 'output', 'optimizer', 'm', 'NUM_TRAIN_STEPS', 'weight_grad', 'loss_fn', 'example_inputs', 'VERBOSE', 'loss', 'weight']
None
null
0
0
0
null
0
null
The function (main) defined within the public class called public.The function start at line 195 and ends at 223. It contains 25 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
__torch_function__
def __torch_function__(cls, func, types, args=(), kwargs=None):if kwargs is None:kwargs = {}if func is torch.nn.functional.linear:input_tensor, weight_tensor, _ = (args[0],args[1],args[2] if len(args) > 2 else None,)flattened_input_tensor = input_tensor.view(-1, input_tensor.shape[-1])M, K = flattened_input_tensor.shap...
7
28
4
201
0
14
41
14
null
[]
None
null
0
0
0
null
0
null
The function (__torch_function__) defined within the public class called public.The function start at line 14 and ends at 41. It contains 28 lines of code and it has a cyclomatic complexity of 7. It takes 4 parameters, represented as [14.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args=(), kwargs=None):if kwargs is None:kwargs = {}arg_shape = (args[0].shapeif len(args) > 0 and isinstance(args[0], torch.Tensor)else None)if PRINT_ARGS:print(f"ATEN_FUNC {func=}, {types=}, {args=}, {kwargs=}, args[0] shape: {arg_shape}")else:print(f"ATEN_FUNC {func=}, {types=...
5
15
4
82
0
48
63
48
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 48 and ends at 63. It contains 15 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [48.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):return return_and_correct_aliasing(func, args, kwargs, args[0]._apply_fn_to_data(torch.clone))
1
4
4
32
0
30
33
30
null
[]
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 30 and ends at 33. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [30.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):tensor_impl_list = func(args[0].tensor_impl, *args[1:], **kwargs)out = [MyDTypeTensorTP(tensor_impl, tensor_impl.shape)for tensor_impl in tensor_impl_list]return out
2
7
4
50
2
37
43
37
null
['out', 'tensor_impl_list']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 37 and ends at 43. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [37.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):empty_like_tensor_impl = func(args[0].tensor_impl, *args[1:], **kwargs)return MyDTypeTensorTP(empty_like_tensor_impl, empty_like_tensor_impl.shape)
1
3
4
41
1
47
49
47
null
['empty_like_tensor_impl']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 47 and ends at 49. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [47.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):self, dim, start, end, step = fill_defaults(args, 5, [0, None, None, 1])assert step == 1if end >= self.shape[dim]:end = self.shape[dim]shape = list(self.shape)shape[dim] = end - startreturn self.__class__(aten.slice.Tensor(self.tensor_impl, dim, start, end, step), shape, self.dtype)
2
10
4
105
2
53
62
53
null
['end', 'shape']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 53 and ends at 62. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [53.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):x, shape = argsif tuple(x.shape) == tuple(shape):return x.__class__(x.tensor_impl, x.shape, x.dtype)if len(shape) == 1 and shape[0] == -1:return x.__class__(x.tensor_impl, (x.numel(),), x.dtype)raise ValueError(f"{x.__class__.__name__} only supports .view() with same shape or shape=[-1]...
4
9
4
90
0
67
78
67
null
[]
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 67 and ends at 78. It contains 9 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [67.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):tensor = args[0]shape = tensor.shape[::-1]new = tensor.__class__(tensor.tensor_impl.t(), shape, tensor.dtype)return return_and_correct_aliasing(func, args, kwargs, new)
1
5
4
58
3
82
86
82
null
['shape', 'tensor', 'new']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 82 and ends at 86. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [82.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):input_tensor, weight_tensor, bias = (args[1],args[2],args[0],)weight_tensor = weight_tensor.dequantize()return aten.addmm(input_tensor, weight_tensor, bias)
1
8
4
52
1
90
97
90
null
['weight_tensor']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 90 and ends at 97. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [90.0] and does not return any value..
pytorch_ao
public
public
0
0
_
def _(func, types, args, kwargs):input_tensor, weight_tensor, _ = (args[0], args[1], None)weight_tensor = weight_tensor.dequantize()return aten.mm(input_tensor, weight_tensor)
1
4
4
46
1
101
104
101
null
['weight_tensor']
None
null
0
0
0
null
0
null
The function (_) defined within the public class called public.The function start at line 101 and ends at 104. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [101.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, in_features, out_features, **kwargs) -> None:super().__init__(**kwargs)self.linear = torch.nn.Linear(in_features, out_features, bias=False)
1
3
4
41
0
108
110
108
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 108 and ends at 110. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [108.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x: torch.Tensor) -> torch.Tensor:return self.linear(x)
1
2
2
22
0
112
113
112
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 112 and ends at 113. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [112.0] and does not return any value..
pytorch_ao
public
public
0
0
quantize
def quantize(m: torch.nn.Module) -> torch.nn.Module:"""Quantize the model"""m.linear.weight = torch.nn.Parameter(to_my_dtype_tp(m.linear.weight), requires_grad=False)return m
1
5
1
45
0
119
126
119
null
[]
None
null
0
0
0
null
0
null
The function (quantize) defined within the public class called public.The function start at line 119 and ends at 126. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
shard
def shard(full_tensor: torch.Tensor,device_mesh: DeviceMesh,placements: Sequence[Placement],) -> DTensor:"""Add a shard function to simplify both colwise_shard and rowwise_shard.Theshard function accepts a full tensor, and returns a DTensor based onindicated placements.Goal is to move the shard function as a static met...
2
15
3
88
2
129
151
129
null
['slices', 'local_tensor']
None
null
0
0
0
null
0
null
The function (shard) defined within the public class called public.The function start at line 129 and ends at 151. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [129.0] and does not return any value..
pytorch_ao
public
public
0
0
colwise_shard
def colwise_shard(m: torch.nn.Module, mesh: DeviceMesh) -> torch.nn.Module:"""Shard linear layer of the model in column-wise fashion"""# Column-wise is wrt to A^T, so for A it is row-wise.orig_weight = m.linear.weight# Construct DTensor from local sharddtensor = shard(orig_weight, mesh, [Shard(0)])# Replace parameter i...
1
5
2
64
2
154
164
154
null
['orig_weight', 'dtensor']
None
null
0
0
0
null
0
null
The function (colwise_shard) defined within the public class called public.The function start at line 154 and ends at 164. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [154.0] and does not return any value..
pytorch_ao
public
public
0
0
rowwise_shard
def rowwise_shard(m: torch.nn.Module, mesh: DeviceMesh) -> torch.nn.Module:"""Shard linear layer of the model in row-wise fashion"""# Row-wise is wrt to A^T, so for A it is column-wise.orig_weight = m.linear.weight# Construct DTensor from local sharddtensor = shard(orig_weight, mesh, [Shard(1)])# Replace parameter in m...
1
5
2
64
2
167
177
167
null
['orig_weight', 'dtensor']
None
null
0
0
0
null
0
null
The function (rowwise_shard) defined within the public class called public.The function start at line 167 and ends at 177. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [167.0] and does not return any value..
pytorch_ao
public
public
0
0
main
def main():# To make sure different ranks create the same moduletorch.manual_seed(5)# Get rank and deviceworld_size = int(os.environ["WORLD_SIZE"])rank = int(os.environ["RANK"])device = torch.device(f"cuda:{rank % torch.cuda.device_count()}")# Original modelproj_up = M(1024, 2048).to(device)proj_dn = M(2048, 1024).to(d...
1
28
0
228
17
183
226
183
null
['mesh', 'input_dtensor', 'example_input', 'up_compiled', 'y_dn', 'device', 'world_size', 'proj_up', 'dn_quant', 'dn_dist', 'up_quant', 'rank', 'up_dist', 'y_up', 'y_d', 'dn_compiled', 'proj_dn']
None
null
0
0
0
null
0
null
The function (main) defined within the public class called public.The function start at line 183 and ends at 226. It contains 28 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
__new__
def __new__(cls, a):return torch.Tensor._make_wrapper_subclass(cls,a.shape,strides=a.stride(),storage_offset=a.storage_offset(),dtype=a.dtype,device=a.device,)
1
9
2
49
0
12
20
12
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 12 and ends at 20. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [12.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, a):self.a = a
1
2
2
12
0
22
23
22
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 22 and ends at 23. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [22.0] and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):if kwargs is None:kwargs = {}print("func: " + str(func))# Our logging subclass trivially implements *every* pytorch op.# It does so by:# - unwrapping any LoggingTensor arguments# - calling the underlying function on the inner tensors# - wrapping any tensor outputs ...
4
12
5
117
0
26
42
26
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 26 and ends at 42. It contains 12 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [26.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, m: int, n: int, k: int):super().__init__()self.linear1 = torch.nn.Linear(m, n, bias=False)self.linear2 = torch.nn.Linear(n, k, bias=False)
1
4
4
60
0
46
49
46
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 46 and ends at 49. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [46.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):x = self.linear1(x)x = self.linear2(x)return x
1
4
2
25
0
51
54
51
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 51 and ends at 54. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [51.0] and does not return any value..
pytorch_ao
public
public
0
0
int8_symmetric_quantize
def int8_symmetric_quantize(fp32_tensor: torch.Tensor,) -> Tuple[torch.Tensor, torch.Tensor]:"""Symmetrically quantize the torch.float32 tensor into torch.int8.Return a 2-tuple of (quantized value, scale).input: dimensions=[M, N], dtype=torch.float32output: dimensions=[M, N], dtype=torch.int8scale: dimensions=[M, 1], d...
1
15
1
175
8
11
33
11
null
['out', 'max_val', 'max_val_pos', 'min_val', 'min_val_neg', 'scale', 'quant_max', 'quant_min']
None
null
0
0
0
null
0
null
The function (int8_symmetric_quantize) defined within the public class called public.The function start at line 11 and ends at 33. 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
forward
def forward(self, x: torch.Tensor) -> torch.Tensor:w_int8, scale = int8_symmetric_quantize(self.weight)return torch.matmul(x, w_int8.t().to(x.dtype)) * scale.t()
1
3
2
51
0
42
44
42
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 42 and ends at 44. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [42.0] and does not return any value..
pytorch_ao
public
public
0
0
from_float
def from_float(cls, mod: torch.nn.Linear):new_linear = cls(mod.in_features, mod.out_features, mod.bias)new_linear.weight = mod.weightreturn new_linear
1
4
2
38
0
47
50
47
null
[]
None
null
0
0
0
null
0
null
The function (from_float) defined within the public class called public.The function start at line 47 and ends at 50. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [47.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, m: int, n: int, k: int):super().__init__()self.linear1 = torch.nn.Linear(m, n, bias=False)self.linear2 = torch.nn.Linear(n, k, bias=False)
1
4
4
60
0
54
57
54
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 54 and ends at 57. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [54.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):x = self.linear1(x)x = self.linear2(x)return x
1
4
2
25
0
59
62
59
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 59 and ends at 62. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [59.0] and does not return any value..
pytorch_ao
public
public
0
0
int8_symmetric_quantize
def int8_symmetric_quantize(fp32_tensor: torch.Tensor,) -> Tuple[torch.Tensor, torch.Tensor]:"""Symmetrically quantize the torch.float32 tensor into torch.int8.Return a 2-tuple of (quantized value, scale)."""quant_min = -128quant_max = 127min_val = torch.amin(fp32_tensor, dim=[1], keepdim=False)max_val = torch.amax(fp3...
1
15
1
175
8
12
30
12
null
['out', 'max_val', 'max_val_pos', 'min_val', 'min_val_neg', 'scale', 'quant_max', 'quant_min']
None
null
0
0
0
null
0
null
The function (int8_symmetric_quantize) defined within the public class called public.The function start at line 12 and ends at 30. 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
__new__
def __new__(cls, int_data: torch.Tensor, scale: torch.Tensor):return torch.Tensor._make_wrapper_subclass(cls,int_data.shape,strides=int_data.stride(),storage_offset=int_data.storage_offset(),dtype=scale.dtype,device=int_data.device,)
1
9
3
59
0
40
48
40
null
[]
None
null
0
0
0
null
0
null
The function (__new__) defined within the public class called public.The function start at line 40 and ends at 48. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [40.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, int_data: torch.Tensor, scale: torch.Tensor):# inner data expected to be quantized alreadyassert int_data.dtype is torch.int8# we could do more work to support ndim > 2!assert int_data.ndim == 2assert scale.ndim == 2self.int_data = int_dataself.scale = scale
1
6
3
47
0
51
58
51
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 51 and ends at 58. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [51.0] and does not return any value..
pytorch_ao
public
public
0
0
__tensor_flatten__
def __tensor_flatten__(self) -> Tuple[List[str], Any]:return ["int_data", "scale"], None
1
2
1
23
0
63
64
63
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 63 and ends at 64. 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, extra_metadata, outer_size=None, outer_stride=None):assert extra_metadata is Noneint_data = tensor_data_dict["int_data"]scale = tensor_data_dict["scale"]return Int8SymmetricTensor(int_data, scale)
1
7
5
40
0
73
79
73
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 73 and ends at 79. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [73.0] and does not return any value..
pytorch_ao
public
public
0
0
__repr__
def __repr__(self):return f"Int8SymmetricTensor(int_data={repr(self.int_data)}, scale={repr(self.scale)})"
1
2
1
8
0
81
82
81
null
[]
None
null
0
0
0
null
0
null
The function (__repr__) defined within the public class called public.The function start at line 81 and ends at 82. 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_float
def from_float(float_tensor):int8_tensor, scale = int8_symmetric_quantize(float_tensor)return Int8SymmetricTensor(int8_tensor, scale)
1
3
1
20
0
93
95
93
null
[]
None
null
0
0
0
null
0
null
The function (from_float) defined within the public class called public.The function start at line 93 and ends at 95. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
__torch_dispatch__
def __torch_dispatch__(cls, func, types, args, kwargs):if kwargs is None:kwargs = {}if func not in op_implementations_dict:raise AssertionError(f"Int8SymmetricTensor does not yet support op: {str(func)}")return op_implementations_dict[func](func, *args, **kwargs)
3
8
5
48
0
101
108
101
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 101 and ends at 108. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [101.0] and does not return any value..
pytorch_ao
public
public
0
0
register_op.impl_decorator
def impl_decorator(op_impl):global op_implementations_dictfor op in ops:op_implementations_dict[op] = op_implreturn op_impl
2
5
1
20
0
117
121
117
null
[]
None
null
0
0
0
null
0
null
The function (register_op.impl_decorator) defined within the public class called public.The function start at line 117 and ends at 121. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
pytorch_ao
public
public
0
0
register_op
def register_op(ops: List[torch._ops.OpOverload]):def impl_decorator(op_impl):global op_implementations_dictfor op in ops:op_implementations_dict[op] = op_implreturn op_implreturn impl_decorator
1
3
1
18
0
116
123
116
null
[]
None
null
0
0
0
null
0
null
The function (register_op) defined within the public class called public.The function start at line 116 and ends at 123. 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
int8_mm
def int8_mm(func, x, weight):assert isinstance(weight, Int8SymmetricTensor), ("Int8SymmetricTensor: matmul currently only supports the weight in low precision, not the input!")return torch.mm(x, weight.int_data.to(x.dtype)) * weight.scale
1
5
3
42
0
131
135
131
null
[]
None
null
0
0
0
null
0
null
The function (int8_mm) defined within the public class called public.The function start at line 131 and ends at 135. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [131.0] and does not return any value..
pytorch_ao
public
public
0
0
int8_view_ops
def int8_view_ops(func, *args, **kwargs):assert isinstance(args[0], Int8SymmetricTensor)out_data = func(args[0].int_data, *args[1:], **kwargs)out_scale = func(args[0].scale, *args[1:], **kwargs)out = Int8SymmetricTensor(out_data, out_scale)# "return_and_correct_aliasing" here is needed for torch.compile support.# It ef...
1
6
3
82
3
147
155
147
null
['out', 'out_data', 'out_scale']
None
null
0
0
0
null
0
null
The function (int8_view_ops) defined within the public class called public.The function start at line 147 and ends at 155. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [147.0] and does not return any value..
pytorch_ao
public
public
0
0
__init__
def __init__(self, m: int, n: int, k: int):super().__init__()self.linear1 = torch.nn.Linear(m, n, bias=False)self.linear2 = torch.nn.Linear(n, k, bias=False)
1
4
4
60
0
159
162
159
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 159 and ends at 162. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [159.0] and does not return any value..
pytorch_ao
public
public
0
0
forward
def forward(self, x):x = self.linear1(x)x = self.linear2(x)return x
1
4
2
25
0
164
167
164
null
[]
None
null
0
0
0
null
0
null
The function (forward) defined within the public class called public.The function start at line 164 and ends at 167. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [164.0] and does not return any value..
pytorch_ao
public
public
0
0
call
def call(args):(arg0_1,arg1_1,arg2_1,arg3_1,arg4_1,arg5_1,arg6_1,arg7_1,arg8_1,arg9_1,arg10_1,arg11_1,arg12_1,arg13_1,arg14_1,arg15_1,arg16_1,arg17_1,arg18_1,arg19_1,arg20_1,arg21_1,arg22_1,arg23_1,arg24_1,arg25_1,arg26_1,arg27_1,arg28_1,arg29_1,arg30_1,arg31_1,arg32_1,arg33_1,arg34_1,arg35_1,arg36_1,arg37_1,arg38_1,ar...
1
1,571
1
10,773
165
788
2,495
788
null
['buf2', 'buf111', 'buf211', 'buf26', 'buf50', 'buf72', 'buf81', 'buf129', 'buf194', 'buf256', 'buf244', 'buf193', 'buf88', 'buf19', 'buf31', 'buf47', 'buf192', 'buf233', 'buf5', 'buf243', 'buf1', 'buf264', 'buf180', 'buf279', 'buf43', 'buf65', 'buf226', 'buf197', 'buf33', 'buf278', 'buf0', 'buf135', 'buf9', 'buf70', '...
None
null
0
0
0
null
0
null
The function (call) defined within the public class called public.The function start at line 788 and ends at 2495. It contains 1571 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
benchmark_compiled_module
def benchmark_compiled_module(times=10, repeat=10):from torch._dynamo.testing import rand_stridedfrom torch._inductor.utils import print_performancearg0_1 = rand_strided((1, 1, 768), (768, 768, 1), device="cuda:0", dtype=torch.bfloat16)arg1_1 = rand_strided((1, 197, 768), (151296, 768, 1), device="cuda:0", dtype=torch....
1
364
2
4,157
154
2,498
2,862
2,498
null
['arg3_1', 'arg131_1', 'arg74_1', 'arg91_1', 'arg68_1', 'arg14_1', 'arg13_1', 'arg105_1', 'arg1_1', 'arg8_1', 'arg24_1', 'arg41_1', 'arg52_1', 'arg95_1', 'arg61_1', 'arg118_1', 'arg87_1', 'arg71_1', 'arg18_1', 'arg9_1', 'arg34_1', 'arg111_1', 'arg141_1', 'arg142_1', 'arg127_1', 'arg81_1', 'arg90_1', 'arg26_1', 'arg70_1...
None
null
0
0
0
null
0
null
The function (benchmark_compiled_module) defined within the public class called public.The function start at line 2498 and ends at 2862. It contains 364 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [2498.0] and does not return any value..
pytorch_ao
public
public
0
0
call
def call(args):(arg0_1,arg1_1,arg2_1,arg3_1,arg4_1,arg5_1,arg6_1,arg7_1,arg8_1,arg9_1,arg10_1,arg11_1,arg12_1,arg13_1,arg14_1,arg15_1,arg16_1,arg17_1,arg18_1,arg19_1,arg20_1,arg21_1,arg22_1,arg23_1,arg24_1,arg25_1,arg26_1,arg27_1,arg28_1,arg29_1,arg30_1,arg31_1,arg32_1,arg33_1,arg34_1,arg35_1,arg36_1,arg37_1,arg38_1,ar...
1
2,079
1
11,475
216
1,378
3,607
1,378
null
['buf184', 'buf251', 'buf2', 'buf351', 'buf137', 'buf200', 'buf229', 'buf72', 'buf299', 'buf314', 'buf344', 'buf133', 'buf194', 'buf256', 'buf144', 'buf31', 'buf279', 'buf271', 'buf386', 'buf5', 'buf1', 'buf76', 'buf281', 'buf61', 'buf43', 'buf252', 'buf65', 'buf207', 'buf309', 'buf226', 'buf350', 'buf107', 'buf197', '...
None
null
0
0
0
null
0
null
The function (call) defined within the public class called public.The function start at line 1378 and ends at 3607. It contains 2079 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
benchmark_compiled_module
def benchmark_compiled_module(times=10, repeat=10):from torch._dynamo.testing import rand_stridedfrom torch._inductor.utils import print_performancearg0_1 = rand_strided((1, 1, 768), (768, 768, 1), device="cuda:0", dtype=torch.bfloat16)arg1_1 = rand_strided((1, 197, 768), (151296, 768, 1), device="cuda:0", dtype=torch....
1
406
2
5,119
191
3,610
4,016
3,610
null
['arg3_1', 'arg131_1', 'arg74_1', 'arg91_1', 'arg68_1', 'arg14_1', 'arg13_1', 'arg105_1', 'arg1_1', 'arg171_1', 'arg8_1', 'arg24_1', 'arg41_1', 'arg52_1', 'arg95_1', 'arg61_1', 'arg118_1', 'arg87_1', 'arg179_1', 'arg189_1', 'arg71_1', 'arg18_1', 'arg9_1', 'arg34_1', 'arg111_1', 'arg141_1', 'arg142_1', 'arg127_1', 'arg8...
None
null
0
0
0
null
0
null
The function (benchmark_compiled_module) defined within the public class called public.The function start at line 3610 and ends at 4016. It contains 406 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [3610.0] and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
async_setup_platform
async def async_setup_platform(hass: HomeAssistant,config: ConfigType,async_add_entities: AddEntitiesCallback,discovery_info: DiscoveryInfoType | None = None,# noqa: ARG001) -> None:"""Set up the Car Wash sensor."""# Print startup message_LOGGER.info(STARTUP_MESSAGE)async_add_entities([ApparentTemperatureSensor(config....
1
16
4
67
0
80
98
80
null
[]
None
null
0
0
0
null
0
null
The function (async_setup_platform) defined within the public class called public.The function start at line 80 and ends at 98. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [80.0] and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
__init__
def __init__(self, unique_id: str | None, name: str | None, sources: list[str]) -> None:"""Class initialization."""self._attr_unique_id = unique_idself._attr_native_value = Noneself._name = nameself._sources = sourcesself._temp = Noneself._humd = Noneself._wind = Noneself._temp_val = Noneself._humd_val = Noneself._wind...
1
13
4
77
0
112
127
112
null
[]
None
null
0
0
0
null
0
null
The function (__init__) defined within the public class called public.The function start at line 112 and ends at 127. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [112.0] and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
_compose_name
def _compose_name(source_name: str) -> str:"""Compose entity name based on source entity name."""tpos = source_name.rfind("temperature")return (source_name + " Apparent Temperature"if tpos < 0else source_name[:tpos] + "Apparent " + source_name[tpos:])
2
7
1
42
0
130
137
130
null
[]
None
null
0
0
0
null
0
null
The function (_compose_name) defined within the public class called public.The function start at line 130 and ends at 137. It contains 7 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
name
def name(self) -> str | UndefinedType | None:"""Return the name of the sensor."""if self._name:return self._namereturn self._compose_name(split_entity_id(self._sources[0])[1])
2
4
1
39
0
140
145
140
null
[]
None
null
0
0
0
null
0
null
The function (name) defined within the public class called public.The function start at line 140 and ends at 145. 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..
Limych_ha-apparent-temperature
public
public
0
0
extra_state_attributes
def extra_state_attributes(self) -> Mapping[str, Any] | None:"""Return entity specific state attributes."""return {ATTR_TEMPERATURE_SOURCE: self._temp,ATTR_TEMPERATURE_SOURCE_VALUE: self._temp_val,ATTR_HUMIDITY_SOURCE: self._humd,ATTR_HUMIDITY_SOURCE_VALUE: self._humd_val,ATTR_WIND_SPEED_SOURCE: self._wind,ATTR_WIND_SP...
1
9
1
54
0
148
157
148
null
[]
None
null
0
0
0
null
0
null
The function (extra_state_attributes) defined within the public class called public.The function start at line 148 and ends at 157. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
_setup_sources
def _setup_sources(self) -> list[str]:"""Set sources for entity and return list of sources to track."""entities = set()for entity_id in self._sources:state: State = self.hass.states.get(entity_id)domain = split_entity_id(state.entity_id)[0]device_class = state.attributes.get(ATTR_DEVICE_CLASS)unit_of_measurement = stat...
12
41
1
247
0
159
202
159
null
[]
None
null
0
0
0
null
0
null
The function (_setup_sources) defined within the public class called public.The function start at line 159 and ends at 202. It contains 41 lines of code and it has a cyclomatic complexity of 12. The function does not take any parameters and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
async_added_to_hass.sensor_state_listener
def sensor_state_listener(event: Event) -> None:# noqa: ARG001"""Handle device state changes."""self.async_schedule_update_ha_state(force_refresh=True)
1
2
1
18
0
209
211
209
null
[]
None
null
0
0
0
null
0
null
The function (async_added_to_hass.sensor_state_listener) defined within the public class called public.The function start at line 209 and ends at 211. 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..
Limych_ha-apparent-temperature
public
public
0
0
async_added_to_hass.sensor_startup
def sensor_startup(event: Event) -> None:# noqa: ARG001"""Update entity on startup."""async_track_state_change_event(self.hass, self._setup_sources(), sensor_state_listener)self.async_schedule_update_ha_state(force_refresh=True)# Force first update
1
7
1
32
0
215
223
215
null
[]
None
null
0
0
0
null
0
null
The function (async_added_to_hass.sensor_startup) defined within the public class called public.The function start at line 215 and ends at 223. 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..
Limych_ha-apparent-temperature
public
public
0
0
async_added_to_hass
async def async_added_to_hass(self) -> None:"""Register callbacks."""# pylint: disable=unused-argument@callbackdef sensor_state_listener(event: Event) -> None:# noqa: ARG001"""Handle device state changes."""self.async_schedule_update_ha_state(force_refresh=True)# pylint: disable=unused-argument@callbackdef sensor_start...
1
6
1
28
0
204
225
204
null
[]
None
null
0
0
0
null
0
null
The function (async_added_to_hass) defined within the public class called public.The function start at line 204 and ends at 225. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
_has_state
def _has_state(state: str | None) -> bool:"""Return True if state has any value."""return state is not None and state not in [STATE_UNKNOWN,STATE_UNAVAILABLE,"None","",]
2
7
1
31
0
228
235
228
null
[]
None
null
0
0
0
null
0
null
The function (_has_state) defined within the public class called public.The function start at line 228 and ends at 235. It contains 7 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
_get_temperature
def _get_temperature(self, entity_id: str | None) -> float | None:"""Get temperature value (in °C) from entity."""if entity_id is None:return Nonestate: State = self.hass.states.get(entity_id)if state is None:return Nonedomain = split_entity_id(state.entity_id)[0]if domain == WEATHER_DOMAIN:temperature = state.attribut...
7
26
2
170
0
237
267
237
null
[]
None
null
0
0
0
null
0
null
The function (_get_temperature) defined within the public class called public.The function start at line 237 and ends at 267. It contains 26 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [237.0] and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
_get_humidity
def _get_humidity(self, entity_id: str | None) -> float | None:"""Get humidity value from entity."""if entity_id is None:return Nonestate: State = self.hass.states.get(entity_id)if state is None:return Nonedomain = split_entity_id(state.entity_id)[0]if domain == WEATHER_DOMAIN:humidity = state.attributes.get(ATTR_WEATH...
6
16
2
108
0
269
288
269
null
[]
None
null
0
0
0
null
0
null
The function (_get_humidity) defined within the public class called public.The function start at line 269 and ends at 288. It contains 16 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [269.0] and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
_get_wind_speed
def _get_wind_speed(self, entity_id: str | None) -> float | None:"""Get wind speed value from entity."""if entity_id is None:return 0.0state: State = self.hass.states.get(entity_id)if state is None:return 0.0domain = split_entity_id(state.entity_id)[0]if domain == WEATHER_DOMAIN:wind_speed = state.attributes.get(ATTR_W...
6
23
2
149
0
290
317
290
null
[]
None
null
0
0
0
null
0
null
The function (_get_wind_speed) defined within the public class called public.The function start at line 290 and ends at 317. It contains 23 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [290.0] and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
async_update
async def async_update(self) -> None:"""Update sensor state."""self._temp_val = temp = self._get_temperature(self._temp)# °Cself._humd_val = humd = self._get_humidity(self._humd)# %self._wind_val = wind = self._get_wind_speed(self._wind)# m/s_LOGGER.debug("Temp: %s °CHum: %s %%Wind: %s m/s", temp, humd, wind)if temp is...
4
23
1
161
0
319
346
319
null
[]
None
null
0
0
0
null
0
null
The function (async_update) defined within the public class called public.The function start at line 319 and ends at 346. It contains 23 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
_auto_enable_custom_integrations
def _auto_enable_custom_integrations(enable_custom_integrations) -> None:"""Automatically enable loading custom integrations in all tests."""return
1
2
1
9
0
29
31
29
null
[]
None
null
0
0
0
null
0
null
The function (_auto_enable_custom_integrations) defined within the public class called public.The function start at line 29 and ends at 31. 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..
Limych_ha-apparent-temperature
public
public
0
0
_skip_notifications_fixture
def _skip_notifications_fixture() -> None:"""Skip notification calls."""with (patch("homeassistant.components.persistent_notification.async_create"),patch("homeassistant.components.persistent_notification.async_dismiss"),):yield
1
6
0
22
0
38
44
38
null
[]
None
null
0
0
0
null
0
null
The function (_skip_notifications_fixture) defined within the public class called public.The function start at line 38 and ends at 44. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
async_setup_test_entities
async def async_setup_test_entities(hass: HomeAssistant):"""Mock weather entity."""assert await async_setup_component(hass,"weather",{"weather": {"platform": "template","name": "test_monitored","condition_template": "{{ 0 }}","temperature_template": "{{ 12 }}",ATTR_WEATHER_TEMPERATURE_UNIT: UnitOfTemperature.CELSIUS,"h...
1
105
1
332
0
48
156
48
null
[]
None
null
0
0
0
null
0
null
The function (async_setup_test_entities) defined within the public class called public.The function start at line 48 and ends at 156. It contains 105 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
Limych_ha-apparent-temperature
public
public
0
0
test__setup_sources
async def test__setup_sources(hass: HomeAssistant):"""Test setup sensor sources."""await async_setup_test_entities(hass)entity = ApparentTemperatureSensor(None, TEST_NAME, TEST_SOURCES)entity.hass = hassassert entity._temp is Noneassert entity._humd is Noneassert entity._wind is Noneentity._temp = entity._humd = entity...
1
39
1
228
1
159
207
159
null
['entity']
None
null
0
0
0
null
0
null
The function (test__setup_sources) defined within the public class called public.The function start at line 159 and ends at 207. It contains 39 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..