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 | main.upload_image | async def upload_image(image: UploadFile = File(...)):image_tensor = file_bytes_to_image_tensor(bytearray(await image.read()))response_future = asyncio.Future()await request_queue.put((image_tensor, response_future))masks = await response_future# Create figure and ensure it's closed after generating responsefig = plt.f... | 1 | 18 | 1 | 144 | 0 | 685 | 706 | 685 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main.upload_image) defined within the public class called public.The function start at line 685 and ends at 706. It contains 18 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main(checkpoint_path,model_type,baseline=False,fast=False,furious=False,autoquant_type=None,min_sqnr=None,unittest=False,benchmark=False,profile=None,memory_profile=None,verbose=False,points_per_batch=64,port=5000,host="127.0.0.1",dry=False,batch_size=1,load_fast="",save_fast="",output_json_path=None,output_json_lo... | 28 | 226 | 21 | 986 | 23 | 426 | 709 | 426 | null | ['masks', 'response_future', 'all_masks', 'memory_result', 'mask_generator', 'device', 'app', 'sam2', 'write_json_result', 'num_repeat', 'fig', 'image_tensor', 'headers', 'dtype', 'output_format', 'compile', 'name', 'result', 'arch', 'random_images', 'performance_result', 'buf', 'ref_masks'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 426 and ends at 709. It contains 226 lines of code and it has a cyclomatic complexity of 28. It takes 21 parameters, represented as [426.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,predictor: Optional[SAM2VideoPredictor],batch_size=1,aoti_compiled_model=None,furious=False,):super().__init__()self.predictor = predictorself.batch_size = batch_sizeself.aoti_compiled_model = aoti_compiled_modelself.furious = furious | 1 | 12 | 5 | 52 | 0 | 25 | 36 | 25 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 25 and ends at 36. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [25.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self,backbone_features,point_inputs=None,mask_inputs=None,high_res_features=None,multimask_output=False,):assert mask_inputs is Noneassert multimask_outputif self.predictor is None:assert self.aoti_compiled_model is not Nonereturn self.aoti_compiled_model(backbone_features=backbone_features,point_inputs=poi... | 2 | 26 | 6 | 98 | 0 | 38 | 63 | 38 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 38 and ends at 63. It contains 26 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [38.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | aot_compile | def aot_compile(model_directory,name,fn,sample_args,sample_kwargs=None,options=None,overwrite=False,):path = Path(model_directory) / Path(f"{name}.pt2")if path.exists() and not overwrite:raise ValueError(f"{path} already exists and overwrite is {overwrite}")print(f"Saving at {path=}")if options is None:options = {"max_... | 4 | 26 | 7 | 121 | 4 | 66 | 91 | 66 | null | ['output_path', 'exported', 'options', 'path'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (aot_compile) defined within the public class called public.The function start at line 66 and ends at 91. It contains 26 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [66.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | aot_load | def aot_load(path):return torch._export.aot_load(path, "cuda") | 1 | 2 | 1 | 16 | 0 | 94 | 95 | 94 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (aot_load) defined within the public class called public.The function start at line 94 and ends at 95. 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, module, fn_name):super().__init__()self.module = moduleself.fn_name = fn_name | 1 | 4 | 3 | 26 | 0 | 99 | 102 | 99 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 99 and ends at 102. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [99.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, *args):return getattr(self.module, self.fn_name)(*args) | 1 | 2 | 2 | 23 | 0 | 104 | 105 | 104 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 104 and ends at 105. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [104.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | export_model | def export_model(predictor,model_directory,furious=False,batch_size=1,overwrite=False,):if furious:set_furious(predictor)example_input = torch.empty(batch_size, 3, 1024, 1024)# example_input = example_input.to(predictor._image_dtype)example_input = example_input.to(torch.bfloat16)# example_input = (example_input.to(pre... | 2 | 60 | 5 | 215 | 4 | 108 | 176 | 108 | null | ['sam2_video_forward_sam_heads', 'example_input', 'example_input_kwargs', 'example_input_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (export_model) defined within the public class called public.The function start at line 108 and ends at 176. It contains 60 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [108.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, aoti_compiled_model):super().__init__()self.aoti_compiled_model = aoti_compiled_model | 1 | 3 | 2 | 19 | 0 | 180 | 182 | 180 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 180 and ends at 182. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [180.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, *args, **kwargs):return self.aoti_compiled_model(*args, **kwargs) | 1 | 2 | 3 | 22 | 0 | 184 | 185 | 184 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 184 and ends at 185. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [184.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, module, fn_name):super().__init__()self.module = moduleself.fn_name = fn_name | 1 | 4 | 3 | 26 | 0 | 189 | 192 | 99 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 189 and ends at 192. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [99.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, *args):return self.aoti_compiled_model(*args) | 1 | 2 | 2 | 16 | 0 | 194 | 195 | 194 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 194 and ends at 195. It contains 2 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 | get_dense_pe | def get_dense_pe(self, *args, **kwargs) -> torch.Tensor:return self.other.get_dense_pe(*args, **kwargs) | 1 | 2 | 3 | 28 | 0 | 197 | 198 | 197 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_dense_pe) defined within the public class called public.The function start at line 197 and ends at 198. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [197.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | load_exported_model | def load_exported_model(predictor,model_directory,furious=False,batch_size=1,):if furious:set_furious(predictor)t0 = time.time()path = Path(model_directory) / Path("sam2_image_encoder_trunk.pt2")assert path.exists(), f"Expected {path} to exist"print(f"Start load from {path}")pkg = torch._inductor.aoti_load_package(str(... | 2 | 28 | 4 | 152 | 4 | 201 | 230 | 201 | null | ['path', 'pkg_m', 't0', 'pkg'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (load_exported_model) defined within the public class called public.The function start at line 201 and ends at 230. It contains 28 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [201.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | set_fast | def set_fast(predictor, loaded_exported_model=False):if not loaded_exported_model:predictor.image_encoder.trunk.forward = torch.compile(predictor.image_encoder.trunk.forward,mode="max-autotune",fullgraph=True,dynamic=False,)if not loaded_exported_model:predictor._forward_sam_heads = torch.compile(predictor._forward_sam... | 3 | 27 | 2 | 129 | 0 | 233 | 259 | 233 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (set_fast) defined within the public class called public.The function start at line 233 and ends at 259. It contains 27 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [233.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | set_furious | def set_furious(mask_generator):mask_generator.predictor.model.image_encoder = (mask_generator.predictor.model.image_encoder.to(torch.float16))# NOTE: Not baseline featuremask_generator.predictor._image_dtype = torch.float16mask_generator.predictor._transforms_device = mask_generator.predictor.devicetorch.set_float32_m... | 1 | 11 | 1 | 92 | 0 | 262 | 274 | 262 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (set_furious) defined within the public class called public.The function start at line 262 and ends at 274. 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 | download_file | def download_file(url, download_dir):# Create the directory if it doesn't existdownload_dir = Path(download_dir)download_dir.mkdir(parents=True, exist_ok=True)# Extract the file name from the URLfile_name = url.split("/")[-1]# Define the full path for the downloaded filefile_path = download_dir / file_name# Download th... | 2 | 12 | 2 | 97 | 4 | 39 | 55 | 39 | null | ['download_dir', 'file_path', 'file_name', 'response'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (download_file) defined within the public class called public.The function start at line 39 and ends at 55. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [39.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | model_type_to_paths | def model_type_to_paths(checkpoint_path, model_type):if model_type not in MODEL_TYPES_TO_MODEL.keys():raise ValueError(f"Expected model_type to be one of {', '.join(MODEL_TYPES_TO_MODEL.keys())} but got {model_type}")sam2_checkpoint = Path(checkpoint_path) / Path(MODEL_TYPES_TO_MODEL[model_type])if not sam2_checkpoint.... | 3 | 14 | 2 | 75 | 2 | 58 | 71 | 58 | null | ['model_cfg', 'sam2_checkpoint'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (model_type_to_paths) defined within the public class called public.The function start at line 58 and ends at 71. It contains 14 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [58.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self):self.start_times = {}self.elapsed_times = defaultdict(list)self.enabled = False | 1 | 4 | 1 | 24 | 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. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | tic | def tic(self, section_name):self.start_times[section_name] = time.time() | 1 | 2 | 2 | 19 | 0 | 91 | 92 | 91 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (tic) 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 | toc | def toc(self, section_name):if section_name in self.start_times:elapsed_time = time.time() - self.start_times[section_name]self.elapsed_times[section_name].append(elapsed_time)del self.start_times[section_name] | 2 | 5 | 2 | 46 | 0 | 94 | 98 | 94 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (toc) defined within the public class called public.The function start at line 94 and ends at 98. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [94.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_average_time | def get_average_time(self, section_name, warmup: int = 1):times = self.elapsed_times.get(section_name, [])times = times[warmup:]return sum(times) / len(times) if times else 0.0 | 2 | 4 | 3 | 49 | 0 | 100 | 103 | 100 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_average_time) defined within the public class called public.The function start at line 100 and ends at 103. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [100.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | reset | def reset(self):self.start_times.clear()self.elapsed_times.clear() | 1 | 3 | 1 | 19 | 0 | 105 | 107 | 105 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (reset) defined within the public class called public.The function start at line 105 and ends at 107. 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 | print_all_timings | def print_all_timings(self, warmup: int = 5):if not self.elapsed_times:timestamped_print("No timings recorded.")returntimestamped_print("Average timings for all sections:")for section_name in self.elapsed_times:average_time = self.get_average_time(section_name, warmup)timestamped_print(f"{section_name}, {average_time *... | 3 | 8 | 2 | 48 | 0 | 109 | 116 | 109 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_all_timings) defined within the public class called public.The function start at line 109 and ends at 116. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [109.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | max_memory_allocated | def max_memory_allocated():max_memory_allocated_bytes = torch.cuda.max_memory_allocated()_, total_memory = torch.cuda.mem_get_info()max_memory_allocated_percentage = int(100 * (max_memory_allocated_bytes / total_memory))max_memory_allocated_bytes = max_memory_allocated_bytes >> 20timestamped_print(f"max_memory_allocate... | 1 | 10 | 0 | 47 | 2 | 122 | 131 | 122 | null | ['max_memory_allocated_bytes', 'max_memory_allocated_percentage'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (max_memory_allocated) defined within the public class called public.The function start at line 122 and ends at 131. 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 | synthesize_video_data | def synthesize_video_data(out_dir: str,radius: int,seed: int,speed: int,width: int,height: int,n_frames: int,x: int,y: int,synthesize_overwrite: bool,):circle_color = (255, 0, 0)# redos.makedirs(out_dir, exist_ok=True)np.random.seed(seed)# Initial position and velocityx = np.random.randint(radius, width - radius)y = np... | 8 | 38 | 10 | 289 | 8 | 134 | 182 | 134 | null | ['img', 'vx', 'vy', 'x', 'filename', 'y', 'circle_color', 'draw'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (synthesize_video_data) defined within the public class called public.The function start at line 134 and ends at 182. It contains 38 lines of code and it has a cyclomatic complexity of 8. It takes 10 parameters, represented as [134.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | profiler_runner | def profiler_runner(path, fn, *args, **kwargs):if path is None:path = os.path.join(os.path.expanduser("~/traces"),f"{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}.json.gz",)with torch.profiler.profile(activities=[torch.profiler.ProfilerActivity.CPU,torch.profiler.ProfilerActivity.CUDA,],record_shapes=True,) as prof:res... | 2 | 17 | 4 | 98 | 2 | 185 | 201 | 185 | null | ['result', 'path'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (profiler_runner) defined within the public class called public.The function start at line 185 and ends at 201. It contains 17 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [185.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main_loop | def main_loop(predictor,inference_state,time_profile=True,accumulate_result=False,count_result=False,):results = []num_output_frames = 0with torch.autograd.profiler.record_function("main_loop"):for out_frame_idx, out_obj_ids, out_mask_logits in predictor.propagate_in_video(inference_state):if accumulate_result:results.... | 7 | 22 | 5 | 90 | 2 | 204 | 225 | 204 | null | ['results', 'num_output_frames'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main_loop) defined within the public class called public.The function start at line 204 and ends at 225. It contains 22 lines of code and it has a cyclomatic complexity of 7. It takes 5 parameters, represented as [204.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | timestamped_print | def timestamped_print(*args, **kwargs):# Get the current timestamptimestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")# Prepend the timestamp to the original print argumentsprint(f"[{timestamp}]: ", *args, **kwargs) | 1 | 3 | 2 | 32 | 1 | 228 | 232 | 228 | null | ['timestamp'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (timestamped_print) defined within the public class called public.The function start at line 228 and ends at 232. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [228.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main(checkpoint_path: str,model_type: str,video_dir="/tmp/segment-anything-2/synth_video",profile=None,radius=50,seed=42,speed=20,width=1024,height=1024,n_frames=200,use_compile=False,batch_size=1,frame_batch_size=1,synthesize=False,synthesize_overwrite=False,store_output="",compare_output="",print_all_timings=Fals... | 19 | 145 | 22 | 770 | 13 | 235 | 397 | 235 | null | ['t0', 'inference_state', 'result', 't', 'device', 'build_sam2_video_predictor', 'start_y', 'rope_attention_modules', 'num_output_frames', 'ref_result', 'start_x', 'inference_states', 'predictor'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 235 and ends at 397. It contains 145 lines of code and it has a cyclomatic complexity of 19. It takes 22 parameters, represented as [235.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main():"""Run torchao binary smoke tests like importing and performing simple ops"""print(dir(torchao)) | 1 | 2 | 0 | 12 | 0 | 11 | 15 | 11 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 11 and ends at 15. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_copyright_header | def get_copyright_header(file_ext: str) -> str:if file_ext in {".cu", ".h", ".cuh", ".cpp", ".metal"}:# C/C++ style files use // commentsreturn "\n".join("// " + line if line else "//" for line in BASE_COPYRIGHT_TEXT.split("\n"))else:# Python and shell scripts use # commentsreturn "\n".join("# " + line if line else "#"... | 6 | 9 | 1 | 70 | 0 | 27 | 37 | 27 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_copyright_header) defined within the public class called public.The function start at line 27 and ends at 37. It contains 9 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 | has_copyright_header | def has_copyright_header(content: str) -> bool:# Check first 16 lines for privacy policyfirst_16_lines = "\n".join(content.split("\n")[:16])return any(re.search(pattern, first_16_lines) for pattern in PRIVACY_PATTERNS) | 2 | 3 | 1 | 42 | 1 | 40 | 43 | 40 | null | ['first_16_lines'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (has_copyright_header) defined within the public class called public.The function start at line 40 and ends at 43. It contains 3 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | add_copyright_header | def add_copyright_header(filename: str) -> None:with open(filename, "r") as f:content = f.read()if not has_copyright_header(content):ext = os.path.splitext(filename)[1]header = get_copyright_header(ext)with open(filename, "w") as f:f.write(header + "\n\n" + content) | 2 | 8 | 1 | 72 | 3 | 46 | 54 | 46 | null | ['content', 'ext', 'header'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_copyright_header) defined within the public class called public.The function start at line 46 and ends at 54. 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 | main | def main(argv: List[str] = None) -> int:parser = argparse.ArgumentParser()parser.add_argument("filenames", nargs="*", help="Filenames to check")args = parser.parse_args(argv)retval = 0for filename in args.filenames:# Skip __init__.py filesif os.path.basename(filename) == "__init__.py":continueext = os.path.splitext(fil... | 5 | 17 | 1 | 122 | 5 | 57 | 79 | 57 | null | ['parser', 'args', 'content', 'ext', 'retval'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 57 and ends at 79. It contains 17 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 | clean_release_notes | def clean_release_notes():"""Main entry point for this script.This function pre-processes the raw release notes and produces a templatewith all the standard sections and pre-sorts the commits into differentcategories based on github labels and commit title keywords."""# Write the header sectionwith open(output_file, "w... | 10 | 42 | 0 | 243 | 5 | 96 | 153 | 96 | null | ['commit_lines', 'commit_start', 'commits_by_category', 'pr_number_to_label', 'category'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (clean_release_notes) defined within the public class called public.The function start at line 96 and ends at 153. It contains 42 lines of code and it has a cyclomatic complexity of 10. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | parse_pr_number | def parse_pr_number(commit_line: str) -> int:"""Helper function to parse PR number from commit line."""return int(re.match(".*pytorch/ao/pull/(.*)", commit_line).groups()[0]) | 1 | 2 | 1 | 29 | 0 | 156 | 160 | 156 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (parse_pr_number) defined within the public class called public.The function start at line 156 and ends at 160. 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 | fetch_pr_labels | def fetch_pr_labels(commit_lines: List[str]) -> Dict[int, str]:"""Fetch the relevant github labels starting with "topic: " from all PRs.If such a label exists for a given PR, store the first one."""pr_number_to_label = {}all_pr_numbers = [parse_pr_number(line) for line in commit_lines]smallest_pr_number = min(all_pr_nu... | 8 | 15 | 1 | 134 | 6 | 163 | 183 | 163 | null | ['repo', 'pulls', 'all_pr_numbers', 'pr_number_to_label', 'labels', 'smallest_pr_number'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (fetch_pr_labels) defined within the public class called public.The function start at line 163 and ends at 183. It contains 15 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 | get_commit_category | def get_commit_category(commit_line: str, pr_number_to_label: Dict[int, str]) -> Optional[str]:"""Assign the commit to a category based on:(1) The github label if it exists(2) Keywords in the PR titleIf the commit is not meant to be user facing, remove None.Otherwise, return "Improvement" by default."""pr_number = pars... | 11 | 23 | 2 | 153 | 2 | 186 | 216 | 186 | null | ['label', 'pr_number'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_commit_category) defined within the public class called public.The function start at line 186 and ends at 216. It contains 23 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [186.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | format_commit | def format_commit(commit_line: str) -> str:"""Format the commit line as follows:Before: * commit title by @userX in https://github.com/pytorch/ao/pull/123After:* Commit title (https://github.com/pytorch/ao/pull/123)"""# Remove author, put PR link in parenthesescommit_line = re.sub(" by @.* in (.*)", r" (\g<1>)", commit... | 1 | 5 | 1 | 51 | 1 | 219 | 230 | 219 | null | ['commit_line'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (format_commit) defined within the public class called public.The function start at line 219 and ends at 230. 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 | convert_hf_checkpoint.permute | def permute(w, n_head):dim = config.dimreturn (w.view(n_head, 2, config.head_dim // 2, dim).transpose(1, 2).reshape(config.head_dim * n_head, dim)) | 1 | 7 | 2 | 45 | 0 | 75 | 81 | 75 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (convert_hf_checkpoint.permute) defined within the public class called public.The function start at line 75 and ends at 81. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [75.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | convert_hf_checkpoint | def convert_hf_checkpoint(*,checkpoint_dir: Path = Path("checkpoints/meta-Transformer/Transformer-2-7b-chat-hf"),model_name: Optional[str] = None,) -> None:if model_name is None:model_name = checkpoint_dir.nameconfig = ModelArgs.from_name(model_name)print(f"Model config {config.__dict__}")# Load the json file containin... | 18 | 96 | 1 | 595 | 21 | 21 | 134 | 21 | null | ['config', 'weight_map', 'model_map_json_pytorch', 'model_map_json_safetensors', 'model_name', 'tokenizer_model_tiktoken', 'bin_index', 'layer_num', 'v', 'tokenizer_model', 'q', 'state_dict', 'abstract_key', 'merged_result', 'dim', 'final_result', 'new_key', 'k', 'model_map_json', 'original_dir', 'bin_files'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (convert_hf_checkpoint) defined within the public class called public.The function start at line 21 and ends at 134. It contains 96 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 | create_weight_map | def create_weight_map(checkpoint_dir: Path):"""This function, create_weight_map, generates a mapping of a model's weights to a file (pytorch_model.bin)and saves this mapping, along with the model's total size, to a JSON file (pytorch_model.bin.index.json).The model is loaded from a pre-trained model specified by model_... | 3 | 19 | 1 | 125 | 5 | 12 | 43 | 12 | null | ['weight_map', 'index_dict', 'state_dict', 'model', 'model_name'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (create_weight_map) defined within the public class called public.The function start at line 12 and ends at 43. It contains 19 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hf_download | def hf_download(repo_id: Optional[str] = None, hf_token: Optional[str] = None) -> None:from huggingface_hub import snapshot_downloados.makedirs(f"checkpoints/{repo_id}", exist_ok=True)try:snapshot_download(repo_id,local_dir=f"checkpoints/{repo_id}",local_dir_use_symlinks=False,token=hf_token,)except HTTPError as e:if e... | 3 | 17 | 2 | 80 | 0 | 14 | 31 | 14 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hf_download) defined within the public class called public.The function start at line 14 and ends at 31. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [14.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 | 19 | 22 | 19 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 19 and ends at 22. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [19.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 | 24 | 27 | 24 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 24 and ends at 27. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [24.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_s3_resource | def get_s3_resource() -> Any:return boto3.resource("s3") | 1 | 2 | 0 | 13 | 0 | 16 | 17 | 16 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_s3_resource) defined within the public class called public.The function start at line 16 and ends at 17. 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 | upload_to_s3 | def upload_to_s3(bucket_name: str,key: str,json_path: str,) -> None:print(f"Writing {json_path} documents to S3")data = []with open(f"{os.path.splitext(json_path)[0]}.json", "r") as f:for l in f.readlines():data.append(json.loads(l))body = io.StringIO()for benchmark_entry in data:json.dump(benchmark_entry, body)body.wr... | 4 | 26 | 3 | 131 | 2 | 20 | 47 | 20 | null | ['body', 'data'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (upload_to_s3) defined within the public class called public.The function start at line 20 and ends at 47. It contains 26 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [20.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | init_model | def init_model(name="stories15M", device="cpu", precision=torch.bfloat16):"""Initialize and return a Transformer model with specified configuration."""model = Transformer.from_name(name)model.to(device=device, dtype=precision)return model.eval() | 1 | 4 | 3 | 44 | 1 | 14 | 18 | 14 | null | ['model'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (init_model) defined within the public class called public.The function start at line 14 and ends at 18. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [14.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_ao_inference_mode | def test_ao_inference_mode(self, device, batch_size, is_training):# Initialize model with specified devicerandom_model = init_model(device=device)# Set up test input parametersseq_len = 16input_ids = torch.randint(0, 1024, (batch_size, seq_len)).to(device)# input_pos is None for training mode, tensor for inference mode... | 3 | 12 | 4 | 109 | 0 | 29 | 49 | 29 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_ao_inference_mode) defined within the public class called public.The function start at line 29 and ends at 49. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [29.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quantize_8bit_with_qmap_correctness | def test_quantize_8bit_with_qmap_correctness(self, device):x = torch.rand(32, 1024, device=device)qmap = torch.rand(256, device=device).sort().valuesactual = (x.unsqueeze(-1) - qmap).abs().argmin(-1).to(torch.uint8)expected = quantize_8bit_with_qmap(x, qmap)torch.testing.assert_close(actual, expected) | 1 | 6 | 2 | 87 | 0 | 66 | 73 | 66 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quantize_8bit_with_qmap_correctness) defined within the public class called public.The function start at line 66 and ends at 73. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [66.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quantize_8bit_with_qmap_compile | def test_quantize_8bit_with_qmap_compile(self, device):x = torch.rand(32, 1024, device=device)qmap = torch.rand(256, device=device).sort().valuescompiled_f = torch.compile(quantize_8bit_with_qmap, fullgraph=True)actual = compiled_f(x, qmap)expected = quantize_8bit_with_qmap(x, qmap)torch.testing.assert_close(actual, ex... | 1 | 7 | 2 | 77 | 0 | 76 | 84 | 76 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quantize_8bit_with_qmap_compile) defined within the public class called public.The function start at line 76 and ends at 84. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [76.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quantize_4bit_with_qmap_correctness | def test_quantize_4bit_with_qmap_correctness(self, device):x = torch.rand(32, 1024, device=device)qmap = torch.rand(16, device=device).sort().valuesactual = (x.unsqueeze(-1) - qmap).abs().argmin(-1).to(torch.uint8)expected = quantize_4bit_with_qmap(x, qmap)torch.testing.assert_close(actual, expected) | 1 | 6 | 2 | 87 | 0 | 87 | 94 | 87 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quantize_4bit_with_qmap_correctness) defined within the public class called public.The function start at line 87 and ends at 94. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [87.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quantize_4bit_with_qmap_compile | def test_quantize_4bit_with_qmap_compile(self, device):x = torch.rand(32, 1024, device=device)qmap = torch.rand(16, device=device).sort().valuescompiled_f = torch.compile(quantize_4bit_with_qmap, fullgraph=True)actual = compiled_f(x, qmap)expected = quantize_4bit_with_qmap(x, qmap)torch.testing.assert_close(actual, exp... | 1 | 7 | 2 | 77 | 0 | 97 | 105 | 97 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quantize_4bit_with_qmap_compile) defined within the public class called public.The function start at line 97 and ends at 105. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [97.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_bf16_stochastic_round | def test_bf16_stochastic_round(self, device, compile):x = torch.rand(32, device=device) * 100x_rep = x.view(-1, 1).repeat(1, 100_000)func = torch.compile(_fp32_to_bf16_sr, fullgraph=True, dynamic=False, disable=not compile)x_rep_bf16 = func(x_rep)assert x_rep_bf16.dtype is torch.bfloat16# must cast BF16 tensor back to ... | 1 | 9 | 3 | 107 | 0 | 109 | 120 | 109 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_bf16_stochastic_round) defined within the public class called public.The function start at line 109 and ends at 120. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [109.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_optim_smoke | def test_optim_smoke(self, optim_name, dtype, device):if optim_name.endswith("Fp8") and device == "cuda":if torch.cuda.get_device_capability() < (8, 9):pytest.skip("FP8 CUDA requires compute capability >= 8.9")model = nn.Sequential(nn.Linear(32, 256), nn.ReLU(), nn.Linear(256, 32))model.to(device=device, dtype=dtype)op... | 6 | 28 | 4 | 310 | 0 | 131 | 167 | 131 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_optim_smoke) defined within the public class called public.The function start at line 131 and ends at 167. It contains 28 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [131.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_optim_default_dtype_bf16 | def test_optim_default_dtype_bf16(self, optim_name, device):if optim_name.endswith("Fp8") and device == "cuda":if torch.cuda.get_device_capability() < (8, 9):pytest.skip("FP8 CUDA requires compute capability >= 8.9")old_dtype = torch.get_default_dtype()torch.set_default_dtype(torch.bfloat16)try:model = nn.Sequential(nn... | 5 | 17 | 3 | 159 | 0 | 171 | 191 | 171 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_optim_default_dtype_bf16) defined within the public class called public.The function start at line 171 and ends at 191. It contains 17 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [171.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_param_groups | def test_param_groups(self, optim_name, device):if optim_name.endswith("Fp8") and device == "cuda":if torch.cuda.get_device_capability() < (8, 9):pytest.skip("FP8 CUDA requires compute capability >= 8.9")model = nn.Sequential(nn.Linear(32, 256), nn.ReLU(), nn.Linear(256, 32))model.to(device=device)param_groups = [dict(... | 4 | 16 | 3 | 180 | 0 | 195 | 212 | 195 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_param_groups) defined within the public class called public.The function start at line 195 and ends at 212. It contains 16 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [195.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_subclass_slice | def test_subclass_slice(self, subclass, shape, device):if subclass == OptimStateFp8:if device == "cuda" and torch.cuda.get_device_capability() < (8, 9):pytest.skip("FP8 CUDA requires compute capability >= 8.9")tensor = subclass.zeros(shape, device=device)offset = shape[0] // 2torch.testing.assert_close(tensor.dequantiz... | 4 | 13 | 4 | 119 | 0 | 222 | 236 | 222 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_subclass_slice) defined within the public class called public.The function start at line 222 and ends at 236. It contains 13 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [222.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_optim_8bit_correctness | def test_optim_8bit_correctness(self, optim_name):device = "cuda"model1 = nn.Sequential(nn.Linear(32, 1024), nn.ReLU(), nn.Linear(1024, 128))model1.to(device)model2 = copy.deepcopy(model1)# https://github.com/bitsandbytes-foundation/bitsandbytes/releases/tag/v0.44.0block_size = 256 if Version(bnb.__version__) >= Versio... | 4 | 20 | 2 | 221 | 0 | 248 | 274 | 248 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_optim_8bit_correctness) defined within the public class called public.The function start at line 248 and ends at 274. It contains 20 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [248.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_optim_4bit_correctness | def test_optim_4bit_correctness(self, optim_name):device = "cuda"model1 = nn.Sequential(nn.Linear(32, 1024), nn.ReLU(), nn.Linear(1024, 128))model1.to(device)model2 = copy.deepcopy(model1)# lpmm doesn't have Adam. use AdamW with no weight decay instead.if optim_name == "Adam4bit":optim1 = lpmm.optim.AdamW(model1.parame... | 5 | 24 | 2 | 233 | 0 | 282 | 311 | 282 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_optim_4bit_correctness) defined within the public class called public.The function start at line 282 and ends at 311. It contains 24 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [282.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_optim_cpu_offload_correctness | def test_optim_cpu_offload_correctness(self, offload_grad, grad_accum):device = _DEVICES[-1]# The first two layers are chosen so that they have a terrible arithmetic density.# this means long transfers and comparatively quick computation, increasing the chances# that missing synchronization will lead to test failures.#... | 6 | 41 | 3 | 351 | 0 | 318 | 376 | 318 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_optim_cpu_offload_correctness) defined within the public class called public.The function start at line 318 and ends at 376. It contains 41 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [318.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_optim_cpu_offload_save_load | def test_optim_cpu_offload_save_load(self):device = _DEVICES[-1]# enable bias parameters so we have some small tensors that# are not offloaded.model1 = nn.Sequential(nn.Linear(32, 1024, bias=True), nn.ReLU(), nn.Linear(1024, 128, bias=True))model1.to(device)optim1 = optim.CPUOffloadOptimizer(model1.parameters(), torch.... | 4 | 28 | 1 | 283 | 0 | 382 | 420 | 382 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_optim_cpu_offload_save_load) defined within the public class called public.The function start at line 382 and ends at 420. It contains 28 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 | test_optim_bf16_stochastic_round_correctness | def test_optim_bf16_stochastic_round_correctness(self):device = "cuda" if torch.cuda.is_available() else "cpu"torch.manual_seed(2024)model1 = nn.Sequential(nn.Linear(32, 1024), nn.ReLU(), nn.Linear(1024, 128))model1.to(device)model2 = copy.deepcopy(model1).bfloat16()# small LR so that weight update is small# when bf16_... | 3 | 27 | 1 | 226 | 0 | 422 | 458 | 422 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_optim_bf16_stochastic_round_correctness) defined within the public class called public.The function start at line 422 and ends at 458. 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 | world_size | def world_size(self) -> int:return _FSDP_WORLD_SIZE | 1 | 2 | 1 | 9 | 0 | 466 | 467 | 466 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (world_size) defined within the public class called public.The function start at line 466 and ends at 467. 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 | test_fsdp2 | def test_fsdp2(self):# we do this to avoid all combinationsargs_list = [(optim.AdamW8bit, OffloadPolicy),(optim.AdamW4bit, OffloadPolicy),(optim.AdamW8bit, CPUOffloadPolicy),]if torch.cuda.get_device_capability() >= (8, 9):args_list.append((optim.AdamWFp8, OffloadPolicy))self.run_subtests({"args": args_list},self._test... | 2 | 12 | 1 | 75 | 0 | 471 | 484 | 471 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fsdp2) defined within the public class called public.The function start at line 471 and ends at 484. It contains 12 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_fsdp2 | def _test_fsdp2(self, args):import torch.distributed as distimport torch.distributed.checkpoint as dcpimport torch.utils._pytree as pytreefrom torch.distributed.tensor import DTensorfrom torch.testing._internal.distributed._tensor.common_dtensor import (ModelArgs,Transformer,TransformerBlock,)optim_cls, offload_policy ... | 12 | 78 | 2 | 647 | 0 | 486 | 582 | 486 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_test_fsdp2) defined within the public class called public.The function start at line 486 and ends at 582. It contains 78 lines of code and it has a cyclomatic complexity of 12. It takes 2 parameters, represented as [486.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_uneven_shard | def test_uneven_shard(self):in_dim = 512out_dim = _FSDP_WORLD_SIZE * 16 + 1# 1st dim of linear weight will not be divisible by WORLD_SIZEmodel = nn.Linear(in_dim, out_dim, device="cuda")assert model.weight.shape[0] % _FSDP_WORLD_SIZE != 0fully_shard(model)# currently all of our low-bit Adam/AdamW share the same impleme... | 2 | 12 | 1 | 102 | 0 | 586 | 603 | 586 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_uneven_shard) defined within the public class called public.The function start at line 586 and ends at 603. It contains 12 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_toy_linear_model | def test_toy_linear_model(self, device):# Skip if device is not availableif device == "cuda" and not torch.cuda.is_available():self.skipTest("CUDA not available")model, input_data = create_model_and_input_data("linear", 10, 64, 32, device=device)output = model(input_data)self.assertEqual(output.shape, (10, 32)) | 3 | 8 | 2 | 65 | 0 | 18 | 27 | 18 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_toy_linear_model) defined within the public class called public.The function start at line 18 and ends at 27. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [18.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_ln_linear_activation_model | def test_ln_linear_activation_model(self, device):# Skip if device is not availableif device == "cuda" and not torch.cuda.is_available():self.skipTest("CUDA not available")model, input_data = create_model_and_input_data("ln_linear_sigmoid", 10, 64, 32, device=device)output = model(input_data)self.assertEqual(output.sha... | 3 | 8 | 2 | 65 | 0 | 30 | 39 | 30 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_ln_linear_activation_model) defined within the public class called public.The function start at line 30 and ends at 39. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [30.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_transformer_block | def test_transformer_block(self, device):# Skip if device is not availableif device == "cuda" and not torch.cuda.is_available():self.skipTest("CUDA not available")model, input_data = create_model_and_input_data("transformer_block", 10, 64, 32, device=device)output = model(input_data)self.assertEqual(output.shape, (10, ... | 3 | 8 | 2 | 67 | 0 | 42 | 51 | 42 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_transformer_block) defined within the public class called public.The function start at line 42 and ends at 51. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [42.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _create_floatx_inputs | def _create_floatx_inputs(self, ebits: int, mbits: int, BS: int, OC: int, IC: int, device, dtype):# Randomly initialize each bytenbits = 1 + ebits + mbitsfloatx_weight = torch.randint(256, (OC, IC // 8 * nbits), dtype=torch.uint8)scale = torch.rand(OC).to(dtype) + 0.5fp16_act = torch.rand(BS, IC).to(dtype) + 0.5return ... | 1 | 8 | 8 | 106 | 0 | 52 | 60 | 52 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_create_floatx_inputs) defined within the public class called public.The function start at line 52 and ends at 60. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [52.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quant_llm_linear | def test_quant_llm_linear(self, ebits, mbits, dtype):BS = 2OC = 256IC = 256splitK = 1floatx_weight, scale, fp16_act = self._create_floatx_inputs(ebits, mbits, BS, OC, IC, "cuda", dtype)# smoke testtorchao.ops.quant_llm_linear(ebits, mbits, fp16_act, floatx_weight, scale, splitK)# comprehensive testingtest_utils = ["tes... | 1 | 22 | 4 | 106 | 0 | 65 | 90 | 65 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quant_llm_linear) defined within the public class called public.The function start at line 65 and ends at 90. It contains 22 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [65.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quant_llm_linear_correctness | def test_quant_llm_linear_correctness(self, ebits, mbits, BS, OC, IC, splitK, dtype):# adapted from https://github.com/usyd-fsalab/fp6_llm/blob/5df6737cca32f604e957e3f63f03ccc2e4d1df0d/tests/python/kernel_test_fpx.pyfloatx_weight, scale, fp16_act = self._create_floatx_inputs(ebits, mbits, BS, OC, IC, "cuda", dtype)resu... | 2 | 18 | 8 | 137 | 0 | 96 | 117 | 96 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quant_llm_linear_correctness) defined within the public class called public.The function start at line 96 and ends at 117. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 8 parameters, represented as [96.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _scaled_dot_product_int8_op_ref | def _scaled_dot_product_int8_op_ref(self,q,k,v,attn_mask=None,dropout_p=0,is_causal=False,q_scale=1.0,q_zp=0,k_scale=1.0,k_zp=0,v_scale=1.0,v_zp=0,a_scale=1.0,a_zp=0,o_scale=1.0,o_zp=0,):q = (q.to(torch.float) - q_zp) * q_scalek = (k.to(torch.float) - k_zp) * k_scalev = (v.to(torch.float) - v_zp) * v_scalescale_factor ... | 2 | 37 | 17 | 300 | 0 | 119 | 155 | 119 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_scaled_dot_product_int8_op_ref) defined within the public class called public.The function start at line 119 and ends at 155. It contains 37 lines of code and it has a cyclomatic complexity of 2. It takes 17 parameters, represented as [119.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _scaled_dot_product_fp8_op_ref | def _scaled_dot_product_fp8_op_ref(self,q,k,v,attn_mask=None,dropout_p=0,is_causal=False,q_scale=1.0,k_scale=1.0,v_scale=1.0,a_scale=1.0,o_scale=1.0,):q = q.to(torch.float) * q_scalek = k.to(torch.float) * k_scalev = v.to(torch.float) * v_scalescale_factor = 1 / math.sqrt(q.size(-1))attn = q @ k.transpose(-2, -1)attn =... | 2 | 33 | 12 | 269 | 0 | 157 | 190 | 157 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_scaled_dot_product_fp8_op_ref) defined within the public class called public.The function start at line 157 and ends at 190. It contains 33 lines of code and it has a cyclomatic complexity of 2. It takes 12 parameters, represented as [157.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quantized_scaled_dot_product_op | def test_quantized_scaled_dot_product_op(self,input_dtype,batch_size,n_head,q_seq_len,kv_seq_len,head_dim,mask_dtype,):torch.manual_seed(1234)device = "cpu"if input_dtype == torch.uint8:q_scale = float(1.7907238006591797)k_scale = float(1.8039721250534058)v_scale = float(1.839004635810852)a_scale = float(0.003919653594... | 6 | 120 | 8 | 656 | 0 | 208 | 328 | 208 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quantized_scaled_dot_product_op) defined within the public class called public.The function start at line 208 and ends at 328. It contains 120 lines of code and it has a cyclomatic complexity of 6. It takes 8 parameters, represented as [208.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | make_test_id | def make_test_id(param):if isinstance(param, tuple) and len(param) == 2:# This is a shapereturn f"shape_{param[0]}x{param[1]}"else:# This is inner_k_tilesreturn f"tiles_{param}" | 3 | 5 | 1 | 28 | 0 | 353 | 357 | 353 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (make_test_id) defined within the public class called public.The function start at line 353 and ends at 357. It contains 5 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_unpack_tensor_core_tiled_layout_correctness | def test_unpack_tensor_core_tiled_layout_correctness(shape, inner_k_tiles):N, K = shapeassert K % (inner_k_tiles * kTileSizeK) == 0 and N % kTileSizeN == 0t = torch.randint(0, 16, dtype=torch.int, size=shape, device="cuda")t = (t[::, ::2] << 4 | t[::, 1::2]).to(torch.uint8)packed_w = torch.ops.aten._convert_weight_to_i... | 2 | 9 | 2 | 147 | 3 | 362 | 371 | 362 | null | ['t', 'packed_w', 'unpacked'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_unpack_tensor_core_tiled_layout_correctness) defined within the public class called public.The function start at line 362 and ends at 371. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [362.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_unpack_tensor_core_tiled_layout_op | def test_unpack_tensor_core_tiled_layout_op(shape, inner_k_tiles):test_utils = ["test_schema","test_autograd_registration","test_faketensor",]test_utils.append("test_aot_dispatch_dynamic")t = torch.randint(0, 16, dtype=torch.int, size=shape, device="cuda")t = (t[::, ::2] << 4 | t[::, 1::2]).to(torch.uint8)packed_w = to... | 1 | 15 | 2 | 112 | 3 | 377 | 394 | 377 | null | ['t', 'test_utils', 'packed_w'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_unpack_tensor_core_tiled_layout_op) defined within the public class called public.The function start at line 377 and ends at 394. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [377.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | dequant_ref | def dequant_ref(q, scales, zeros, group_size, nbits=4, dtype=torch.bfloat16):n, k = q.shapeassert q.dtype == torch.intn_groups = k // group_sizeassert scales.shape[0] == n and scales.shape[1] == n_groupsassert scales.shape == zeros.shapemidpoint = 2 ** (nbits - 1)# Convert fron u4 -> s4 and upcast to bfloat16q = q.sub(... | 2 | 11 | 6 | 131 | 4 | 397 | 414 | 397 | null | ['midpoint', 'n_groups', 'q', 'dq'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (dequant_ref) defined within the public class called public.The function start at line 397 and ends at 414. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [397.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_dequantize_tensor_core_tiled_layout_correctness_quant_dequant | def test_dequantize_tensor_core_tiled_layout_correctness_quant_dequant(shape, inner_k_tiles, group_size):n, k = shapedtype = torch.bfloat16device = "cuda"t = torch.randn(n, k, dtype=dtype, device=device)scales, zeros = get_groupwise_affine_qparams(t, n_bit=4, groupsize=group_size, dtype=dtype)# Quantizeq = groupwise_af... | 1 | 36 | 3 | 253 | 14 | 421 | 480 | 421 | null | ['dq_ao', 'diff_op_ao', 'q_groups', 't', 'q', 'device', 'packed', 'dq_op', 'diff_op_id', 'a_eye', 'dtype', 'dq_id', 'diff_ao_id', 'scales_and_zeros'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_dequantize_tensor_core_tiled_layout_correctness_quant_dequant) defined within the public class called public.The function start at line 421 and ends at 480. It contains 36 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [421.0] and does not return any valu... |
pytorch_ao | public | public | 0 | 0 | test_dequantize_tensor_core_tiled_layout_correctness_unpack_and_dequant | def test_dequantize_tensor_core_tiled_layout_correctness_unpack_and_dequant(shape, inner_k_tiles, group_size):n, k = shapedtype = torch.bfloat16device = "cuda"# Quantize and packt = torch.randn(n, k, dtype=dtype, device=device)scales, zeros = get_groupwise_affine_qparams(t, n_bit=4, groupsize=group_size, dtype=dtype)q ... | 1 | 36 | 3 | 274 | 14 | 488 | 545 | 488 | null | ['dq_ao', 'unpacked', 'diff_op_ao', 't', 'q', 'device', 'packed', 'dq_op', 'diff_op_id', 'a_eye', 'dtype', 'dq_id', 'diff_ao_id', 'scales_and_zeros'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_dequantize_tensor_core_tiled_layout_correctness_unpack_and_dequant) defined within the public class called public.The function start at line 488 and ends at 545. It contains 36 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [488.0] and does not return any... |
pytorch_ao | public | public | 0 | 0 | test_dequantize_tensor_core_tiled_layout_op | def test_dequantize_tensor_core_tiled_layout_op(shape, inner_k_tiles, group_size):n, k = shapedevice = "cuda"q = torch.randint(0, 16, shape, dtype=torch.int, device=device)q = (q[::, ::2] << 4 | q[::, 1::2]).to(torch.uint8)packed_w = torch._convert_weight_to_int4pack(q, inner_k_tiles)q_groups = k // group_sizescales = ... | 1 | 21 | 3 | 160 | 8 | 552 | 574 | 552 | null | ['q_groups', 'zeros', 'scales', 'q', 'test_utils', 'device', 'packed_w', 'scales_and_zeros'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_dequantize_tensor_core_tiled_layout_op) defined within the public class called public.The function start at line 552 and ends at 574. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [552.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _symmetric_quantize_with_ref.reshape_w | def reshape_w(w):w = w.reshape((group_size, -1, size_n))w = w.permute(1, 0, 2)w = w.reshape((size_k, size_n)).contiguous()return w | 1 | 5 | 1 | 50 | 0 | 637 | 641 | 637 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_symmetric_quantize_with_ref.reshape_w) defined within the public class called public.The function start at line 637 and ends at 641. 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 | _symmetric_quantize_with_ref | def _symmetric_quantize_with_ref(w: torch.Tensor, num_bits: int, group_size: int):orig_device = w.devicesize_k, size_n = w.shapeassert w.is_floating_point(), "w must be float"if group_size == -1:group_size = size_kassert group_size <= size_kmax_q_val = 2**num_bits - 1half_q_val = (max_q_val + 1) // 2# Reshape to [group... | 4 | 29 | 3 | 246 | 8 | 603 | 652 | 603 | null | ['max_q_val', 'half_q_val', 'group_size', 'orig_device', 'q_w', 'w', 's', 'w_ref'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_symmetric_quantize_with_ref) defined within the public class called public.The function start at line 603 and ends at 652. It contains 29 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [603.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_marlin_24 | def test_marlin_24(batch_size, k_chunk, n_chunk, num_bits, group_size, mnk_factors):m_factor, n_factor, k_factor = mnk_factorssize_m = m_factorsize_k = k_chunk * k_factorsize_n = n_chunk * n_factora_input = torch.randn((batch_size, size_m, size_k), dtype=torch.float16, device="cuda")b_weight = torch.rand((size_k, size_... | 1 | 40 | 6 | 291 | 12 | 661 | 716 | 661 | null | ['fn_inputs', 'output', 'size_n', 'test_utils', 'max_diff', 'size_k', 'output_ref', 'size_m', 'a_input', 'input_2d', 'workspace_24', 'b_weight'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_marlin_24) defined within the public class called public.The function start at line 661 and ends at 716. It contains 40 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [661.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_marlin_qqq | def test_marlin_qqq(batch_size, k_chunk, n_chunk, num_bits, group_size, mnk_factors):int8_traits = torch.iinfo(torch.int8)m_factor, n_factor, k_factor = mnk_factorssize_m = m_factorsize_k = k_chunk * k_factorsize_n = n_chunk * n_factora_input = torch.randn((batch_size, size_m, size_k), dtype=torch.float16, device="cuda... | 1 | 55 | 6 | 385 | 19 | 752 | 821 | 752 | null | ['size_n', 'test_utils', 'max_diff', 'output_ref', 'size_m', 'int8_traits', 's_a', 'w_ref', 's_group', 'fn_inputs', 'size_k', 'q_w', 'input_2d', 'output', 'q_a', 'workspace', 's_channel', 'a_input', 'b_weight'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_marlin_qqq) defined within the public class called public.The function start at line 752 and ends at 821. It contains 55 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [752.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_swizzle_mm | def test_swizzle_mm():test_utils = ["test_schema","test_autograd_registration","test_faketensor",]test_utils.append("test_aot_dispatch_dynamic")mat1 = torch.randint(0, 16, dtype=torch.float, size=(16, 32), device="cuda")mat2 = torch.randint(0, 16, dtype=torch.float, size=(32, 16), device="cuda")opcheck(torch.ops.torcha... | 1 | 14 | 0 | 101 | 3 | 825 | 841 | 825 | null | ['mat1', 'test_utils', 'mat2'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swizzle_mm) defined within the public class called public.The function start at line 825 and ends at 841. It contains 14 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_scaled_embedding_bag_cpu_helper | def _test_scaled_embedding_bag_cpu_helper(multi_hot, batch_size, vector_size, index_type, qtype):dtype = torch.float32include_last_offset = Truemode = "sum"if mode == "sum":mode_enum = 0elif mode == "mean":mode_enum = 1elif mode == "max":mode_enum = 2indices = torch.randint(1000, (batch_size * multi_hot,)).to(index_typ... | 5 | 40 | 5 | 273 | 11 | 859 | 901 | 859 | null | ['include_last_offset', 'test_out', 'mode_enum', 'mode', 'm', 'qweight', 'offsets', 'indices', 'refe_out', 'dtype', 'weight_scale'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_test_scaled_embedding_bag_cpu_helper) defined within the public class called public.The function start at line 859 and ends at 901. It contains 40 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [859.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_test_for_op | def run_test_for_op(op, dtype, batch_size, size_mnk, use_bias):size_m, size_n, size_k = size_mnkX = torch.randn((batch_size, size_m, size_k), dtype=dtype, device="cuda")W = torch.rand((size_n, size_k), dtype=dtype, device="cuda")bias = torch.rand((size_n,), dtype=dtype, device="cuda") if use_bias else NoneXq_bits = 4 i... | 6 | 34 | 5 | 303 | 16 | 42 | 87 | 42 | null | ['fn_inputs', 'Xq', 'output', 'W_quant_func', 'X_aqt', 'X_quant_func', 'test_utils', 'Xq_bits', 'W_scale', 'bias', 'X_scale', 'W_aqt', 'output_ref', 'Wq', 'W', 'X'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_test_for_op) defined within the public class called public.The function start at line 42 and ends at 87. It contains 34 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [42.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_rowwise_scaled_linear_cutlass_s4s4 | def test_rowwise_scaled_linear_cutlass_s4s4(dtype, batch_size, size_mnk, use_bias):run_test_for_op(torch.ops.torchao.rowwise_scaled_linear_cutlass_s4s4,dtype,batch_size,size_mnk,use_bias,) | 1 | 8 | 4 | 30 | 0 | 93 | 100 | 93 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_rowwise_scaled_linear_cutlass_s4s4) defined within the public class called public.The function start at line 93 and ends at 100. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [93.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_rowwise_scaled_linear_cutlass_s8s4 | def test_rowwise_scaled_linear_cutlass_s8s4(dtype, batch_size, size_mnk, use_bias):run_test_for_op(torch.ops.torchao.rowwise_scaled_linear_cutlass_s8s4,dtype,batch_size,size_mnk,use_bias,) | 1 | 8 | 4 | 30 | 0 | 106 | 113 | 106 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_rowwise_scaled_linear_cutlass_s8s4) defined within the public class called public.The function start at line 106 and ends at 113. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [106.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_test_for_op | def run_test_for_op(op,dtype,Xq_dtype,Wq_dtype,batch_size,size_mnk,use_bias,):device = "cuda"size_m, size_n, size_k = size_mnkX = torch.randn((batch_size, size_m, size_k), dtype=dtype, device=device)W = create_semi_structured_tensor(size_n, size_k, dtype=dtype).to(device)bias = torch.rand((size_n,), dtype=dtype, device... | 4 | 43 | 7 | 296 | 17 | 51 | 105 | 51 | null | ['fn_inputs', 'Xq', 'Wq_sparse', 'W_meta', 'output', 'W_quant_func', 'X_aqt', 'X_quant_func', 'test_utils', 'device', 'W_scale', 'bias', 'X_scale', 'W_aqt', 'output_ref', 'W', 'X'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_test_for_op) defined within the public class called public.The function start at line 51 and ends at 105. It contains 43 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [51.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_rowwise_scaled_linear_sparse_cutlass_f8f8 | def test_rowwise_scaled_linear_sparse_cutlass_f8f8(dtype,Xq_Wq_dtypes,batch_size,size_mnk,use_bias,):run_test_for_op(torch.ops.torchao.rowwise_scaled_linear_sparse_cutlass_f8f8,dtype,*Xq_Wq_dtypes,batch_size,size_mnk,use_bias,) | 1 | 15 | 5 | 36 | 0 | 115 | 129 | 115 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_rowwise_scaled_linear_sparse_cutlass_f8f8) defined within the public class called public.The function start at line 115 and ends at 129. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [115.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_torch_version_at_least | def test_torch_version_at_least(self):test_cases = [("2.5.0a0+git9f17037", "2.5.0", False),# [2, 5, -1] < [2, 5, 0]("2.5.0a0+git9f17037", "2.4.0", True),# [2, 5, -1] > [2, 4, 0]("2.5.0.dev20240708+cu121", "2.5.0", False),# [2, 5, -1] < [2, 5, 0]("2.5.0.dev20240708+cu121", "2.4.0", True),# [2, 5, -1] > [2, 4, 0]("2.5.0"... | 2 | 19 | 1 | 108 | 0 | 17 | 37 | 17 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_torch_version_at_least) defined within the public class called public.The function start at line 17 and ends at 37. It contains 19 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_torch_version_deprecation | def test_torch_version_deprecation(self):"""Test that TORCH_VERSION_AT_LEAST* and TORCH_VERSION_AFTER*trigger deprecation warnings on use, not on import."""# Reset deprecation warning state, otherwise we won't log warnings herewarnings.resetwarnings()# Importing and referencing should not trigger deprecation warningwit... | 3 | 38 | 1 | 196 | 0 | 39 | 86 | 39 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_torch_version_deprecation) defined within the public class called public.The function start at line 39 and ends at 86. It contains 38 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_print_arg_types.__new__ | def __new__(cls, data):shape = data.shapereturn torch.Tensor._make_wrapper_subclass(cls, shape)# type: ignore[attr-defined] | 1 | 3 | 2 | 23 | 0 | 92 | 94 | 92 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_print_arg_types.__new__) defined within the public class called public.The function start at line 92 and ends at 94. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [92.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_print_arg_types.__init__ | def __init__(self, data):self.data = data | 1 | 2 | 2 | 12 | 0 | 96 | 97 | 96 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_print_arg_types.__init__) defined within the public class called public.The function start at line 96 and ends at 97. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [96.0] and does not return any value.. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.