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_tops_info | def get_tops_info(tops, time, peak_tops):time_sec = time / 1e6tops_sec = float(tops) / time_secpct_top_peak = tops_sec / peak_topsreturn tops_sec, pct_top_peak | 1 | 5 | 3 | 31 | 3 | 46 | 50 | 46 | null | ['time_sec', 'pct_top_peak', 'tops_sec'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_tops_info) defined within the public class called public.The function start at line 46 and ends at 50. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [46.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | do_fp8_matmul | def do_fp8_matmul(A, B, fp8_dtype, out_dtype):scale_a = torch.tensor([1], device="cuda", dtype=torch.float32)scale_b = torch.tensor([1], device="cuda", dtype=torch.float32)a_config = ScaledMMConfig(emulate=False, use_fast_accum=True, fp8_output=True, pad_inner_dim=True)b_config = ScaledMMConfig(emulate=False, use_fast_... | 1 | 26 | 4 | 149 | 6 | 53 | 81 | 53 | null | ['scale_a', 'b_fp8', 'b_config', 'scale_b', 'a_fp8', 'a_config'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (do_fp8_matmul) defined within the public class called public.The function start at line 53 and ends at 81. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [53.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | do_fp8_pad_first_matmul | def do_fp8_pad_first_matmul(A, B, fp8_dtype, out_dtype):# Breaks with compile due to trying to pad on fp8 dtype# return do_fp8_matmul(A, B, fp8_dtype, out_dtype)A_pad = pad_tensor_for_matmul(A, dims=1)# mem copyB_pad = pad_tensor_for_matmul(B, dims=0)# mem copyscale_a = torch.tensor([1], device="cuda", dtype=torch.floa... | 1 | 11 | 4 | 123 | 4 | 84 | 100 | 84 | null | ['B_pad', 'scale_b', 'scale_a', 'A_pad'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (do_fp8_pad_first_matmul) defined within the public class called public.The function start at line 84 and ends at 100. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [84.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | do_hp_matmul | def do_hp_matmul(A, B):return torch.matmul(A, B) | 1 | 2 | 2 | 16 | 0 | 103 | 104 | 103 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (do_hp_matmul) defined within the public class called public.The function start at line 103 and ends at 104. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [103.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | do_aligned_bf16_matmul | def do_aligned_bf16_matmul(A, B):A_pad = pad_tensor_for_matmul(A, dims=1)B_pad = pad_tensor_for_matmul(B, dims=0)return torch.matmul(A_pad, B_pad) | 1 | 4 | 2 | 36 | 2 | 107 | 110 | 107 | null | ['B_pad', 'A_pad'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (do_aligned_bf16_matmul) 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 1. It takes 2 parameters, represented as [107.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __iter__ | def __iter__(self):return iter((self.M, self.K, self.N, self.output_dtype, self.fp8_dtype)) | 1 | 2 | 1 | 30 | 0 | 121 | 122 | 121 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__iter__) defined within the public class called public.The function start at line 121 and ends at 122. 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 | gen_configs | def gen_configs():shapes = shapes = [(8193, 2501, 5008),(65, 253, 4096),(1023, 1029, 2512),(4095, 511, 10000),(2047, 3073, 8192),(511, 769, 7504),(127, 4097, 12288),(32769, 15, 15024),(9217, 8191, 20480),(16385, 1025, 25008),]output_dtype = torch.bfloat16fp8_dtype = torch.float8_e4m3fnreturn [Experiment_config(*shape, ... | 2 | 16 | 0 | 116 | 3 | 125 | 140 | 125 | null | ['output_dtype', 'fp8_dtype', 'shapes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (gen_configs) defined within the public class called public.The function start at line 125 and ends at 140. It contains 16 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run | def run(compile: bool = False, n_limit: Optional[int] = None):device = "cuda"experiments = gen_configs()results = []tops_table = []tops_headers = ["Shape","Ref Dtype","Ref Tops","Aligned BF16 Tops","FP8 Tops","Ref % Peak","Aligned BF16 % Peak","FP8 % Peak",]for experiment in tqdm(experiments):M, K, N, output_dtype, fp8... | 5 | 75 | 2 | 365 | 15 | 144 | 224 | 144 | null | ['tops_table', 'results', 'hp_func', 'aligned_bf16_time', 'device', 'A_base', 'B_base', 'tops_headers', 'headers', 'fp8_time', 'fp8_func', 'experiments', 'tops', 'aligned_bf16_func', 'ref_time'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run) defined within the public class called public.The function start at line 144 and ends at 224. It contains 75 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [144.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_gpu_kernel_time | def get_gpu_kernel_time(m, x):# warm upfor _ in range(2):__ = m(x)# capture a profiling runactivities = [ProfilerActivity.CPU, ProfilerActivity.CUDA]n_iter = 5with profile(activities=activities) as prof:for _ in range(n_iter):__ = m(x)torch.cuda.synchronize()# get the gpu kernel time and aggregate itnum_leaf_tensors = ... | 4 | 15 | 2 | 111 | 6 | 54 | 72 | 54 | null | ['ref_times', '__', 'activities', 'n_iter', 'total_time_s', 'num_leaf_tensors'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_gpu_kernel_time) defined within the public class called public.The function start at line 54 and ends at 72. It contains 15 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [54.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_gemm_times.do_matmul | def do_matmul(A, B):return torch._scaled_mm(A, B, scale_a, scale_b, out_dtype=d3, use_fast_accum=fast_accum) | 1 | 4 | 2 | 28 | 0 | 109 | 112 | 109 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_gemm_times.do_matmul) defined within the public class called public.The function start at line 109 and ends at 112. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [109.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_gemm_times | def get_gemm_times(M: int,K: int,N: int,fast_accum: bool,float8_recipe_name: Optional[str],):device = torch.device("cuda")# bf16 timex_bf16 = torch.randn(M, K, dtype=torch.bfloat16, device=device)# w_bf16 = torch.randn(K, N, dtype=torch.bfloat16, device=device).t().contiguous().t()w_bf16 = torch.randn(K, N, dtype=torch... | 5 | 31 | 5 | 262 | 10 | 75 | 116 | 75 | null | ['bf16_time_s', 'scale_a', 'e4m3_dtype', 'x_bf16', 'B', 'device', 'f8_time_s', 'scale_b', 'w_bf16', 'A'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_gemm_times) defined within the public class called public.The function start at line 75 and ends at 116. It contains 31 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [75.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run | def run(outfile: str,do_benchmarks: bool = True,shape_gen_name: str = "pow2",n_limit: Optional[int] = None,float8_recipe_name: Optional[str] = None,):"""Args:* `do_benchmarks`: if True, gemm and e2e fwd+bwd of LNLinearSigmoid are benchmarked* `shape_gen_name`: `llama`, `pow2`, `pow2_extended`, or `sweep`* `n_limit (opt... | 6 | 121 | 5 | 608 | 21 | 119 | 294 | 119 | null | ['config', 'b_bf16_e2e_time_s', 'r_fp8_ovhd_time_s', 'r_fp8_gemm_time_s', 'r_bf16_gemm_time_s', 'b_fp8_e2e_time_s', 'fp8_gemm_time_sympy', 'results', 'b_bf16_gemm_time_s', 'm_orig', 'name_to_shapes', 'x', 'headers', 'bf16_gemm_time_sympy', 'b_fp8_gemm_time_s', 'df', 'rb_fp8_gemm_ratio', 'm_bf16', 'fp8_ovhd_time_sympy',... | None | null | 0 | 0 | 0 | null | 0 | null | The function (run) defined within the public class called public.The function start at line 119 and ends at 294. It contains 121 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [119.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, fc_dim1, fc_dim2):super().__init__()self.ln = torch.nn.LayerNorm(fc_dim1, elementwise_affine=False)self.fc = torch.nn.Linear(fc_dim1, fc_dim2, bias=False)self.sigmoid = torch.nn.Sigmoid() | 1 | 5 | 3 | 61 | 0 | 74 | 78 | 74 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 74 and ends at 78. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [74.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x):x = self.ln(x)x = self.fc(x)x = self.sigmoid(x)return x | 1 | 5 | 2 | 33 | 0 | 80 | 84 | 80 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 80 and ends at 84. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [80.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_gpu_kernel_time | def get_gpu_kernel_time(m, x, grad_output):# warm upfor _ in range(2):y = m(x)y.backward(grad_output)# capture a profiling runactivities = [ProfilerActivity.CPU, ProfilerActivity.CUDA]n_iter = 5with profile(activities=activities) as prof:for _ in range(n_iter):y = m(x)y.backward(grad_output)torch.cuda.synchronize()# ge... | 4 | 17 | 3 | 125 | 6 | 87 | 107 | 87 | null | ['ref_times', 'activities', 'n_iter', 'total_time_s', 'y', 'num_leaf_tensors'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_gpu_kernel_time) defined within the public class called public.The function start at line 87 and ends at 107. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [87.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_gemm_times.do_matmul | def do_matmul(A, B):return torch._scaled_mm(A, B, scale_a, scale_b, out_dtype=d3, use_fast_accum=fast_accum) | 1 | 4 | 2 | 28 | 0 | 185 | 188 | 185 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_gemm_times.do_matmul) defined within the public class called public.The function start at line 185 and ends at 188. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [185.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_gemm_times | def get_gemm_times(gemm_role: str,M: int,K: int,N: int,fast_accum: bool,bf16_memory_formats: str,float8_recipe_name: Optional[str],mx_recipe_name: Optional[str],cache_filename=None,):assert gemm_role in ("output", "grad_input", "grad_weight"), "unsupported"assert bf16_memory_formats in ("row_major:col_major","row_major... | 16 | 66 | 9 | 520 | 12 | 110 | 198 | 110 | null | ['bf16_time_s', 'scale_a', 'e4m3_dtype', 'x_bf16', 'cache', 'B', 'device', 'key', 'f8_time_s', 'scale_b', 'w_bf16', 'A'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_gemm_times) defined within the public class called public.The function start at line 110 and ends at 198. It contains 66 lines of code and it has a cyclomatic complexity of 16. It takes 9 parameters, represented as [110.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run | def run(outfile: str,do_benchmarks: bool = True,shape_gen_name: str = "pow2",gemm_cache_filename: Optional[str] = None,n_limit: Optional[int] = None,float8_recipe_name: Optional[str] = None,mx_recipe_name: Optional[str] = None,enable_fusion_modeling: bool = False,):"""Args:* `do_benchmarks`: if True, gemm and e2e fwd+b... | 11 | 166 | 8 | 816 | 23 | 201 | 424 | 201 | null | ['config', 'b_bf16_e2e_time_s', 'r_fp8_ovhd_time_s', 'float8_recipe_name', 'r_fp8_gemm_time_s', 'r_bf16_gemm_time_s', 'b_fp8_e2e_time_s', 'fp8_gemm_time_sympy', 'results', 'b_bf16_gemm_time_s', 'm_orig', 'name_to_shapes', 'x', 'headers', 'bf16_gemm_time_sympy', 'b_fp8_gemm_time_s', 'grad_output', 'df', 'rb_fp8_gemm_rat... | None | null | 0 | 0 | 0 | null | 0 | null | The function (run) defined within the public class called public.The function start at line 201 and ends at 424. It contains 166 lines of code and it has a cyclomatic complexity of 11. It takes 8 parameters, represented as [201.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, fc_dim1, fc_dim2):super().__init__()self.ln = torch.nn.LayerNorm(fc_dim1, elementwise_affine=False)self.fc = torch.nn.Linear(fc_dim1, fc_dim2, bias=False) | 1 | 4 | 3 | 50 | 0 | 60 | 63 | 60 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 60 and ends at 63. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [60.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x):x = self.ln(x)x = self.fc(x)return x | 1 | 4 | 2 | 25 | 0 | 65 | 68 | 65 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) 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. It takes 2 parameters, represented as [65.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, dim: int, eps: float = 1e-6):super().__init__()self.eps = epsself.weight = nn.Parameter(torch.ones(dim)) | 1 | 4 | 3 | 44 | 0 | 86 | 89 | 86 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 86 and ends at 89. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [86.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _norm | def _norm(self, x: torch.Tensor):return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps) | 1 | 2 | 2 | 39 | 0 | 91 | 92 | 91 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_norm) defined within the public class called public.The function start at line 91 and ends at 92. It contains 2 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 | forward | def forward(self, x: torch.Tensor):output = self._norm(x.float()).type_as(x)return output * self.weight | 1 | 3 | 2 | 34 | 0 | 94 | 96 | 94 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 94 and ends at 96. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [94.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | reset_parameters | def reset_parameters(self):torch.nn.init.ones_(self.weight)# type: ignore | 1 | 2 | 1 | 17 | 0 | 98 | 99 | 98 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (reset_parameters) defined within the public class called public.The function start at line 98 and ends at 99. 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 | __init__ | def __init__(self,dim: int,hidden_dim: int,multiple_of: int,ffn_dim_multiplier: Optional[float],):super().__init__()hidden_dim = int(2 * hidden_dim / 3)# custom dim factor multiplierif ffn_dim_multiplier is not None:hidden_dim = int(ffn_dim_multiplier * hidden_dim)hidden_dim = multiple_of * ((hidden_dim + multiple_of -... | 2 | 15 | 5 | 117 | 0 | 120 | 136 | 120 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 120 and ends at 136. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [120.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x):return self.w2(F.silu(self.w1(x)) * self.w3(x)) | 1 | 2 | 2 | 31 | 0 | 138 | 139 | 138 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 138 and ends at 139. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [138.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | init_weights | def init_weights(self, init_std: float):nn.init.trunc_normal_(self.w1.weight, mean=0.0, std=0.02)for linear in (self.w2, self.w3):nn.init.trunc_normal_(linear.weight, mean=0.0, std=init_std) | 2 | 4 | 2 | 66 | 0 | 141 | 144 | 141 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (init_weights) defined within the public class called public.The function start at line 141 and ends at 144. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [141.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, dim, hidden_dim, multiple_of, ffn_dim_multiplier):super().__init__()self.ffn_norm = RMSNorm(dim)self.ffn = FeedForward(dim, hidden_dim, multiple_of, ffn_dim_multiplier)self.attn_norm = RMSNorm(dim) | 1 | 5 | 5 | 50 | 0 | 154 | 158 | 154 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 154 and ends at 158. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [154.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, h):# end of transformer block nx = self.ffn_norm(h)x = self.ffn(x)x = h + x# start of transformer block n + 1x = self.attn_norm(x)return x | 1 | 6 | 2 | 38 | 0 | 160 | 167 | 160 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 160 and ends at 167. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [160.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | profile_function | def profile_function(config: ProfileConfig,func: Callable,add_inductor_metadata_to_trace: bool,*args,**kwargs,) -> torch.profiler.profile:"""Profile a torch function and save the result to a file"""seed = 123random.seed(seed)torch.manual_seed(seed)if add_inductor_metadata_to_trace:# ensure we aren't interfering with ot... | 13 | 55 | 5 | 322 | 4 | 184 | 259 | 184 | null | ['activities', 'profile_memory', 'name_context', 'seed'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (profile_function) defined within the public class called public.The function start at line 184 and ends at 259. It contains 55 lines of code and it has a cyclomatic complexity of 13. It takes 5 parameters, represented as [184.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | policy_fn | def policy_fn(ctx, op, *args, **kwargs):if op in ops_to_save:return CheckpointPolicy.MUST_SAVEelse:return CheckpointPolicy.PREFER_RECOMPUTE | 2 | 5 | 4 | 28 | 0 | 269 | 273 | 269 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (policy_fn) defined within the public class called public.The function start at line 269 and ends at 273. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [269.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main.cast_with_to_blocked | def cast_with_to_blocked(x_hp):x_mx = MXTensor.to_mx(x_hp,config.elem_dtype,config.block_size,gemm_kernel_choice=config.gemm_kernel_choice,)m, k = x_hp.shapescale_blocked = to_blocked(x_mx._scale_e8m0.reshape(m, k // config.block_size))return x_mx._data, scale_blocked | 1 | 10 | 1 | 55 | 0 | 387 | 396 | 387 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main.cast_with_to_blocked) defined within the public class called public.The function start at line 387 and ends at 396. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main.cast_only_dim0_dim1 | def cast_only_dim0_dim1(x_hp):x_hp_t_c = x_hp.t().contiguous()x_mx_dim0 = MXTensor.to_mx(x_hp,config.elem_dtype,config.block_size,gemm_kernel_choice=config.gemm_kernel_choice,)x_mx_dim1 = MXTensor.to_mx(x_hp_t_c,config.elem_dtype,config.block_size,gemm_kernel_choice=config.gemm_kernel_choice,)return x_mx_dim0, x_mx_dim... | 1 | 15 | 1 | 66 | 0 | 399 | 413 | 399 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main.cast_only_dim0_dim1) defined within the public class called public.The function start at line 399 and ends at 413. 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 | main.ref_forw_backward | def ref_forw_backward(x):assert mode_filter not in ("cast_only", "cast_with_to_blocked"), "unsupported"if enable_activation_checkpointing:out = checkpoint(m_ref, x, use_reentrant=False, context_fn=context_fn)else:out = m_ref(x)if mode_filter == "fwd_bwd":out.backward(grad_output) | 3 | 8 | 1 | 54 | 0 | 421 | 428 | 421 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main.ref_forw_backward) defined within the public class called public.The function start at line 421 and ends at 428. It contains 8 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 | main.lowp_forw_backward_wrapper | def lowp_forw_backward_wrapper(x):if mode_filter == "cast_only":# just cast and return early_input_tensor_mx = to_mx_func(input_tensor,config.elem_dtype,config.block_size,gemm_kernel_choice=config.gemm_kernel_choice,)returnelif mode_filter == "cast_with_to_blocked":_input_tensor_mx, scale = cast_with_to_blocked(input_t... | 6 | 24 | 1 | 105 | 0 | 430 | 455 | 430 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main.lowp_forw_backward_wrapper) defined within the public class called public.The function start at line 430 and ends at 455. It contains 24 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main(profile_path_prefix: pathlib.Path,compile: bool = True,float8_recipe_name: Optional[str] = None,mx_recipe_name: Optional[str] = None,model_type: str = "linear",experiment_filter: str = "both",add_inductor_metadata_to_trace: bool = False,enable_activation_checkpointing: bool = False,mode_filter: str = "fwd_bwd"... | 30 | 257 | 10 | 1,249 | 42 | 279 | 631 | 279 | null | ['config', '_', 'trace_lowp_path', 'profile_iters', 'context', 'f', 'x_mx_dim0', 'trace_lowp_modified_path', 'ref_trace_suffix', 'p', 'x_mx', 'ref_times', 'cast_only_dim0_dim1', 'total_time_ms', 'ref_dtype', '_input_tensor_mx', 'device', 'profile_config', 'x_mx_dim1', 'x_hp_t_c', 'm_ref', 'out', 'log_lowp_path', 'v_ms'... | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 279 and ends at 631. It contains 257 lines of code and it has a cyclomatic complexity of 30. It takes 10 parameters, represented as [279.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | invoke_main | def invoke_main() -> None:# Example usage: python benchmarks/profile_linear_float8.py benchmarks/data/profiles/current_profile --compile=True --linear_type="dynamic"# You can set TORCHINDUCTOR_PROFILE=1 to also capture triton kernel bandwidthfire.Fire(main) | 1 | 2 | 0 | 12 | 0 | 634 | 637 | 634 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (invoke_main) defined within the public class called public.The function start at line 634 and ends at 637. 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 | profiler_output_to_filtered_time_by_kernel_name | def profiler_output_to_filtered_time_by_kernel_name(prof,num_iter: int,num_leaf_tensors: int,):"""Input:* `prof`: a profiler with captured events* `num_iter`: number of iterations used to capture `prof`* `num_leaf_tensors`: number of leaf tensors to accumulate gradients toOutput: a deduplicated list of GPU time in nano... | 9 | 27 | 3 | 133 | 3 | 16 | 92 | 16 | null | ['key_averages', 'kernel_name_to_gpu_time_us', 'thresh'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (profiler_output_to_filtered_time_by_kernel_name) defined within the public class called public.The function start at line 16 and ends at 92. It contains 27 lines of code and it has a cyclomatic complexity of 9. It takes 3 parameters, represented as [16.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | profiler_output_to_gpu_time_for_key | def profiler_output_to_gpu_time_for_key(prof, key):"""Input: an event nameOutput: sum of GPU time of all events with that name in `prof`This is useful to get the total time of a user annotation"""total = 0for e in prof.profiler.function_events:if e.key == key:total += e.device_time_totalreturn total | 3 | 6 | 2 | 34 | 1 | 95 | 106 | 95 | null | ['total'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (profiler_output_to_gpu_time_for_key) defined within the public class called public.The function start at line 95 and ends at 106. It contains 6 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [95.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | kernel_name_to_category | def kernel_name_to_category(k):# number prefix is for easy sortingif k in ("aten::mm","aten::addmm","aten::_scaled_mm","torchao::mx_fp8_bf16","torchao::mx_fp4_bf16",):return "0_gemm"else:return "1_other" | 2 | 11 | 1 | 27 | 0 | 109 | 120 | 109 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (kernel_name_to_category) defined within the public class called public.The function start at line 109 and ends at 120. It contains 11 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | parse_bw_and_kernel_name | def parse_bw_and_kernel_name(line):"""Input: a single line of stdout of TORCHINDUCTOR_PROFILE=1 output, such as0.257ms 0.537 GB 2092.43GB/s triton_red_fused_native_layer_norm_0Output: the bandwidth value and the kernel name, or None and None"""result = re.search(".* ([0-9\.]+)GB/s.*(triton_[a-z_0-9]+)", line)if result:... | 2 | 6 | 1 | 39 | 1 | 123 | 133 | 123 | null | ['result'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (parse_bw_and_kernel_name) defined within the public class called public.The function start at line 123 and ends at 133. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_name_to_shapes_iter | def get_name_to_shapes_iter(shape_gen_name: str,M: Optional[int],K: Optional[int],N: Optional[int],):if shape_gen_name == "llama":assert M == K == N == None, (f"M, K, N arguments not supported for shape_gen_name {shape_gen_name}")bsz, seq_len = 4, 4096M = bsz * seq_len# LLaMa 2 70B single-node weight shapes# assumes fu... | 13 | 69 | 4 | 421 | 13 | 136 | 212 | 136 | null | ['max_power_of_2', 'counter', 'name_to_shapes', 'name_to_shapes_70b', 'max_p2', 'val2', 'val1', 'N', 'min_power_of_2', 'min_p2', 'M', 'val', 'K'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_name_to_shapes_iter) defined within the public class called public.The function start at line 136 and ends at 212. It contains 69 lines of code and it has a cyclomatic complexity of 13. It takes 4 parameters, represented as [136.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_name_to_moe_shapes_iter | def get_name_to_moe_shapes_iter(shape_gen_name: str,M: Optional[int] = None,K: Optional[int] = None,N: Optional[int] = None,E: Optional[int] = None,):M = 16640 if M is None else Mif shape_gen_name == "llama4_17bx16e":# num_experts=16, dim=5120names_to_shapes = {# M, K, N, E"moe.experts.w1": (M, 5120, 8192, 16),"moe.exp... | 8 | 29 | 5 | 192 | 3 | 215 | 248 | 215 | null | ['M', 'name_to_shapes', 'names_to_shapes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_name_to_moe_shapes_iter) defined within the public class called public.The function start at line 215 and ends at 248. It contains 29 lines of code and it has a cyclomatic complexity of 8. It takes 5 parameters, represented as [215.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | update_triton_kernels_in_prof_chome_trace_with_torch_logs | def update_triton_kernels_in_prof_chome_trace_with_torch_logs(perf_trace_file: str,torch_logs_file: str,modified_perf_trace_file: str,):"""Input 1: a perf trace generated by using `torch.profiler.profile` inside ofsome_program.py, and containing torch.compile + inductor kernelsInput 2: a text file with the output ofTOR... | 16 | 53 | 3 | 361 | 18 | 252 | 377 | 252 | null | ['line', 'is_triton_kernel', 'torch_logs_only', 'triton_code', 'cur_start', 'op_name', 'match_start', 'cur_name', 'cur_end', 'torch_logs_str', 'match_name', 'name_to_start_end', 'match', 'match_end', 's', 'external_id_to_cpu_op', 'is_cpu_op', 'perf_trace'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (update_triton_kernels_in_prof_chome_trace_with_torch_logs) defined within the public class called public.The function start at line 252 and ends at 377. It contains 53 lines of code and it has a cyclomatic complexity of 16. It takes 3 parameters, represented as [252.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_gpu_kernel_gemm_time_s | def get_gpu_kernel_gemm_time_s(f, *args, **kwargs):# warmupf(*args, **kwargs)n_iter = 5with profile(activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA]) as prof:for idx in range(n_iter):f(*args, **kwargs)data = profiler_output_to_filtered_time_by_kernel_name(prof, n_iter, num_leaf_tensors=0)# there is only 1 key, ... | 2 | 19 | 3 | 114 | 2 | 380 | 400 | 380 | null | ['n_iter', 'data'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_gpu_kernel_gemm_time_s) defined within the public class called public.The function start at line 380 and ends at 400. It contains 19 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [380.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | benchmark_fn_in_sec | def benchmark_fn_in_sec(f, *args, **kwargs):# Manual warmupfor _ in range(4):f(*args, **kwargs)t0 = benchmark.Timer(stmt="f(*args, **kwargs)", globals={"args": args, "kwargs": kwargs, "f": f})measurement = t0.blocked_autorange()return measurement.mean | 2 | 8 | 3 | 64 | 2 | 403 | 411 | 403 | null | ['measurement', 't0'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (benchmark_fn_in_sec) defined within the public class called public.The function start at line 403 and ends at 411. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [403.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | do_benchmarks | def do_benchmarks(tops,peak_tops,use_gpu_kernel_time,f,*args,**kwargs,):if use_gpu_kernel_time:# just the gemm GPU kerneltime_sec = get_gpu_kernel_gemm_time_s(f, *args, **kwargs)else:# e2e time including kernel launch overheadtime_sec = benchmark_fn_in_sec(f, *args, **kwargs)tops_sec = float(tops) / time_secpct_top_pea... | 2 | 15 | 6 | 66 | 3 | 414 | 430 | 414 | null | ['time_sec', 'pct_top_peak', 'tops_sec'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (do_benchmarks) defined within the public class called public.The function start at line 414 and ends at 430. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [414.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main(args: Namespace):print("\n=====================================================")print(" Calculating training performance metrics")print("=====================================================")log_pattern = re.compile(r"step:.*?(\d+).*?memory:.*?([\d.]+)GiB.*?tps:.*?([\d,]+)")assert os.path.exists(args.log_fil... | 4 | 21 | 1 | 160 | 9 | 21 | 53 | 21 | null | ['matches', 'max_memory_usage', 'step', 'memory_usage', 'tokens_per_second', 'median_tps', 'log_data', 'log_pattern', 'tps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 21 and ends at 53. It contains 21 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 | benchmark_fn_in_usec | def benchmark_fn_in_usec(f, *args, **kwargs):no_args = lambda: f(*args, **kwargs)time = do_bench_using_profiling(no_args)return time * 1e3 | 1 | 4 | 3 | 33 | 2 | 18 | 21 | 18 | null | ['no_args', 'time'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (benchmark_fn_in_usec) defined within the public class called public.The function start at line 18 and ends at 21. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [18.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run | def run(torch_compile_mode: str = "default"):M, K, N = 1024, 2048, 4096x = torch.randn(M, K, device="cuda", dtype=torch.bfloat16)m = nn.Sequential(nn.Linear(K, N, device="cuda", dtype=torch.bfloat16))quantize_(m, Float8DynamicActivationFloat8WeightConfig(granularity=PerRow()))m = torch.compile(m, mode=torch_compile_mod... | 1 | 11 | 1 | 124 | 4 | 24 | 36 | 24 | null | ['x', 'm', '_', 'time_us'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run) defined within the public class called public.The function start at line 24 and ends at 36. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _make_cache_key | def _make_cache_key(config: BenchmarkConfig) -> Tuple:"""Create a key for caching based on benchmark configuration.Parameters that affect baseline performance are included:* model type (e.g. ``linear`` or ``transformer_block``)* shape dimensions (m, k, n)* high precision dtype (bf16, fp16, etc.)* device (cuda, cpu, mps... | 1 | 10 | 1 | 41 | 0 | 53 | 76 | 53 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_make_cache_key) defined within the public class called public.The function start at line 53 and ends at 76. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run | def run(config: BenchmarkConfig) -> BenchmarkResult:"""Run inference benchmarks.The function first checks if a baseline for the given configurationalready exists in the internal cache.If not, it measures the baselineinference time and stores the result.When the baseline is cached,the function reuses the cached baseline... | 18 | 134 | 1 | 638 | 9 | 79 | 273 | 79 | null | ['compile_baseline_time', 'm_copy', 'profiler_json_path', 'eager_baseline_time', 'is_cuda', 'cache_key', 'memory_profiler_dir', 'result', 'ao_base_config'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run) defined within the public class called public.The function start at line 79 and ends at 273. It contains 134 lines of code and it has a cyclomatic complexity of 18. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_shapes_for_config | def get_shapes_for_config(shape_configs: List[Dict[str, Any]],) -> List[Tuple[str, List[int]]]:"""Get shapes for a given configuration.Args:shape_configs: List of shape configurations from YAMLReturns:List of tuples containing (shape_name, shape)"""shapes = []for shape_config in shape_configs:name = shape_config["name"... | 19 | 62 | 1 | 526 | 14 | 35 | 110 | 35 | null | ['max_power_of_2', 'counter', 'shapes', 'max_p2', 'llama_shapes', 'val2', 'val1', 'N', 'min_power_of_2', 'name', 'M', 'val', 'min_p2', 'K'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_shapes_for_config) defined within the public class called public.The function start at line 35 and ends at 110. It contains 62 lines of code and it has a cyclomatic complexity of 19. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_param_combinations | def get_param_combinations(model_param):"""Extract all parameter combinations from a model config"""# Get all shapesshapes = get_shapes_for_config(model_param["matrix_shapes"])# Extract all other parameters (excluding matrix_shapes)base_params = {key: value for key, value in model_param.items() if key not in ["matrix_s... | 3 | 6 | 1 | 43 | 2 | 113 | 123 | 113 | null | ['base_params', 'shapes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_param_combinations) defined within the public class called public.The function start at line 113 and ends at 123. 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 | get_quantization_sparsity_recipes | def get_quantization_sparsity_recipes(quantization_recipes: List[str], sparsity_recipes: List[str]) -> Set[Tuple[str, Optional[str]]]:"""Generate valid quantization and sparsity recipes.Args:quantization_recipes: List of quantization recipessparsity_recipes: List of sparsity recipesReturns:Set of tuples containing (qua... | 12 | 23 | 2 | 130 | 1 | 126 | 167 | 126 | null | ['config_recipes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_quantization_sparsity_recipes) defined within the public class called public.The function start at line 126 and ends at 167. It contains 23 lines of code and it has a cyclomatic complexity of 12. It takes 2 parameters, represented as [126.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | load_benchmark_configs | def load_benchmark_configs(cli_args: argparse.Namespace) -> List[BenchmarkConfig]:"""Load benchmark configurations from CLI arguments and YAML file."""with open(cli_args.config, "r") as f:config = yaml.safe_load(f)output_dir = config.get("output_dir", "benchmarks/microbenchmarks/results")benchmark_mode = config.get("be... | 3 | 28 | 1 | 159 | 5 | 170 | 203 | 170 | null | ['configs', 'config', 'benchmark_mode', 'quantization_sparsity_recipes', 'output_dir'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (load_benchmark_configs) defined within the public class called public.The function start at line 170 and ends at 203. It contains 28 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 | run_inference_benchmarks_from_config | def run_inference_benchmarks_from_config(configs: List[BenchmarkConfig]) -> None:"""Run benchmarks using configurations from YAML file"""from benchmarks.microbenchmarks.benchmark_inference import run as run_inferenceresults = []print("----------------- RUNNING BENCHMARKS FOR INFERENCE -----------------------")for confi... | 5 | 21 | 1 | 100 | 2 | 206 | 231 | 206 | null | ['results', 'result'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_inference_benchmarks_from_config) defined within the public class called public.The function start at line 206 and ends at 231. It contains 21 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 | _validate_pickle_file | def _validate_pickle_file(file_path):"""Validate if the pickle file is valid and can be read."""try:with open(file_path, "rb") as f:pickle.load(f)except (pickle.UnpicklingError, FileNotFoundError, EOFError) as e:print(f"Error: Pickle file {file_path} is invalid or cannot be read. {e}")return Falsereturn True | 2 | 8 | 1 | 46 | 0 | 13 | 21 | 13 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_validate_pickle_file) defined within the public class called public.The function start at line 13 and ends at 21. It contains 8 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 | generate_model_profile | def generate_model_profile(model, input_data, profile_file_path):"""Function to benchmark model evaluation with profiling.Args:model: The model to profileinput_data: Input data for the modelprofile_file_path: Path to save the profiler outputReturns:profile_file_path"""# Create parent directory if it doesn't existos.mak... | 7 | 29 | 3 | 195 | 3 | 24 | 72 | 24 | null | ['activities', '_', 'device'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (generate_model_profile) defined within the public class called public.The function start at line 24 and ends at 72. It contains 29 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [24.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | generate_memory_profile | def generate_memory_profile(model, input_data, profile_file_path):"""Function to generate CUDA memory profile.Args:model: The model to profileinput_data: Input data for the modelprofile_file_path: Path to save the memory profile (.pickle)Returns:str: Path to the saved profile file."""if not torch.cuda.is_available():pr... | 9 | 42 | 3 | 287 | 3 | 75 | 146 | 75 | null | ['_', '_memory_stats', 'memory_stats'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (generate_memory_profile) defined within the public class called public.The function start at line 75 and ends at 146. It contains 42 lines of code and it has a cyclomatic complexity of 9. It takes 3 parameters, represented as [75.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | visualize_memory_profile | def visualize_memory_profile(profile_file_path):"""Visualize memory profile using matplotlib.Args:profile_file_path: Path to the memory profile file (.pickle)Returns:str: Path to the visualization HTML file"""# Create parent directory if it doesn't existmemory_visualization_path = profile_file_path.replace("pickle", "h... | 2 | 17 | 1 | 102 | 2 | 149 | 179 | 149 | null | ['data', 'memory_visualization_path'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (visualize_memory_profile) defined within the public class called public.The function start at line 149 and ends at 179. It contains 17 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_default_device | def get_default_device(device: str = "cuda") -> str:if device == "cuda" and torch.cuda.is_available():return "cuda"elif device == "xpu" and torch.xpu.is_available():return "xpu"elif device == "mps" and torch.backends.mps.is_available():return "mps"elif device == "cpu":return "cpu"else:print(f"Warning: Running on CPU as... | 8 | 12 | 1 | 74 | 0 | 41 | 52 | 41 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_default_device) defined within the public class called public.The function start at line 41 and ends at 52. It contains 12 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,quantization: Optional[str],# Quantization string format is similar to the format being used for llama/generate.pysparsity: Optional[str],# Specify the type of sparsity to be usedparams: Dict[str, Any],shape_name: str,shape: List[int],output_dir: str,benchmark_mode: str,):self.benchmark_mode = benchma... | 1 | 33 | 8 | 217 | 0 | 56 | 89 | 56 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 56 and ends at 89. It contains 33 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [56.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _parse_precision | def _parse_precision(precision_str: str) -> torch.dtype:"""Convert string precision to torch dtype"""return getattr(torch, precision_str.split(".")[-1]) | 1 | 2 | 1 | 28 | 0 | 92 | 94 | 92 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_parse_precision) defined within the public class called public.The function start at line 92 and ends at 94. 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 | to_dict | def to_dict(self) -> Dict[str, Any]:"""Convert config to dictionary for main function"""return {"name": self.name,"quantization": self.quantization,"sparsity": self.sparsity,"m": self.m,"k": self.k,"n": self.n,"high_precision_dtype": self.high_precision_dtype,"torch_compile_mode": self.torch_compile_mode,"device": self... | 1 | 16 | 1 | 94 | 0 | 96 | 112 | 96 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_dict) defined within the public class called public.The function start at line 96 and ends at 112. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,config: BenchmarkConfig,):self.config = configself.output_dir = config.output_dirself.baseline_model_eager_inference_time_in_ms = 0.0self.quantized_model_eager_inference_time_in_ms = 0.0self.baseline_model_compiled_inference_time_in_ms = 0.0self.quantized_model_compiled_inference_time_in_ms = 0.0self.... | 1 | 17 | 2 | 116 | 0 | 116 | 132 | 116 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 116 and ends at 132. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [116.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | to_dict | def to_dict(self) -> Dict[str, Any]:"""Convert config to dictionary for main function"""return {"name": self.name,"quantization": self.quantization,"sparsity": self.sparsity,"m": self.m,"k": self.k,"n": self.n,"high_precision_dtype": self.high_precision_dtype,"torch_compile_mode": self.torch_compile_mode,"device": self... | 1 | 16 | 1 | 94 | 0 | 134 | 150 | 96 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_dict) defined within the public class called public.The function start at line 134 and ends at 150. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | string_to_config | def string_to_config(quantization: Optional[str], sparsity: Optional[str], **kwargs) -> AOBaseConfig:"""Get quantization config based on quantization string.Args:quantization (str): Quantization method to be used. The quantiation string format is similar to the format being used for llama/generate.py.sparsity (str): Sp... | 44 | 135 | 3 | 763 | 12 | 153 | 312 | 153 | null | ['use_hqq', 'granularity', 'group_size', 'params', 'bit_width', 'dtype', '_quant_args', 'nbits', 'high_precision_dtype', 'weight_dtype', '_NBITS_TO_DTYPE', 'is_asymmetric'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (string_to_config) defined within the public class called public.The function start at line 153 and ends at 312. It contains 135 lines of code and it has a cyclomatic complexity of 44. It takes 3 parameters, represented as [153.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | model_inference_time_in_ms | def model_inference_time_in_ms(model, input_data):"""Benchmark model inference time without compile overhead.Args:model: The model to benchmarkinput_data: Input data for the modelReturns:float: Median inference time in milliseconds"""# First run to trigger any compilation/lazy initializationtimer = Timer(stmt="model(in... | 1 | 10 | 2 | 64 | 3 | 316 | 341 | 316 | null | ['measurement', 'res', 'timer'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (model_inference_time_in_ms) defined within the public class called public.The function start at line 316 and ends at 341. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [316.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | clean_caches | def clean_caches():import gc# Clear everything before startinggc.collect()if torch.cuda.is_available():torch.cuda.empty_cache()torch.cuda.reset_peak_memory_stats()if hasattr(torch, "_dynamo"):torch._dynamo.reset() | 3 | 8 | 0 | 49 | 0 | 344 | 355 | 344 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (clean_caches) defined within the public class called public.The function start at line 344 and ends at 355. It contains 8 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 | generate_results_csv | def generate_results_csv(results: List[BenchmarkResult],output_dir: str,file_name: Optional[str] = None,):"""Generate a CSV file with the results of the benchmarking.Args:results (List[BenchmarkResult]): List Dictionary containing the results of the benchmarking with the config.output_dir (str): Directory to save the C... | 4 | 19 | 3 | 143 | 4 | 358 | 392 | 358 | null | ['file_path', 'writer', 'file_name', 'header'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (generate_results_csv) defined within the public class called public.The function start at line 358 and ends at 392. It contains 19 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [358.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | print_results | def print_results(results: List[BenchmarkResult]):"""Print results in a table format"""if not results:print("No results to display")returntable_data = []for result in results:if result is None:continuerow = [result.config.name,result.config.quantization or "baseline",result.config.sparsity or "none",f"{result.config.sh... | 7 | 42 | 1 | 156 | 3 | 395 | 443 | 395 | null | ['headers', 'row', 'table_data'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 395 and ends at 443. It contains 42 lines of code and it has a cyclomatic complexity of 7. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | setUp | def setUp(self):# Create temporary directoryself.temp_dir = tempfile.mkdtemp()self.config = BenchmarkConfig(quantization="baseline",sparsity="semi-sparse",params={"high_precision_dtype": "torch.float32","device": "cpu","model_type": "linear",},shape_name="custom",shape=[16, 32, 8],# Small shape for testingoutput_dir=se... | 1 | 15 | 1 | 70 | 0 | 15 | 31 | 15 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (setUp) defined within the public class called public.The function start at line 15 and ends at 31. 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 | tearDown | def tearDown(self):# Clean up temporary directoryimport shutilshutil.rmtree(self.temp_dir) | 1 | 3 | 1 | 15 | 0 | 33 | 37 | 33 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (tearDown) defined within the public class called public.The function start at line 33 and ends at 37. 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 | test_run_inference | def test_run_inference(self, mock_string_to_config):# Mock string_to_config to return a valid configfrom torchao.sparsity.sparse_api import SemiSparseWeightConfigmock_string_to_config.return_value = SemiSparseWeightConfig()result = run(self.config)self.assertIsInstance(result, BenchmarkResult)self.assertTrue(hasattr(re... | 1 | 8 | 2 | 49 | 0 | 40 | 50 | 40 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_run_inference) defined within the public class called public.The function start at line 40 and ends at 50. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [40.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_run_inference_with_semi_sparse_marlin | def test_run_inference_with_semi_sparse_marlin(self, mock_string_to_config):"""Test running inference with sparsity configurations"""# Mock string_to_config to return valid configsfrom torchao.dtypes import MarlinSparseLayoutfrom torchao.quantization import Int4WeightOnlyConfig# Test with semi-sparse configmock_string_... | 1 | 25 | 2 | 116 | 0 | 53 | 81 | 53 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_run_inference_with_semi_sparse_marlin) defined within the public class called public.The function start at line 53 and ends at 81. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [53.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_run_inference_with_block_sparsity | def test_run_inference_with_block_sparsity(self, mock_string_to_config):"""Test running inference with sparsity configurations"""# Mock string_to_config to return valid configsfrom torchao.sparsity.sparse_api import (BlockSparseWeightConfig,)# Test with block sparsitymock_string_to_config.return_value = BlockSparseWeig... | 1 | 23 | 2 | 105 | 0 | 84 | 110 | 84 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_run_inference_with_block_sparsity) defined within the public class called public.The function start at line 84 and ends at 110. It contains 23 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [84.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | setUp | def setUp(self):self.test_dir = os.path.dirname(os.path.abspath(__file__))self.results_dir = os.path.join(self.test_dir, "results")os.makedirs(self.results_dir, exist_ok=True)# Set up a simple model and input for testingself.m, self.k, self.n = 1024, 1024, 1024self.dtype = torch.bfloat16self.model = ToyLinearModel(k=se... | 2 | 11 | 1 | 163 | 0 | 27 | 41 | 27 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (setUp) defined within the public class called public.The function start at line 27 and ends at 41. It contains 11 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | tearDown | def tearDown(self):# Clean up any generated filesimport shutilif os.path.exists(self.results_dir):shutil.rmtree(self.results_dir) | 2 | 4 | 1 | 27 | 0 | 43 | 48 | 43 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (tearDown) defined within the public class called public.The function start at line 43 and ends at 48. 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 | test_profiler_enabled | def test_profiler_enabled(self):"""Test that profiler works when enabled"""config = BenchmarkConfig(quantization=None,sparsity=None,params={"enable_profiler": True,"device": self.device,},shape_name="test",shape=[self.m, self.k, self.n],output_dir=self.results_dir,benchmark_mode="inference",)profile_path = os.path.join... | 1 | 24 | 1 | 148 | 0 | 50 | 81 | 50 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_profiler_enabled) defined within the public class called public.The function start at line 50 and ends at 81. It contains 24 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_profiler_basic_output | def test_profiler_basic_output(self):"""Test that profiler output contains expected basic fields"""config = BenchmarkConfig(quantization=None,sparsity=None,params={"enable_profiler": True,"device": self.device,},shape_name="test",shape=[self.m, self.k, self.n],output_dir=self.results_dir,benchmark_mode="inference",)pro... | 1 | 29 | 1 | 189 | 0 | 83 | 121 | 83 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_profiler_basic_output) defined within the public class called public.The function start at line 83 and ends at 121. It contains 29 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_cuda_profiling | def test_cuda_profiling(self):"""Test CUDA profiling when available"""config = BenchmarkConfig(quantization=None,sparsity=None,params={"enable_profiler": True,"device": "cuda",},shape_name="test",shape=[self.m, self.k, self.n],output_dir=self.results_dir,benchmark_mode="inference",)profile_path = os.path.join(self.resu... | 3 | 27 | 1 | 152 | 0 | 124 | 156 | 124 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_cuda_profiling) defined within the public class called public.The function start at line 124 and ends at 156. It contains 27 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_memory_profiler_enabled | def test_memory_profiler_enabled(self):"""Test that memory profiler works when enabled and CUDA is available"""config = BenchmarkConfig(quantization=None,sparsity=None,params={"enable_memory_profiler": True,"device": "cuda",},shape_name="test",shape=[self.m, self.k, self.n],output_dir=self.results_dir,benchmark_mode="i... | 2 | 29 | 1 | 162 | 0 | 159 | 195 | 159 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_memory_profiler_enabled) defined within the public class called public.The function start at line 159 and ends at 195. It contains 29 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_memory_profiler_visualization | def test_memory_profiler_visualization(self):"""Test memory profile visualization"""config = BenchmarkConfig(quantization=None,sparsity=None,params={"enable_memory_profiler": True,"device": "cuda",},shape_name="test",shape=[self.m, self.k, self.n],output_dir=self.results_dir,benchmark_mode="inference",)memory_profile_p... | 1 | 35 | 1 | 179 | 0 | 198 | 243 | 198 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_memory_profiler_visualization) defined within the public class called public.The function start at line 198 and ends at 243. It contains 35 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_memory_profiler_cuda_unavailable | def test_memory_profiler_cuda_unavailable(self):"""Test memory profiler behavior when CUDA is not available"""# Save original torch.cuda.is_available functionoriginal_is_available = torch.cuda.is_availabletry:# Mock torch.cuda.is_available to return Falsetorch.cuda.is_available = lambda: Falseconfig = BenchmarkConfig(q... | 2 | 29 | 1 | 137 | 0 | 245 | 285 | 245 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_memory_profiler_cuda_unavailable) defined within the public class called public.The function start at line 245 and ends at 285. It contains 29 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 | setUp | def setUp(self):# Create temporary directoryself.temp_dir = tempfile.mkdtemp()self.test_config = {"benchmark_mode": "inference","quantization_config_recipe_names": ["baseline", "int8wo"],"output_dir": self.temp_dir,# Use temp directory"model_params": [{"name": "test_model","matrix_shapes": [{"name": "custom","shapes": ... | 1 | 25 | 1 | 122 | 0 | 24 | 50 | 24 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (setUp) defined within the public class called public.The function start at line 24 and ends at 50. It contains 25 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | tearDown | def tearDown(self):# Clean up temporary directory and all its contentsimport shutilshutil.rmtree(self.temp_dir) | 1 | 3 | 1 | 15 | 0 | 52 | 56 | 52 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (tearDown) defined within the public class called public.The function start at line 52 and ends at 56. 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 | test_get_shapes_for_config | def test_get_shapes_for_config(self):# Test custom shapesshapes = get_shapes_for_config(self.test_config["model_params"][0]["matrix_shapes"])self.assertEqual(len(shapes), 1)self.assertEqual(shapes[0], ("custom", [1024, 1024, 1024]))# Test llama shapesllama_shapes = get_shapes_for_config([{"name": "llama"}])self.assertE... | 7 | 54 | 1 | 443 | 0 | 58 | 123 | 58 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_get_shapes_for_config) defined within the public class called public.The function start at line 58 and ends at 123. It contains 54 lines of code and it has a cyclomatic complexity of 7. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_get_param_combinations | def test_get_param_combinations(self):model_param = self.test_config["model_params"][0]shapes, params = get_param_combinations(model_param)self.assertEqual(len(shapes), 1)self.assertEqual(shapes[0], ("custom", [1024, 1024, 1024]))self.assertEqual(params["high_precision_dtype"], "torch.bfloat16") | 1 | 6 | 1 | 67 | 0 | 125 | 131 | 125 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_get_param_combinations) defined within the public class called public.The function start at line 125 and ends at 131. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_load_benchmark_configs | def test_load_benchmark_configs(self, mock_args):mock_args.config = str(self.config_path)configs = load_benchmark_configs(mock_args)self.assertEqual(len(configs), 2)# 2 quantization configsself.assertEqual(configs[0].benchmark_mode, "inference")self.assertEqual(configs[0].device, "cpu") | 1 | 6 | 2 | 60 | 0 | 134 | 140 | 134 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_load_benchmark_configs) defined within the public class called public.The function start at line 134 and ends at 140. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [134.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_run_inference_benchmarks_from_config | def test_run_inference_benchmarks_from_config(self):configs = load_benchmark_configs(argparse.Namespace(config=str(self.config_path)))run_inference_benchmarks_from_config(configs)# The results file is saved in the inference subdirectory with a timestamp-based nameinference_dir = Path(self.temp_dir) / "inference"self.as... | 1 | 9 | 1 | 73 | 0 | 142 | 154 | 142 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_run_inference_benchmarks_from_config) defined within the public class called public.The function start at line 142 and ends at 154. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_get_quantization_sparsity_recipes | def test_get_quantization_sparsity_recipes(self):"""Test generation of valid quantization and sparsity recipe combinations"""# Test basic combinationsquant_recipes = ["baseline", "int8wo"]sparse_recipes = [None, "semi-sparse"]recipes = get_quantization_sparsity_recipes(quant_recipes, sparse_recipes)self.assertIn(("base... | 1 | 16 | 1 | 142 | 0 | 156 | 177 | 156 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_get_quantization_sparsity_recipes) defined within the public class called public.The function start at line 156 and ends at 177. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_none_string_raises_error | def test_none_string_raises_error(self):"""Test that passing 'None' as a string raises an error"""quant_recipes = ["baseline"]sparse_recipes = ["None"]# "None" as a string should raise an errorwith self.assertRaises(ValueError):get_quantization_sparsity_recipes(quant_recipes, sparse_recipes) | 1 | 5 | 1 | 30 | 0 | 179 | 184 | 179 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_none_string_raises_error) defined within the public class called public.The function start at line 179 and ends at 184. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_block_sparsity_with_quantization | def test_block_sparsity_with_quantization(self):"""Test that block sparsity is only paired with baseline quantization"""quant_recipes = ["baseline", "int8wo", "int4wo", "marlin"]sparse_recipes = ["block"]recipes = get_quantization_sparsity_recipes(quant_recipes, sparse_recipes)# Block sparsity should only be paired wit... | 1 | 12 | 1 | 126 | 0 | 186 | 202 | 186 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_block_sparsity_with_quantization) defined within the public class called public.The function start at line 186 and ends at 202. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_all_quantization_without_sparsity | def test_all_quantization_without_sparsity(self):"""Test that all quantization techniques are run without sparsity"""quant_recipes = ["baseline", "int8wo", "int4wo", "marlin"]sparse_recipes = [None, "semi-sparse", "block"]recipes = get_quantization_sparsity_recipes(quant_recipes, sparse_recipes)# All quantization techn... | 2 | 6 | 1 | 51 | 0 | 204 | 212 | 204 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_all_quantization_without_sparsity) defined within the public class called public.The function start at line 204 and ends at 212. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_load_benchmark_configs_with_sparsity | def test_load_benchmark_configs_with_sparsity(self, mock_get_recipes):"""Test loading benchmark configs with sparsity options"""# Mock get_quantization_sparsity_recipes to return a valid set of recipesmock_get_recipes.return_value = {("baseline", None), ("marlin", "semi-sparse")}test_config = {"benchmark_mode": "infere... | 5 | 34 | 2 | 187 | 0 | 217 | 257 | 217 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_load_benchmark_configs_with_sparsity) defined within the public class called public.The function start at line 217 and ends at 257. It contains 34 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [217.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | setUp | def setUp(self):self.test_params = {"name": "test_model","high_precision_dtype": "torch.bfloat16","torch_compile_mode": "max-autotune","device": "cpu","model_type": "linear",}self.test_shape = [1024, 1024, 1024]self.test_output_dir = Path("test_output") | 1 | 10 | 1 | 50 | 0 | 32 | 41 | 32 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (setUp) defined within the public class called public.The function start at line 32 and ends at 41. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_benchmark_config | def test_benchmark_config(self):config = BenchmarkConfig(quantization="baseline",sparsity=None,params=self.test_params,shape_name="custom",shape=self.test_shape,output_dir=str(self.test_output_dir),benchmark_mode="inference",)self.assertEqual(config.quantization, "baseline")self.assertEqual(config.m, 1024)self.assertEq... | 1 | 19 | 1 | 139 | 0 | 43 | 62 | 43 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_benchmark_config) defined within the public class called public.The function start at line 43 and ends at 62. It contains 19 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_benchmark_result | def test_benchmark_result(self):config = BenchmarkConfig(quantization="baseline",sparsity=None,params=self.test_params,shape_name="custom",shape=self.test_shape,output_dir=str(self.test_output_dir),benchmark_mode="inference",)result = BenchmarkResult(config=config)self.assertEqual(result.config, config)self.assertEqual... | 1 | 13 | 1 | 77 | 0 | 64 | 77 | 64 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_benchmark_result) defined within the public class called public.The function start at line 64 and ends at 77. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_get_default_device | def test_get_default_device(self):# Test CPU fallbackdevice = get_default_device("not_a_real_device")self.assertEqual(device, "cpu")# Test explicit CPU requestdevice = get_default_device("cpu")self.assertEqual(device, "cpu") | 1 | 5 | 1 | 33 | 0 | 79 | 86 | 79 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_get_default_device) defined within the public class called public.The function start at line 79 and ends at 86. 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.. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.