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 | unwrap_fn | def unwrap_fn(t, fn):if isinstance(t, MapTensor):with no_dispatch():return fn(t.elems)else:return None | 2 | 6 | 2 | 31 | 0 | 65 | 70 | 65 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (unwrap_fn) defined within the public class called public.The function start at line 65 and ends at 70. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [65.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | wrap | def wrap(t):if isinstance(t, torch.Tensor):return MapTensor(t)else:return t | 2 | 5 | 1 | 24 | 0 | 73 | 77 | 73 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (wrap) defined within the public class called public.The function start at line 73 and ends at 77. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | layer_norm_impl | def layer_norm_impl(func, types, args, kwargs=None):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 5, f"args: {unwrapped_args}"norm_res = func(*unwrapped_args)assert len(norm_res) == 3return tuple(wrap(a) for a in norm_res... | 2 | 8 | 4 | 72 | 3 | 81 | 88 | 81 | null | ['norm_res', 'unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (layer_norm_impl) defined within the public class called public.The function start at line 81 and ends at 88. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [81.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | add_impl | def add_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"if not isinstance(args[0], MapTensor) and isinstance(args[1], MapTensor):if args[0].dim() == (args[1].dim()... | 4 | 10 | 4 | 105 | 2 | 92 | 101 | 92 | null | ['unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_impl) defined within the public class called public.The function start at line 92 and ends at 101. It contains 10 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [92.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | cat_ops_impl | def cat_ops_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) <= 2, f"args: {unwrapped_args}"# TODO: Use MapTensor type for filter# First argument's dimdim = unwrapped_args[0][0].dim()size = unwra... | 6 | 20 | 4 | 202 | 6 | 105 | 126 | 105 | null | ['unwrapped_kwargs', 'dim', 'orig_dim', 'unwrapped_args', 'new_args', 'size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (cat_ops_impl) defined within the public class called public.The function start at line 105 and ends at 126. It contains 20 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [105.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | select_impl | def select_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 3, f"args: {unwrapped_args}"return wrap(func(unwrapped_args[0], unwrapped_args[1] + 1, unwrapped_args[2])) | 1 | 6 | 4 | 67 | 2 | 130 | 135 | 130 | null | ['unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (select_impl) defined within the public class called public.The function start at line 130 and ends at 135. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [130.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | slice_impl | def slice_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 4, f"args: {unwrapped_args}"dim = unwrapped_args[0].dim()return wrap(func(unwrapped_args[0],wrap_dim(unwrapped_args[1], dim - 1) + 1,... | 1 | 14 | 4 | 90 | 3 | 139 | 152 | 139 | null | ['dim', 'unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (slice_impl) defined within the public class called public.The function start at line 139 and ends at 152. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [139.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | reductions_impl | def reductions_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)# TODO: THIS MIGHT BE WRONGif len(unwrapped_args) == 3 and len(unwrapped_kwargs) == 0:assert len(unwrapped_args[1]) == 1dim = unwrapped_args[0].dim()return wrap(func(unwrapped_args[0],[wrap_d... | 16 | 45 | 4 | 337 | 3 | 168 | 213 | 168 | null | ['dim', 'unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (reductions_impl) defined within the public class called public.The function start at line 168 and ends at 213. It contains 45 lines of code and it has a cyclomatic complexity of 16. It takes 4 parameters, represented as [168.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | view_ops_impl | def view_ops_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"input_size = unwrapped_args[0].size()bigger_size = list(input_size[:1]) + unwrapped_args[1]return wrap... | 1 | 8 | 4 | 82 | 4 | 217 | 224 | 217 | null | ['unwrapped_kwargs', 'unwrapped_args', 'bigger_size', 'input_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (view_ops_impl) defined within the public class called public.The function start at line 217 and ends at 224. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [217.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | view_impl | def view_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"input_size = unwrapped_args[0].size()bigger_size = list(input_size[:1]) + unwrapped_args[1]if unwrapped_ar... | 2 | 10 | 4 | 107 | 4 | 228 | 237 | 228 | null | ['unwrapped_kwargs', 'unwrapped_args', 'bigger_size', 'input_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (view_impl) defined within the public class called public.The function start at line 228 and ends at 237. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [228.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | mm_ops_impl | def mm_ops_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"return wrap(torch.matmul(*unwrapped_args)) | 1 | 6 | 4 | 55 | 2 | 241 | 246 | 241 | null | ['unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (mm_ops_impl) defined within the public class called public.The function start at line 241 and ends at 246. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [241.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | unsqueeze_impl | def unsqueeze_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"new_i = unwrapped_args[1]if new_i >= 0:new_i += 1return wrap(func(unwrapped_args[0], new_i)) | 2 | 9 | 4 | 71 | 3 | 250 | 258 | 250 | null | ['unwrapped_kwargs', 'unwrapped_args', 'new_i'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (unsqueeze_impl) defined within the public class called public.The function start at line 250 and ends at 258. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [250.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | squeeze_impl | def squeeze_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"new_i = unwrapped_args[1]if new_i >= 0:new_i += 1return wrap(func(unwrapped_args[0], new_i)) | 2 | 9 | 4 | 71 | 3 | 262 | 270 | 262 | null | ['unwrapped_kwargs', 'unwrapped_args', 'new_i'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (squeeze_impl) defined within the public class called public.The function start at line 262 and ends at 270. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [262.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | addmm_impl | def addmm_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 3, f"args: {unwrapped_args}"return wrap(torch.matmul(unwrapped_args[1], unwrapped_args[2]) + unwrapped_args[0]) | 1 | 6 | 4 | 67 | 2 | 274 | 279 | 274 | null | ['unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (addmm_impl) defined within the public class called public.The function start at line 274 and ends at 279. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [274.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | convolution_impl | def convolution_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 9, f"args: {unwrapped_args}"a = unwrapped_args[0]a = unwrapped_args[0].flatten(0, 1)# TODO: It's scary that this .contiguous se... | 1 | 12 | 4 | 128 | 5 | 283 | 296 | 283 | null | ['unwrapped_kwargs', 'resb', 'a', 'resa', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (convolution_impl) defined within the public class called public.The function start at line 283 and ends at 296. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [283.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | upsample_bilinear2d_impl | def upsample_bilinear2d_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 3, f"args: {unwrapped_args}"a = unwrapped_args[0]a = unwrapped_args[0].flatten(0, 1)# NOTE: It's scary that this .conti... | 1 | 12 | 4 | 128 | 5 | 300 | 313 | 300 | null | ['unwrapped_kwargs', 'resb', 'a', 'resa', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (upsample_bilinear2d_impl) defined within the public class called public.The function start at line 300 and ends at 313. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [300.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | transpose_impl | def transpose_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 3, f"args: {unwrapped_args}"dim = unwrapped_args[0].dim()return wrap(func(unwrapped_args[0],wrap_dim(unwrapped_args[1], dim - 1) ... | 1 | 13 | 4 | 94 | 3 | 317 | 329 | 317 | null | ['dim', 'unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (transpose_impl) defined within the public class called public.The function start at line 317 and ends at 329. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [317.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | unbind_impl | def unbind_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"dim = unwrapped_args[0].dim()return wrap(func(unwrapped_args[0], wrap_dim(unwrapped_args[1], dim - 1) + ... | 1 | 7 | 4 | 79 | 3 | 333 | 339 | 333 | null | ['dim', 'unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (unbind_impl) defined within the public class called public.The function start at line 333 and ends at 339. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [333.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | permute_impl | def permute_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"dim = unwrapped_args[0].dim()return wrap(func(unwrapped_args[0],([0] + [wrap_dim(u, dim - 1) + 1 for u ... | 2 | 12 | 4 | 92 | 3 | 343 | 354 | 343 | null | ['dim', 'unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (permute_impl) defined within the public class called public.The function start at line 343 and ends at 354. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [343.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _scaled_dot_product_efficient_attention_impl | def _scaled_dot_product_efficient_attention_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(args) == 5if all(isinstance(a, MapTensor) for a in args[:3]):# assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 5, f"args: {unwrapped_arg... | 12 | 99 | 4 | 862 | 8 | 358 | 459 | 358 | null | ['unwrapped_kwargs', 'a0', 'a0_size', 'a2', 'a1', 'a1_size', 'unwrapped_args', 'sdpa_res'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_scaled_dot_product_efficient_attention_impl) defined within the public class called public.The function start at line 358 and ends at 459. It contains 99 lines of code and it has a cyclomatic complexity of 12. It takes 4 parameters, represented as [358.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _scaled_dot_product_flash_attention_impl | def _scaled_dot_product_flash_attention_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(args) == 3assert len(unwrapped_kwargs) == 1assert len(unwrapped_args) == 3, f"args: {unwrapped_args}"if all(isinstance(a, MapTensor) for a in args[:3]):ass... | 12 | 80 | 4 | 792 | 8 | 463 | 542 | 463 | null | ['unwrapped_kwargs', 'a0', 'a0_size', 'a2', 'a1', 'a1_size', 'unwrapped_args', 'sdpa_res'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_scaled_dot_product_flash_attention_impl) defined within the public class called public.The function start at line 463 and ends at 542. It contains 80 lines of code and it has a cyclomatic complexity of 12. It takes 4 parameters, represented as [463.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | index_ops_impl | def index_ops_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)assert len(unwrapped_kwargs) == 0assert len(unwrapped_args) == 2, f"args: {unwrapped_args}"# if len(args[1]) == 1 and isinstance(args[1][0], MapTensor) and isinstance(args[0], MapTensor):# ret... | 19 | 61 | 4 | 621 | 11 | 547 | 609 | 547 | null | ['unwrapped_kwargs', 'tensors', 'res', 'resb', 'values', 'nt', 'lengths', 'offsets', 'a', 'resa', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (index_ops_impl) defined within the public class called public.The function start at line 547 and ends at 609. It contains 61 lines of code and it has a cyclomatic complexity of 19. It takes 4 parameters, represented as [547.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | dim_impl | def dim_impl(func, types, args, kwargs):assert len(args) == 1assert len(kwargs) == 0ret_dim = func(args[0].elems) - 1assert ret_dim >= 0return ret_dim | 1 | 6 | 4 | 44 | 1 | 614 | 619 | 614 | null | ['ret_dim'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (dim_impl) defined within the public class called public.The function start at line 614 and ends at 619. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [614.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | sym_impl | def sym_impl(func, types, args, kwargs):assert len(args) == 1assert len(kwargs) == 0elems_size = func(args[0].elems)assert len(elems_size) > 0return elems_size[1:] | 1 | 6 | 4 | 49 | 1 | 623 | 628 | 623 | null | ['elems_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (sym_impl) defined within the public class called public.The function start at line 623 and ends at 628. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [623.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | is_contiguous_impl | def is_contiguous_impl(func, types, args, kwargs):assert len(args) == 1assert len(kwargs) == 0return func(args[0].elems) | 1 | 4 | 4 | 35 | 0 | 632 | 635 | 632 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (is_contiguous_impl) defined within the public class called public.The function start at line 632 and ends at 635. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [632.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forwardables_impl | def forwardables_impl(func, types, args, kwargs):unwrapped_args = tree_map(unwrap, args)unwrapped_kwargs = tree_map(unwrap, kwargs)return wrap(func(*unwrapped_args, **unwrapped_kwargs)) | 1 | 4 | 4 | 39 | 2 | 683 | 686 | 683 | null | ['unwrapped_kwargs', 'unwrapped_args'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forwardables_impl) defined within the public class called public.The function start at line 683 and ends at 686. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [683.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_invariant_test | def run_invariant_test(res, func, args, kwargs):# Compares 0th element of list of results with# func applied to 0th arg and kwarg.# Rough test to maintain per-op accuracy.if isinstance(res, torch.Tensor):unwrapped_args_0 = tree_map(lambda x: unwrap_i(x, 0), args)unwrapped_kwargs_0 = tree_map(lambda x: unwrap_i(x, 0), k... | 5 | 19 | 4 | 161 | 3 | 689 | 715 | 689 | null | ['unwrapped_kwargs_0', 'unwrapped_args_0', 'res_0'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_invariant_test) defined within the public class called public.The function start at line 689 and ends at 715. It contains 19 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [689.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __new__ | def __new__(cls, elems):# print("elems.layout: ", elems.layout)return torch.Tensor._make_wrapper_subclass(cls,elems.shape[1:],dtype=elems.dtype,device=elems.device,layout=elems.layout,dispatch_layout=True,dispatch_sizes_strides_policy=("sizes" if elems.layout == torch.jagged else None),storage_size=(elems._values.untyp... | 3 | 17 | 2 | 89 | 0 | 720 | 737 | 720 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__new__) defined within the public class called public.The function start at line 720 and ends at 737. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [720.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, elems):self.elems = elems | 1 | 2 | 2 | 12 | 0 | 739 | 740 | 739 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 739 and ends at 740. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [739.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __torch_dispatch__ | def __torch_dispatch__(cls, func, types, args, kwargs=None):if func in MAP_TENSOR_ATEN_OP_TABLE:res = MAP_TENSOR_ATEN_OP_TABLE[func](func, types, args, kwargs)# run_invariant_test(res, func, args, kwargs)return resreturn NotImplemented | 2 | 5 | 5 | 39 | 0 | 743 | 748 | 743 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__torch_dispatch__) defined within the public class called public.The function start at line 743 and ends at 748. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [743.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __torch_function__ | def __torch_function__(cls, func, types, args=(), kwargs=None):if kwargs is None:kwargs = {}with torch._C.DisableTorchFunctionSubclass():return func(*args, **kwargs) | 2 | 5 | 4 | 45 | 0 | 751 | 755 | 751 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__torch_function__) defined within the public class called public.The function start at line 751 and ends at 755. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [751.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __tensor_flatten__ | def __tensor_flatten__(self):ctx = {}inner_tensors = ["elems"]return inner_tensors, ctx | 1 | 4 | 1 | 18 | 0 | 758 | 761 | 758 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__tensor_flatten__) defined within the public class called public.The function start at line 758 and ends at 761. 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 | __tensor_unflatten__ | def __tensor_unflatten__(inner_tensors: Dict, meta, outer_size, outer_stride):# inner tensors: _values, _offsets, [_lengths], [_min_seqlen], [_max_seqlen]assert len(inner_tensors) == 1, f"{inner_tensors}"elems = inner_tensors["elems"]return MapTensor(elems) | 1 | 4 | 4 | 34 | 0 | 764 | 769 | 764 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__tensor_unflatten__) defined within the public class called public.The function start at line 764 and ends at 769. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [764.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __repr__ | def __repr__(self):return f"MapTensor({self.elems.size()})" | 1 | 2 | 1 | 8 | 0 | 771 | 772 | 771 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__repr__) defined within the public class called public.The function start at line 771 and ends at 772. 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 | pin_memory | def pin_memory(self):elems = self.elems.pin_memory()return wrap(elems) | 1 | 3 | 1 | 19 | 0 | 774 | 776 | 774 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (pin_memory) defined within the public class called public.The function start at line 774 and ends at 776. 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 | to_map_tensor | def to_map_tensor(ts: torch.Tensor):return MapTensor(ts) | 1 | 2 | 1 | 14 | 0 | 780 | 781 | 780 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_map_tensor) defined within the public class called public.The function start at line 780 and ends at 781. 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,sam_model: SAM2Base,mask_threshold=0.0,max_hole_area=0.0,max_sprinkle_area=0.0,**kwargs,) -> None:"""Uses SAM-2 to calculate the image embedding for an image, and thenallow repeated, efficient mask prediction given prompts.Arguments:sam_model (Sam-2): The model to use for mask prediction.mask_threshol... | 1 | 28 | 6 | 134 | 0 | 20 | 68 | 20 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 20 and ends at 68. It contains 28 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [20.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | from_pretrained | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2ImagePredictor":"""Load a pretrained model from the Hugging Face hub.Arguments:model_id (str): The Hugging Face repository ID.**kwargs: Additional arguments to pass to the model constructor.Returns:(SAM2ImagePredictor): The loaded model."""from sam2.build_sam im... | 1 | 4 | 3 | 38 | 0 | 71 | 85 | 71 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (from_pretrained) defined within the public class called public.The function start at line 71 and ends at 85. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [71.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | set_image | def set_image(self,image: Union[np.ndarray, Image, torch.Tensor],) -> None:"""Calculates the image embeddings for the provided image, allowingmasks to be predicted with the 'predict' method.Arguments:image (np.ndarray or PIL Image): The input image to embed in RGB format. The image should be in HWC format if np.ndarray... | 5 | 30 | 2 | 292 | 0 | 88 | 136 | 88 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (set_image) defined within the public class called public.The function start at line 88 and ends at 136. It contains 30 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [88.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | set_image_batch | def set_image_batch(self,image_list: List[Union[np.ndarray, torch.Tensor]],) -> None:"""Calculates the image embeddings for the provided image batch, allowingmasks to be predicted with the 'predict_batch' method.Arguments:image_list (List[np.ndarray]): The input images to embed in RGB format. The image should be in HWC... | 7 | 35 | 2 | 339 | 0 | 139 | 185 | 139 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (set_image_batch) defined within the public class called public.The function start at line 139 and ends at 185. It contains 35 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [139.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | predict_batch | def predict_batch(self,point_coords_batch: List[np.ndarray] = None,point_labels_batch: List[np.ndarray] = None,box_batch: List[np.ndarray] = None,mask_input_batch: List[np.ndarray] = None,multimask_output: bool = True,return_logits: bool = False,normalize_coords=True,return_type: str = "numpy",) -> Tuple[List[np.ndarra... | 9 | 62 | 9 | 390 | 0 | 187 | 254 | 187 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (predict_batch) defined within the public class called public.The function start at line 187 and ends at 254. It contains 62 lines of code and it has a cyclomatic complexity of 9. It takes 9 parameters, represented as [187.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | predict | def predict(self,point_coords: Optional[np.ndarray] = None,point_labels: Optional[np.ndarray] = None,box: Optional[np.ndarray] = None,mask_input: Optional[np.ndarray] = None,multimask_output: bool = True,return_logits: bool = False,normalize_coords=True,return_type: str = "numpy",) -> Tuple[np.ndarray, np.ndarray, np.n... | 4 | 40 | 9 | 269 | 0 | 256 | 334 | 256 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (predict) defined within the public class called public.The function start at line 256 and ends at 334. It contains 40 lines of code and it has a cyclomatic complexity of 4. It takes 9 parameters, represented as [256.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _prep_prompts | def _prep_prompts(self, point_coords, point_labels, box, mask_logits, normalize_coords, img_idx=-1):unnorm_coords, labels, unnorm_box, mask_input = None, None, None, Noneif point_coords is not None:assert point_labels is not None, ("point_labels must be supplied if point_coords is supplied.")point_coords = (torch.as_te... | 6 | 35 | 7 | 267 | 0 | 336 | 370 | 336 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_prep_prompts) defined within the public class called public.The function start at line 336 and ends at 370. It contains 35 lines of code and it has a cyclomatic complexity of 6. It takes 7 parameters, represented as [336.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _predict | def _predict(self,point_coords: Optional[torch.Tensor],point_labels: Optional[torch.Tensor],boxes: Optional[torch.Tensor] = None,mask_input: Optional[torch.Tensor] = None,multimask_output: bool = True,return_logits: bool = False,img_idx: int = -1,) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:"""Predict masks for... | 4 | 41 | 8 | 272 | 0 | 373 | 451 | 373 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_predict) defined within the public class called public.The function start at line 373 and ends at 451. It contains 41 lines of code and it has a cyclomatic complexity of 4. It takes 8 parameters, represented as [373.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _predict_masks | def _predict_masks(self,high_res_feats_input,image_embed,image_pe,point_coords,point_labels,boxes: Optional[torch.Tensor] = None,mask_input: Optional[torch.Tensor] = None,multimask_output: bool = True,):# NOTE: img_idx causes unnecessary recompilations, because# the int guard will fail otherwise.# img_idx: int = -1):if... | 5 | 46 | 9 | 307 | 0 | 453 | 521 | 453 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_predict_masks) defined within the public class called public.The function start at line 453 and ends at 521. It contains 46 lines of code and it has a cyclomatic complexity of 5. It takes 9 parameters, represented as [453.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _predict_masks_postprocess | def _predict_masks_postprocess(self, low_res_masks, img_idx, return_logits, channel_1=False):# TODO: Might want to defer this until after data["iou_preds"] > self.pred_iou_threshwith torch.autograd.profiler.record_function("self._transforms.postprocess_masks"):# Upscale the masks to the original image resolutionif chan... | 3 | 18 | 5 | 106 | 0 | 523 | 543 | 523 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_predict_masks_postprocess) defined within the public class called public.The function start at line 523 and ends at 543. It contains 18 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [523.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_image_embedding | def get_image_embedding(self) -> torch.Tensor:"""Returns the image embeddings for the currently set image, withshape 1xCxHxW, where C is the embedding dimension and (H,W) arethe embedding spatial dimension of SAM (typically C=256, H=W=64)."""if not self._is_image_set:raise RuntimeError("An image must be set with .set_i... | 2 | 9 | 1 | 39 | 0 | 545 | 558 | 545 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_image_embedding) defined within the public class called public.The function start at line 545 and ends at 558. It contains 9 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 | device | def device(self) -> torch.device:return self.model.device | 1 | 2 | 1 | 15 | 0 | 561 | 562 | 561 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (device) defined within the public class called public.The function start at line 561 and ends at 562. 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 | reset_predictor | def reset_predictor(self) -> None:"""Resets the image embeddings and other state variables."""self._is_image_set = Falseself._features = Noneself._orig_hw = Noneself._is_batch = False | 1 | 5 | 1 | 28 | 0 | 564 | 571 | 564 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (reset_predictor) defined within the public class called public.The function start at line 564 and ends at 571. 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 | __init__ | def __init__(self,fill_hole_area=0,# whether to apply non-overlapping constraints on the output object masksnon_overlap_masks=False,# whether to clear non-conditioning memory of the surrounding frames (which may contain outdated information) after adding correction clicks;# note that this would only apply to *single-ob... | 1 | 15 | 7 | 63 | 0 | 24 | 44 | 24 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 24 and ends at 44. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [24.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | batch_inference_states | def batch_inference_states(inference_states: list):assert all(dict == type(state) for state in inference_states)num_states = len(inference_states)assert num_states > 0import copybatched_inference_state = copy.copy(inference_states[0])from torchao._models.sam2.map_tensor import to_map_tensor# NOTE: Making a build assump... | 3 | 10 | 1 | 82 | 0 | 47 | 60 | 47 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (batch_inference_states) defined within the public class called public.The function start at line 47 and ends at 60. It contains 10 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | init_state | def init_state(self,video_path,offload_video_to_cpu=False,offload_state_to_cpu=False,async_loading_frames=False,):"""Initialize an inference state."""compute_device = self.device# device of the modelimages, video_height, video_width = load_video_frames(video_path=video_path,image_size=self.image_size,offload_video_to_c... | 2 | 48 | 5 | 258 | 0 | 63 | 130 | 63 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (init_state) defined within the public class called public.The function start at line 63 and ends at 130. It contains 48 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [63.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | from_pretrained | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2VideoPredictor":"""Load a pretrained model from the Hugging Face hub.Arguments:model_id (str): The Hugging Face repository ID.**kwargs: Additional arguments to pass to the model constructor.Returns:(SAM2VideoPredictor): The loaded model."""from sam2.build_sam im... | 1 | 4 | 3 | 32 | 0 | 133 | 147 | 133 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (from_pretrained) defined within the public class called public.The function start at line 133 and ends at 147. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [133.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _obj_id_to_idx | def _obj_id_to_idx(self, inference_state, obj_id):"""Map client-side object id to model-side object index."""obj_idx = inference_state["obj_id_to_idx"].get(obj_id, None)if obj_idx is not None:return obj_idx# This is a new object id not sent to the server before. We only allow adding# new objects *before* the tracking s... | 3 | 27 | 3 | 154 | 0 | 149 | 181 | 149 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_obj_id_to_idx) defined within the public class called public.The function start at line 149 and ends at 181. It contains 27 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [149.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _obj_idx_to_id | def _obj_idx_to_id(self, inference_state, obj_idx):"""Map model-side object index to client-side object id."""return inference_state["obj_idx_to_id"][obj_idx] | 1 | 2 | 3 | 18 | 0 | 183 | 185 | 183 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_obj_idx_to_id) defined within the public class called public.The function start at line 183 and ends at 185. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [183.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_obj_num | def _get_obj_num(self, inference_state):"""Get the total number of unique object ids received so far in this session."""return len(inference_state["obj_idx_to_id"]) | 1 | 2 | 2 | 16 | 0 | 187 | 189 | 187 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_obj_num) defined within the public class called public.The function start at line 187 and ends at 189. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [187.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | add_new_points_or_box | def add_new_points_or_box(self,inference_state,frame_idx,obj_id,points=None,labels=None,clear_old_points=True,normalize_coords=True,box=None,):"""Add new points to a frame."""obj_idx = self._obj_id_to_idx(inference_state, obj_id)point_inputs_per_frame = inference_state["point_inputs_per_obj"][obj_idx]mask_inputs_per_fr... | 23 | 111 | 9 | 744 | 0 | 192 | 333 | 192 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_new_points_or_box) defined within the public class called public.The function start at line 192 and ends at 333. It contains 111 lines of code and it has a cyclomatic complexity of 23. It takes 9 parameters, represented as [192.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | add_new_points | def add_new_points(self, *args, **kwargs):"""Deprecated method. Please use `add_new_points_or_box` instead."""return self.add_new_points_or_box(*args, **kwargs) | 1 | 2 | 3 | 23 | 0 | 335 | 337 | 335 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_new_points) defined within the public class called public.The function start at line 335 and ends at 337. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [335.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | add_new_mask | def add_new_mask(self,inference_state,frame_idx,obj_id,mask,):"""Add new mask to a frame."""obj_idx = self._obj_id_to_idx(inference_state, obj_id)point_inputs_per_frame = inference_state["point_inputs_per_obj"][obj_idx]mask_inputs_per_frame = inference_state["mask_inputs_per_obj"][obj_idx]if not isinstance(mask, torch.... | 7 | 62 | 5 | 353 | 0 | 340 | 421 | 340 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_new_mask) defined within the public class called public.The function start at line 340 and ends at 421. It contains 62 lines of code and it has a cyclomatic complexity of 7. It takes 5 parameters, represented as [340.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_orig_video_res_output | def _get_orig_video_res_output(self, inference_state, any_res_masks):"""Resize the object scores to the original video resolution (video_res_masks)and apply non-overlapping constraints for final output."""device = inference_state["device"]video_H = inference_state["video_height"]video_W = inference_state["video_width"]... | 3 | 17 | 3 | 107 | 0 | 423 | 443 | 423 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_orig_video_res_output) defined within the public class called public.The function start at line 423 and ends at 443. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [423.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _consolidate_temp_output_across_obj | def _consolidate_temp_output_across_obj(self,inference_state,frame_idx,is_cond,run_mem_encoder,consolidate_at_video_res=False,):"""Consolidate the per-object temporary outputs in `temp_output_dict_per_obj` ona frame into a single output for all objects, including1) fill any missing objects either from `output_dict_per_... | 12 | 94 | 6 | 538 | 0 | 445 | 573 | 445 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_consolidate_temp_output_across_obj) defined within the public class called public.The function start at line 445 and ends at 573. It contains 94 lines of code and it has a cyclomatic complexity of 12. It takes 6 parameters, represented as [445.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_empty_mask_ptr | def _get_empty_mask_ptr(self, inference_state, frame_idx):"""Get a dummy object pointer based on an empty mask on the current frame."""# A dummy (empty) mask with a single objectbatch_size = 1mask_inputs = torch.zeros((batch_size, 1, self.image_size, self.image_size),dtype=torch.float32,device=inference_state["device"]... | 1 | 29 | 3 | 134 | 0 | 575 | 609 | 575 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_empty_mask_ptr) defined within the public class called public.The function start at line 575 and ends at 609. It contains 29 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [575.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | propagate_in_video_preflight | def propagate_in_video_preflight(self, inference_state):"""Prepare inference_state and consolidate temporary outputs before tracking."""# Tracking has started and we don't allow adding new objects until session is reset.inference_state["tracking_has_started"] = Truebatch_size = self._get_obj_num(inference_state)# Conso... | 15 | 45 | 2 | 319 | 0 | 612 | 679 | 612 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (propagate_in_video_preflight) defined within the public class called public.The function start at line 612 and ends at 679. It contains 45 lines of code and it has a cyclomatic complexity of 15. It takes 2 parameters, represented as [612.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | propagate_in_video | def propagate_in_video(self,inference_state,start_frame_idx=None,max_frame_num_to_track=None,reverse=False,):"""Propagate the input points across frames to track in the entire video."""self.propagate_in_video_preflight(inference_state)output_dict = inference_state["output_dict"]consolidated_frame_inds = inference_state... | 12 | 66 | 5 | 350 | 0 | 682 | 764 | 682 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (propagate_in_video) defined within the public class called public.The function start at line 682 and ends at 764. It contains 66 lines of code and it has a cyclomatic complexity of 12. It takes 5 parameters, represented as [682.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _add_output_per_object | def _add_output_per_object(self, inference_state, frame_idx, current_out, storage_key):"""Split a multi-object output into per-object output slices and add them into`output_dict_per_obj`. The resulting slices share the same tensor storage."""maskmem_features = current_out["maskmem_features"]assert maskmem_features is N... | 7 | 22 | 5 | 164 | 0 | 766 | 793 | 766 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_add_output_per_object) defined within the public class called public.The function start at line 766 and ends at 793. It contains 22 lines of code and it has a cyclomatic complexity of 7. It takes 5 parameters, represented as [766.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | clear_all_prompts_in_frame | def clear_all_prompts_in_frame(self, inference_state, frame_idx, obj_id, need_output=True):"""Remove all input points or mask in a specific frame for a given object."""obj_idx = self._obj_id_to_idx(inference_state, obj_id)# Clear the conditioning information on the given frameinference_state["point_inputs_per_obj"][obj... | 11 | 52 | 5 | 346 | 0 | 796 | 864 | 796 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (clear_all_prompts_in_frame) defined within the public class called public.The function start at line 796 and ends at 864. It contains 52 lines of code and it has a cyclomatic complexity of 11. It takes 5 parameters, represented as [796.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | reset_state | def reset_state(self, inference_state):"""Remove all input points or mask in all frames throughout the video."""self._reset_tracking_results(inference_state)# Remove all object idsinference_state["obj_id_to_idx"].clear()inference_state["obj_idx_to_id"].clear()inference_state["obj_ids"].clear()inference_state["point_inp... | 1 | 9 | 2 | 70 | 0 | 867 | 877 | 867 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (reset_state) defined within the public class called public.The function start at line 867 and ends at 877. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [867.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _reset_tracking_results | def _reset_tracking_results(self, inference_state):"""Reset all tracking inputs and results across the videos."""for v in inference_state["point_inputs_per_obj"].values():v.clear()for v in inference_state["mask_inputs_per_obj"].values():v.clear()for v in inference_state["output_dict_per_obj"].values():v["cond_frame_out... | 5 | 17 | 2 | 156 | 0 | 879 | 896 | 879 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_reset_tracking_results) defined within the public class called public.The function start at line 879 and ends at 896. It contains 17 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [879.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_image_feature | def _get_image_feature(self, inference_state, frame_idx, batch_size):"""Compute the image features on a given frame."""# Look up in the cache firstimage, backbone_out = inference_state["cached_features"].get(frame_idx, (None, None))if backbone_out is None:# Cache miss -- we will run inference on a single imagedevice = ... | 4 | 24 | 4 | 223 | 0 | 898 | 929 | 898 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_image_feature) defined within the public class called public.The function start at line 898 and ends at 929. It contains 24 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [898.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _run_single_frame_inference | def _run_single_frame_inference(self,inference_state,output_dict,frame_idx,batch_size,is_init_cond_frame,point_inputs,mask_inputs,reverse,run_mem_encoder,prev_sam_mask_logits=None,):"""Run tracking on a single frame based on current inputs and previous memory."""# Retrieve correct image features(_,_,current_vision_feat... | 4 | 57 | 11 | 243 | 0 | 932 | 998 | 932 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_run_single_frame_inference) defined within the public class called public.The function start at line 932 and ends at 998. It contains 57 lines of code and it has a cyclomatic complexity of 4. It takes 11 parameters, represented as [932.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _run_memory_encoder | def _run_memory_encoder(self,inference_state,frame_idx,batch_size,high_res_masks,object_score_logits,is_mask_from_pts,):"""Run the memory encoder on `high_res_masks`. This is usually after applyingnon-overlapping constraints to object scores. Since their scores changed, theirmemory also need to be computed again with t... | 1 | 26 | 7 | 114 | 0 | 1,000 | 1,034 | 1,000 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_run_memory_encoder) defined within the public class called public.The function start at line 1000 and ends at 1034. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [1000.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_maskmem_pos_enc | def _get_maskmem_pos_enc(self, inference_state, current_out):"""`maskmem_pos_enc` is the same across frames and objects, so we cache it asa constant in the inference session to reduce session storage size."""model_constants = inference_state["constants"]# "out_maskmem_pos_enc" should be either a list of tensors or None... | 5 | 17 | 3 | 114 | 0 | 1,036 | 1,059 | 1,036 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_maskmem_pos_enc) defined within the public class called public.The function start at line 1036 and ends at 1059. It contains 17 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [1036.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | remove_object._map_keys | def _map_keys(container):new_kvs = []for k in old_obj_inds:v = container.pop(k)if k in old_idx_to_new_idx:new_kvs.append((old_idx_to_new_idx[k], v))container.update(new_kvs) | 3 | 7 | 1 | 46 | 0 | 1,117 | 1,123 | 1,117 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (remove_object._map_keys) defined within the public class called public.The function start at line 1117 and ends at 1123. It contains 7 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 | remove_object._slice_state | def _slice_state(output_dict, storage_key):for frame_idx, out in output_dict[storage_key].items():out["maskmem_features"] = out["maskmem_features"][remain_old_obj_inds]out["maskmem_pos_enc"] = [x[remain_old_obj_inds] for x in out["maskmem_pos_enc"]]# "maskmem_pos_enc" is the same across frames, so we only need to store... | 3 | 15 | 2 | 112 | 0 | 1,131 | 1,147 | 1,131 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (remove_object._slice_state) defined within the public class called public.The function start at line 1131 and ends at 1147. It contains 15 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1131.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | remove_object | def remove_object(self, inference_state, obj_id, strict=False, need_output=True):"""Remove an object id from the tracking state. If strict is True, we check whetherthe object id actually exists and raise an error if it doesn't exist."""old_obj_idx_to_rm = inference_state["obj_id_to_idx"].get(obj_id, None)updated_frames... | 9 | 61 | 5 | 369 | 0 | 1,062 | 1,173 | 1,062 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (remove_object) defined within the public class called public.The function start at line 1062 and ends at 1173. It contains 61 lines of code and it has a cyclomatic complexity of 9. It takes 5 parameters, represented as [1062.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _clear_non_cond_mem_around_input | def _clear_non_cond_mem_around_input(self, inference_state, frame_idx):"""Remove the non-conditioning memory around the input frame. When users providecorrection clicks, the surrounding frames' non-conditioning memories can stillcontain outdated object appearance information and could confuse the model.This method clea... | 3 | 10 | 3 | 88 | 0 | 1,175 | 1,192 | 1,175 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_clear_non_cond_mem_around_input) defined within the public class called public.The function start at line 1175 and ends at 1192. It contains 10 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [1175.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,activation: str,cross_attention: nn.Module,d_model: int,dim_feedforward: int,dropout: float,pos_enc_at_attn: bool,pos_enc_at_cross_attn_keys: bool,pos_enc_at_cross_attn_queries: bool,self_attention: nn.Module,):super().__init__()self.d_model = d_modelself.dim_feedforward = dim_feedforwardself.dropout_... | 1 | 32 | 10 | 200 | 0 | 17 | 54 | 17 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 17 and ends at 54. It contains 32 lines of code and it has a cyclomatic complexity of 1. It takes 10 parameters, represented as [17.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _forward_sa | def _forward_sa(self, tgt, query_pos):# Self-Attentiontgt2 = self.norm1(tgt)q = k = tgt2 + query_pos if self.pos_enc_at_attn else tgt2tgt2 = self.self_attn(q, k, v=tgt2)tgt = tgt + self.dropout1(tgt2)return tgt | 2 | 6 | 3 | 56 | 0 | 56 | 62 | 56 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_forward_sa) defined within the public class called public.The function start at line 56 and ends at 62. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [56.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _forward_ca | def _forward_ca(self, tgt, memory, query_pos, pos, num_k_exclude_rope=0):kwds = {}if num_k_exclude_rope > 0:assert isinstance(self.cross_attn_image, RoPEAttention)kwds = {"num_k_exclude_rope": num_k_exclude_rope}# Cross-Attentiontgt2 = self.norm2(tgt)tgt2 = self.cross_attn_image(q=tgt2 + query_pos if self.pos_enc_at_cr... | 4 | 14 | 6 | 100 | 0 | 64 | 79 | 64 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_forward_ca) defined within the public class called public.The function start at line 64 and ends at 79. It contains 14 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [64.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self,tgt,memory,pos: Optional[Tensor] = None,query_pos: Optional[Tensor] = None,num_k_exclude_rope: int = 0,) -> torch.Tensor:# Self-Attn, Cross-Attntgt = self._forward_sa(tgt, query_pos)tgt = self._forward_ca(tgt, memory, query_pos, pos, num_k_exclude_rope)# MLPtgt2 = self.norm3(tgt)tgt2 = self.linear2(sel... | 1 | 14 | 6 | 107 | 0 | 81 | 96 | 81 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 81 and ends at 96. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [81.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,d_model: int,pos_enc_at_input: bool,layer: nn.Module,num_layers: int,batch_first: bool = True,# Do layers expect batch first input?):super().__init__()self.d_model = d_modelself.layers = get_clones(layer, num_layers)self.num_layers = num_layersself.norm = nn.LayerNorm(d_model)self.pos_enc_at_input = p... | 1 | 15 | 6 | 77 | 0 | 100 | 114 | 100 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 100 and ends at 114. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [100.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self,curr: torch.Tensor,# self-attention inputsmemory: torch.Tensor,# cross-attention inputscurr_pos: Optional[Tensor] = None,# pos_enc for self-attention inputsmemory_pos: Optional[Tensor] = None,# pos_enc for cross-attention inputsnum_obj_ptr_tokens: int = 0,# number of object pointer *tokens*):if isinsta... | 8 | 42 | 6 | 257 | 0 | 116 | 166 | 116 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 116 and ends at 166. It contains 42 lines of code and it has a cyclomatic complexity of 8. It takes 6 parameters, represented as [116.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,embed_dim=256,kernel_size=4,stride=4,padding=0,total_stride=16,activation=nn.GELU,):super().__init__()num_layers = int(math.log2(total_stride) // math.log2(stride))assert stride**num_layers == total_strideself.encoder = nn.Sequential()mask_in_chans, mask_out_chans = 1, 1for _ in range(num_layers):mask... | 2 | 29 | 7 | 160 | 0 | 26 | 55 | 26 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 26 and ends at 55. It contains 29 lines of code and it has a cyclomatic complexity of 2. It takes 7 parameters, represented as [26.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x):return self.encoder(x) | 1 | 2 | 2 | 14 | 0 | 57 | 58 | 57 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 57 and ends at 58. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [57.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,dim,kernel_size=7,padding=3,drop_path=0.0,layer_scale_init_value=1e-6,use_dwconv=True,):super().__init__()self.dwconv = nn.Conv2d(dim,dim,kernel_size=kernel_size,padding=padding,groups=dim if use_dwconv else 1,)# depthwise convself.norm = LayerNorm2d(dim, eps=1e-6)self.pwconv1 = nn.Linear(dim, 4 * dim... | 4 | 29 | 7 | 170 | 0 | 74 | 102 | 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 102. It contains 29 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [74.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x):input = xx = self.dwconv(x)x = self.norm(x)x = x.permute(0, 2, 3, 1)# (N, C, H, W) -> (N, H, W, C)x = self.pwconv1(x)x = self.act(x)x = self.pwconv2(x)if self.gamma is not None:x = self.gamma * xx = x.permute(0, 3, 1, 2)# (N, H, W, C) -> (N, C, H, W)x = input + self.drop_path(x)return x | 2 | 13 | 2 | 105 | 0 | 104 | 117 | 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 117. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [104.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, layer, num_layers, dim=None, input_projection=False):super().__init__()self.proj = nn.Identity()self.layers = get_clones(layer, num_layers)if input_projection:assert dim is not Noneself.proj = nn.Conv2d(dim, dim, kernel_size=1) | 2 | 7 | 5 | 67 | 0 | 121 | 128 | 121 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 121 and ends at 128. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [121.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x):# normally x: (N, C, H, W)x = self.proj(x)for layer in self.layers:x = layer(x)return x | 2 | 5 | 2 | 30 | 0 | 130 | 135 | 130 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 130 and ends at 135. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [130.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,out_dim,mask_downsampler,fuser,position_encoding,in_dim=256,# in_dim of pix_feats):super().__init__()self.mask_downsampler = mask_downsamplerself.pix_feat_proj = nn.Conv2d(in_dim, in_dim, kernel_size=1)self.fuser = fuserself.position_encoding = position_encodingself.out_proj = nn.Identity()if out_dim ... | 2 | 16 | 6 | 86 | 0 | 139 | 156 | 139 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 139 and ends at 156. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [139.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self,pix_feat: torch.Tensor,masks: torch.Tensor,skip_mask_sigmoid: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:## Process masks# sigmoid, so that less domain shift from gt masks which are boolif not skip_mask_sigmoid:masks = F.sigmoid(masks)masks = self.mask_downsampler(masks)## Fuse pix_feats and d... | 2 | 16 | 4 | 121 | 0 | 158 | 181 | 158 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 158 and ends at 181. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [158.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,num_pos_feats,temperature: int = 10000,normalize: bool = True,scale: Optional[float] = None,):super().__init__()assert num_pos_feats % 2 == 0, "Expecting even model width"self.num_pos_feats = num_pos_feats // 2self.temperature = temperatureself.normalize = normalizeif scale is not None and normalize i... | 4 | 17 | 5 | 92 | 0 | 21 | 37 | 21 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 21 and ends at 37. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [21.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _encode_xy | def _encode_xy(self, x, y):# The positions are expected to be normalizedassert len(x) == len(y) and x.ndim == y.ndim == 1x_embed = x * self.scaley_embed = y * self.scaledim_t = torch.arange(self.num_pos_feats, dtype=torch.float32, device=x.device)dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)pos_x ... | 2 | 15 | 3 | 187 | 0 | 41 | 58 | 41 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_encode_xy) defined within the public class called public.The function start at line 41 and ends at 58. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [41.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | encode_boxes | def encode_boxes(self, x, y, w, h):pos_x, pos_y = self._encode_xy(x, y)pos = torch.cat((pos_y, pos_x, h[:, None], w[:, None]), dim=1)return pos | 1 | 4 | 5 | 57 | 0 | 61 | 64 | 61 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (encode_boxes) defined within the public class called public.The function start at line 61 and ends at 64. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [61.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | encode_points | def encode_points(self, x, y, labels):(bx, nx), (by, ny), (bl, nl) = x.shape, y.shape, labels.shapeassert bx == by and nx == ny and bx == bl and nx == nlpos_x, pos_y = self._encode_xy(x.flatten(), y.flatten())pos_x, pos_y = pos_x.reshape(bx, nx, -1), pos_y.reshape(by, ny, -1)pos = torch.cat((pos_y, pos_x, labels[:, :, ... | 4 | 7 | 4 | 130 | 0 | 69 | 75 | 69 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (encode_points) defined within the public class called public.The function start at line 69 and ends at 75. It contains 7 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [69.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x: torch.Tensor):# cache_key = (x.shape[-2], x.shape[-1])# if cache_key in self.cache:# return self.cache[cache_key][None].repeat(x.shape[0], 1, 1, 1)y_embed = (torch.arange(1, x.shape[-2] + 1, dtype=torch.float32, device=x.device).view(1, -1, 1).repeat(x.shape[0], 1, x.shape[-1]))x_embed = (torch.ara... | 2 | 27 | 2 | 382 | 0 | 78 | 111 | 78 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 78 and ends at 111. It contains 27 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [78.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, num_pos_feats: int = 64, scale: Optional[float] = None) -> None:super().__init__()if scale is None or scale <= 0.0:scale = 1.0self.register_buffer("positional_encoding_gaussian_matrix",scale * torch.randn((2, num_pos_feats)),) | 3 | 8 | 3 | 65 | 0 | 119 | 126 | 119 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 119 and ends at 126. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [119.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _pe_encoding | def _pe_encoding(self, coords: torch.Tensor) -> torch.Tensor:"""Positionally encode points that are normalized to [0,1]."""# assuming coords are in [0, 1]^2 square and have d_1 x ... x d_n x 2 shapecoords = 2 * coords - 1coords = coords @ self.positional_encoding_gaussian_matrixcoords = 2 * np.pi * coords# outputs d_1 ... | 1 | 5 | 2 | 65 | 0 | 128 | 135 | 128 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_pe_encoding) defined within the public class called public.The function start at line 128 and ends at 135. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [128.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, size: Tuple[int, int]) -> torch.Tensor:"""Generate positional encoding for a grid of the specified size."""h, w = sizedevice: Any = self.positional_encoding_gaussian_matrix.devicegrid = torch.ones((h, w), device=device, dtype=torch.float32)y_embed = grid.cumsum(dim=0) - 0.5x_embed = grid.cumsum(dim=1)... | 1 | 10 | 2 | 126 | 0 | 137 | 148 | 137 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 137 and ends at 148. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [137.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward_with_coords | def forward_with_coords(self, coords_input: torch.Tensor, image_size: Tuple[int, int]) -> torch.Tensor:"""Positionally encode points that are not normalized to [0,1]."""coords = coords_input.clone()coords[:, :, 0] = coords[:, :, 0] / image_size[1]coords[:, :, 1] = coords[:, :, 1] / image_size[0]return self._pe_encoding... | 1 | 7 | 3 | 90 | 0 | 150 | 157 | 150 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward_with_coords) defined within the public class called public.The function start at line 150 and ends at 157. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [150.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | init_t_xy | def init_t_xy(end_x: int, end_y: int, device=None):t = torch.arange(end_x * end_y, dtype=torch.float32, device=device)t_x = (t % end_x).float()t_y = torch.div(t, end_x, rounding_mode="floor").float()return t_x, t_y | 1 | 5 | 3 | 68 | 3 | 166 | 170 | 166 | null | ['t_x', 't', 't_y'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (init_t_xy) defined within the public class called public.The function start at line 166 and ends at 170. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [166.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.