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 | test_chunk_size_equivalence | def test_chunk_size_equivalence(self, dtype: torch.dtype, shape, chunk_size):a = torch.randn(shape, device="cuda", dtype=dtype)with unittest.mock.patch("torchao.dtypes.nf4tensor.CHUNK_SIZE", chunk_size):nf4_patched = to_nf4(a, 16, 2)# This will be essentially no chunking since the numel is alot smaller than default chu... | 1 | 6 | 4 | 77 | 0 | 284 | 291 | 284 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_chunk_size_equivalence) defined within the public class called public.The function start at line 284 and ends at 291. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [284.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_empty_like | def test_empty_like(self, input_size: Union[Tuple[int], int]):nf4_tensor = to_nf4(torch.rand(input_size, device="cuda"))new_tensor = torch.empty_like(nf4_tensor, device="cpu")self.assertTrue(isinstance(new_tensor, NF4Tensor))self.assertEqual(new_tensor.get_device(), -1)# that it's on CPUself.assertEqual(new_tensor.size... | 1 | 6 | 2 | 84 | 0 | 295 | 300 | 295 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_empty_like) defined within the public class called public.The function start at line 295 and ends at 300. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [295.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quantize_api | def test_quantize_api(self, compile):nf4_linear = nn.Linear(512, 512, device="cuda")torchao.quantize_(nf4_linear, nf4_weight_only())assert isinstance(nf4_linear.weight, NF4Tensor)ref_linear = copy.deepcopy(nf4_linear)ref_linear.weight.data = ref_linear.weight.get_original_weight()# dequantizeif compile:nf4_linear.compi... | 2 | 18 | 2 | 165 | 0 | 304 | 326 | 304 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quantize_api) defined within the public class called public.The function start at line 304 and ends at 326. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [304.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_torch_chunk_valid | def test_torch_chunk_valid(self, input_size: Union[Tuple[int], int]):num_chunks = 2nf4_tensor = to_nf4(torch.randn(input_size))chunks = list(torch.chunk(nf4_tensor, num_chunks))self.assertEqual(len(chunks), num_chunks)if isinstance(input_size, int):expected_size0 = input_size // num_chunkselse:expected_size0 = input_si... | 3 | 11 | 2 | 94 | 0 | 331 | 341 | 331 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_torch_chunk_valid) defined within the public class called public.The function start at line 331 and ends at 341. It contains 11 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [331.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_torch_chunk_invalid_divide | def test_torch_chunk_invalid_divide(self, input_size: Union[Tuple[int], int]):num_chunks = 2with self.assertRaisesRegex(AssertionError, "Number of scalers must be divisible by scaler block size"):nf4_tensor = to_nf4(torch.randn(input_size))torch.chunk(nf4_tensor, num_chunks) | 1 | 7 | 2 | 49 | 0 | 344 | 350 | 344 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_torch_chunk_invalid_divide) defined within the public class called public.The function start at line 344 and ends at 350. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [344.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_torch_chunk_invalid_3d | def test_torch_chunk_invalid_3d(self, input_size: Union[Tuple[int], int]):num_chunks = 2with self.assertRaisesRegex(AssertionError, "expect input tensor dim <= 2"):nf4_tensor = to_nf4(torch.randn(input_size))torch.chunk(nf4_tensor, num_chunks) | 1 | 5 | 2 | 49 | 0 | 353 | 357 | 353 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_torch_chunk_invalid_3d) 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 1. It takes 2 parameters, represented as [353.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_new_zeros_valid | def test_tensor_new_zeros_valid(self, input_size: Union[Tuple[int], int]):nf4_tensor = to_nf4(torch.randn(input_size))nf4_tensor_zeros = nf4_tensor.new_zeros(input_size)for attr in _INNER_TENSOR_NAMES_FOR_SHARDING:inner_tensor = getattr(nf4_tensor_zeros, attr)self.assertEqual(torch.count_nonzero(inner_tensor), 0)expect... | 3 | 8 | 2 | 95 | 0 | 360 | 367 | 360 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_new_zeros_valid) defined within the public class called public.The function start at line 360 and ends at 367. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [360.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_new_zeros_invalid | def test_tensor_new_zeros_invalid(self, input_size: Union[Tuple[int], int]):if isinstance(input_size, int):new_size = input_size + 1elif len(input_size) == 1:new_size = (input_size[0] + 1,)else:new_size = (input_size[0] + 1, input_size[1])nf4_tensor = to_nf4(torch.randn(input_size))with self.assertRaisesRegex(NotImplem... | 3 | 12 | 2 | 95 | 0 | 370 | 381 | 370 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_new_zeros_invalid) defined within the public class called public.The function start at line 370 and ends at 381. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [370.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_slice_valid | def test_tensor_slice_valid(self, input_size: Union[Tuple[int], int]):nf4_tensor = to_nf4(torch.randn(input_size))orig_attrs, _ = nf4_tensor.__tensor_flatten__()orig_sizes = dict([(attr, getattr(nf4_tensor, attr).size()) for attr in orig_attrs])end_idx = input_size if isinstance(input_size, int) else input_size[0]slice... | 4 | 17 | 2 | 169 | 0 | 384 | 400 | 384 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_slice_valid) defined within the public class called public.The function start at line 384 and ends at 400. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [384.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_slice_1d_invalid | def test_tensor_slice_1d_invalid(self):nf4_tensor = to_nf4(torch.randn(512 * 512))with self.assertRaisesRegex(NotImplementedError, "aten.slice\\(NF4Tensor\\) with customized step"):nf4_tensor[..., ::2]with self.assertRaisesRegex(NotImplementedError, "aten.slice\\(NF4Tensor\\) with start"):nf4_tensor[1:]with self.assert... | 1 | 14 | 1 | 65 | 0 | 402 | 415 | 402 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_slice_1d_invalid) defined within the public class called public.The function start at line 402 and ends at 415. 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_tensor_slice_2d_invalid | def test_tensor_slice_2d_invalid(self):nf4_tensor = to_nf4(torch.randn((512, 512)))with self.assertRaisesRegex(NotImplementedError, "aten.slice\\(NF4Tensor\\) with dim"):nf4_tensor[:, :511]with self.assertRaisesRegex(NotImplementedError, "aten.slice\\(NF4Tensor\\) with start"):nf4_tensor[1:]with self.assertRaisesRegex(... | 1 | 14 | 1 | 67 | 0 | 417 | 430 | 417 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_slice_2d_invalid) defined within the public class called public.The function start at line 417 and ends at 430. 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_tensor_view_valid | def test_tensor_view_valid(self, input_size: Union[Tuple[int], int]):nf4_tensor = to_nf4(torch.randn(input_size))viewed_tensor = nf4_tensor.view(-1)self.assertEqual(viewed_tensor.dim(), 1)self.assertEqual(viewed_tensor.numel(), math.prod(input_size))for attr in _INNER_TENSOR_NAMES_FOR_SHARDING:inner_tensor = getattr(vi... | 2 | 8 | 2 | 96 | 0 | 433 | 440 | 433 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_view_valid) defined within the public class called public.The function start at line 433 and ends at 440. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [433.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_2d_view_valid | def test_tensor_2d_view_valid(self, input_size: Tuple[int]):nf4_tensor = to_nf4(torch.randn(input_size))viewed_tensor = nf4_tensor.view(input_size)self.assertEqual(viewed_tensor.dim(), 2)self.assertEqual(viewed_tensor.numel(), math.prod(input_size))for attr in _INNER_TENSOR_NAMES_FOR_SHARDING:inner_tensor = getattr(vie... | 2 | 8 | 2 | 90 | 0 | 443 | 450 | 443 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_2d_view_valid) defined within the public class called public.The function start at line 443 and ends at 450. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [443.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_view_invalid | def test_tensor_view_invalid(self, input_size: Union[Tuple[int], int]):nf4_tensor = to_nf4(torch.randn(input_size))if len(input_size) == 1:with self.assertRaisesRegex(NotImplementedError, "aten.view\\(NF4Tensor\\) with size"):nf4_tensor.view(input_size) | 2 | 7 | 2 | 52 | 0 | 453 | 459 | 453 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_view_invalid) defined within the public class called public.The function start at line 453 and ends at 459. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [453.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_as_strided_valid | def test_tensor_as_strided_valid(self, input_size: Union[Tuple[int], int]):nf4_tensor = to_nf4(torch.randn(input_size))nf4_tensor_strided = torch.as_strided(nf4_tensor,nf4_tensor.size(),nf4_tensor.stride(),nf4_tensor.storage_offset(),)self.assertEqual(nf4_tensor_strided.size(), nf4_tensor.size())self.assertEqual(nf4_te... | 2 | 22 | 2 | 173 | 0 | 462 | 483 | 462 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_as_strided_valid) defined within the public class called public.The function start at line 462 and ends at 483. It contains 22 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [462.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_as_strided_invalid | def test_tensor_as_strided_invalid(self, input_size: Union[Tuple[int], int]):nf4_tensor = to_nf4(torch.randn(input_size))if len(input_size) == 1:size = (input_size[0] - 1,)else:size = (input_size[0] - 1, input_size[1])with self.assertRaisesRegex(NotImplementedError, "aten.as_strided\\(NF4Tensor\\) different numel"):tor... | 3 | 26 | 2 | 185 | 0 | 486 | 512 | 486 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_as_strided_invalid) defined within the public class called public.The function start at line 486 and ends at 512. It contains 26 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [486.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_pin_memory | def test_pin_memory(self):nf4_tensor = to_nf4(torch.randn(512 * 512))self.assertFalse(nf4_tensor.is_pinned())nf4_tensor = nf4_tensor.pin_memory()self.assertTrue(nf4_tensor.is_pinned())nf4_tensor = to_nf4(torch.randn(512 * 512, device="cuda"))self.assertFalse(nf4_tensor.is_pinned()) | 1 | 7 | 1 | 72 | 0 | 515 | 523 | 515 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pin_memory) defined within the public class called public.The function start at line 515 and ends at 523. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_to_cuda | def test_to_cuda(self):nf4_tensor = to_nf4(torch.randn(512 * 512))self.assertEqual(nf4_tensor.device.type, "cpu")nf4_tensor = nf4_tensor.to("cuda", non_blocking=True)self.assertEqual(nf4_tensor.device.type, "cuda")self.assertEqual(type(nf4_tensor), NF4Tensor)nf4_tensor.get_original_weight()# make sure we can dequantize... | 1 | 19 | 1 | 205 | 0 | 526 | 546 | 526 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_to_cuda) defined within the public class called public.The function start at line 526 and ends at 546. It contains 19 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_to_cpu | def test_to_cpu(self):nf4_tensor = to_nf4(torch.randn(512 * 512, device="cuda"))nf4_tensor = nf4_tensor.cpu()self.assertEqual(nf4_tensor.device.type, "cpu")for attr in _INNER_TENSOR_NAMES_FOR_SHARDING:inner_tensor = getattr(nf4_tensor, attr)self.assertEqual(inner_tensor.device.type, "cpu")nf4_tensor.get_original_weight... | 2 | 8 | 1 | 71 | 0 | 549 | 556 | 549 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_to_cpu) defined within the public class called public.The function start at line 549 and ends at 556. 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 | test_to_module | def test_to_module(self):linear = nn.Linear(512, 512, bias=False)linear.weight = nn.Parameter(to_nf4(linear.weight.detach()), requires_grad=False)linear.cuda()self.assertEqual(linear.weight.device.type, "cuda")weight = linear.weight.get_original_weight()self.assertEqual(weight.device.type, "cuda")linear.cpu()self.asser... | 1 | 25 | 1 | 241 | 0 | 559 | 586 | 559 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_to_module) defined within the public class called public.The function start at line 559 and ends at 586. It contains 25 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_tensor_deepcopy | def test_tensor_deepcopy(self, input_size: Union[Tuple[int], int]):nf4_orig = to_nf4(torch.randn(input_size, device="cuda"))nf4_clone = copy.deepcopy(nf4_orig)self.assertEqual(nf4_clone.get_original_weight(), nf4_orig.get_original_weight()) | 1 | 6 | 2 | 56 | 0 | 590 | 595 | 590 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_tensor_deepcopy) defined within the public class called public.The function start at line 590 and ends at 595. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [590.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,in_dim: int,out_dim: int,weight: torch.Tensor,rank: int,alpha: float,dropout: float = 0.0,):super().__init__()self.in_dim = in_dimself.rank = rankself.alpha = alphaself.out_dim = out_dimself.register_parameter("weight", nn.Parameter(to_nf4(weight)))self.dropout = nn.Dropout(p=dropout)self.lora_a = nn.... | 1 | 19 | 7 | 136 | 0 | 599 | 617 | 599 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 599 and ends at 617. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [599.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | initialize_parameters | def initialize_parameters(self):nn.init.kaiming_uniform_(self.lora_a.weight, a=math.sqrt(5))nn.init.kaiming_uniform_(self.lora_b.weight, a=math.sqrt(5)) | 1 | 3 | 1 | 47 | 0 | 619 | 621 | 619 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (initialize_parameters) defined within the public class called public.The function start at line 619 and ends at 621. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x: torch.Tensor) -> torch.Tensor:out = linear_nf4(input=x, weight=self.weight)lora_out = self.lora_a(self.dropout(x))lora_out = (self.alpha / self.rank) * self.lora_b(lora_out)return out + lora_out | 1 | 5 | 2 | 64 | 0 | 623 | 627 | 623 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 623 and ends at 627. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [623.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | world_size | def world_size(self) -> int:return 2 | 1 | 2 | 1 | 9 | 0 | 632 | 633 | 632 | 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 632 and ends at 633. 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_qlora_fsdp2 | def test_qlora_fsdp2(self):from torch.distributed._composable.fsdp import CPUOffloadPolicy, OffloadPolicyself.run_subtests({"enable_activation_checkpointing": [False, True],"offload_policy": [OffloadPolicy(),CPUOffloadPolicy(pin_memory=True),CPUOffloadPolicy(pin_memory=False),],},self._test_qlora_fsdp2,) | 1 | 13 | 1 | 60 | 0 | 640 | 653 | 640 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_qlora_fsdp2) defined within the public class called public.The function start at line 640 and ends at 653. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _test_qlora_fsdp2 | def _test_qlora_fsdp2(self,enable_activation_checkpointing: bool,offload_policy: "OffloadPolicy",# noqa: F821):from torch.distributed._composable.fsdp import fully_shardfrom torch.testing._internal.distributed._tensor.common_dtensor import (ModelArgs,Transformer,TransformerBlock,)batch_size = 3lora_r = 8lora_alpha = 16... | 14 | 91 | 3 | 540 | 0 | 655 | 750 | 655 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_test_qlora_fsdp2) defined within the public class called public.The function start at line 655 and ends at 750. It contains 91 lines of code and it has a cyclomatic complexity of 14. It takes 3 parameters, represented as [655.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | world_size | def world_size(self) -> int:return 2 | 1 | 2 | 1 | 9 | 0 | 755 | 756 | 632 | 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 755 and ends at 756. 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_comm | def test_comm(self):self.run_subtests({"input_size": [512, 2048]},self._test_comm,) | 1 | 5 | 1 | 24 | 0 | 759 | 763 | 759 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_comm) defined within the public class called public.The function start at line 759 and ends at 763. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _test_comm | def _test_comm(self, input_size: int):from torch.distributed._composable.fsdp import fully_shardfrom torch.distributed._tensor import distribute_tensormodel = nn.Linear(input_size, input_size, device="cuda")origin_tensor = model.weightorigin_nf4_tensor = to_nf4(origin_tensor)model = fully_shard(model)sharded_tensor = m... | 1 | 19 | 2 | 109 | 0 | 765 | 786 | 765 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_test_comm) defined within the public class called public.The function start at line 765 and ends at 786. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [765.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _apply_weight_only_uint4_quant.fn | def fn(mod):mod.weight = torch.nn.Parameter(PerChannelSymmetricWeightUInt4Tensor.from_float(mod.weight),requires_grad=False,)return mod | 1 | 6 | 1 | 31 | 0 | 40 | 45 | 40 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_apply_weight_only_uint4_quant.fn) defined within the public class called public.The function start at line 40 and ends at 45. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _apply_weight_only_uint4_quant | def _apply_weight_only_uint4_quant(model):def fn(mod):mod.weight = torch.nn.Parameter(PerChannelSymmetricWeightUInt4Tensor.from_float(mod.weight),requires_grad=False,)return mod_replace_with_custom_fn_if_matches_filter(model,lambda mod: fn(mod),lambda mod, fqn: isinstance(mod, torch.nn.Linear),) | 1 | 7 | 1 | 36 | 0 | 39 | 51 | 39 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_apply_weight_only_uint4_quant) defined within the public class called public.The function start at line 39 and ends at 51. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_basic_tensor_ops | def test_basic_tensor_ops(self):x = UInt4Tensor(torch.tensor([[0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF],[0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF],[0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF],],dtype=torch.uint8,))self.assertEqual(x.shape, (3, 16))# TODO: make sure this returns torch.uint4self.assertIs... | 1 | 37 | 1 | 247 | 0 | 58 | 96 | 58 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_basic_tensor_ops) defined within the public class called public.The function start at line 58 and ends at 96. It contains 37 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_gpu_quant | def test_gpu_quant(self):for x_shape in [[2, 4], [5, 5, 5, 4], [1, 4, 4]]:x = torch.randn(*x_shape)m = nn.Sequential(nn.Linear(4, 16))m(x)# checking if it runs_apply_weight_only_uint4_quant(m)m(x)# checking if it runs# sqnr = compute_error(y_ref, y_wo)opt = torch.compile(m, fullgraph=True, mode="max-autotune")# make su... | 2 | 9 | 1 | 90 | 0 | 101 | 111 | 101 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_gpu_quant) defined within the public class called public.The function start at line 101 and ends at 111. 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 | test_pt2e_quant.__init__ | def __init__(self, *args, **kwargs):# just faking a dtype here# TODO: make flow work with new dtypessuper().__init__(dtype=torch.int8) | 1 | 2 | 3 | 23 | 0 | 120 | 123 | 120 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant.__init__) defined within the public class called public.The function start at line 120 and ends at 123. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [120.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_pt2e_quant.forward | def forward(self, x):return x | 1 | 2 | 2 | 9 | 0 | 125 | 126 | 125 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant.forward) defined within the public class called public.The function start at line 125 and ends at 126. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [125.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_pt2e_quant.calculate_qparams | def calculate_qparams(self, **kwargs):pass | 1 | 2 | 2 | 9 | 0 | 128 | 129 | 128 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant.calculate_qparams) defined within the public class called public.The function start at line 128 and ends at 129. It contains 2 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 | test_pt2e_quant.convert | def convert(self, model: GraphModule, observer_node: Node):with model.graph.inserting_before(observer_node):q_node = model.graph.call_function(torch.ops.qtensors.quantize_per_tensor_uint4,(observer_node.args[0], 1.0, 0),{},)dq_node = model.graph.call_function(torch.ops.qtensors.dequantize_per_tensor_uint4,(q_node, 1.0,... | 1 | 14 | 3 | 102 | 0 | 131 | 144 | 131 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant.convert) defined within the public class called public.The function start at line 131 and ends at 144. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [131.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_pt2e_quant.annotate | def annotate(self, model: torch.fx.GraphModule) -> torch.fx.GraphModule:uint4_qspec = QuantizationSpec(dtype=torch.uint4,quant_min=0,quant_max=2**4 - 1,qscheme=torch.per_tensor_affine,is_dynamic=False,observer_or_fake_quant_ctr=Uint4Observer,)int8_qspec = QuantizationSpec(dtype=torch.int8,quant_min=-128,quant_max=127,q... | 7 | 51 | 2 | 297 | 0 | 152 | 208 | 152 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant.annotate) defined within the public class called public.The function start at line 152 and ends at 208. It contains 51 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [152.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_pt2e_quant.validate | def validate(self, model: torch.fx.GraphModule) -> None:pass | 1 | 2 | 2 | 16 | 0 | 210 | 211 | 210 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant.validate) defined within the public class called public.The function start at line 210 and ends at 211. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [210.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_pt2e_quant.__init__ | def __init__(self):super().__init__()self.linear = torch.nn.Linear(4, 4) | 1 | 3 | 1 | 26 | 0 | 214 | 216 | 214 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant.__init__) defined within the public class called public.The function start at line 214 and ends at 216. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_pt2e_quant.forward | def forward(self, x):return self.linear(x) | 1 | 2 | 2 | 14 | 0 | 218 | 219 | 218 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant.forward) defined within the public class called public.The function start at line 218 and ends at 219. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [218.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_pt2e_quant | def test_pt2e_quant(self):from torch.ao.quantization.quantizer.xnnpack_quantizer_utils import (QuantizationConfig,)class Uint4Observer(ObserverBase):def __init__(self, *args, **kwargs):# just faking a dtype here# TODO: make flow work with new dtypessuper().__init__(dtype=torch.int8)def forward(self, x):return xdef calc... | 3 | 46 | 1 | 301 | 0 | 114 | 257 | 114 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pt2e_quant) defined within the public class called public.The function start at line 114 and ends at 257. It contains 46 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_before_and_after_tests | def run_before_and_after_tests():yieldtorch._dynamo.reset()# reset cache between tests | 1 | 3 | 0 | 12 | 0 | 33 | 35 | 33 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_before_and_after_tests) defined within the public class called public.The function start at line 33 and ends at 35. 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 | __init__ | def __init__(self, scale, device):super().__init__()self.net = torch.nn.Sequential(torch.nn.Linear(scale * 2, scale, bias=False, dtype=torch.float16, device=device),torch.nn.Linear(scale, scale, bias=False, dtype=torch.float16, device=device),torch.nn.Linear(scale, scale // 2, bias=False, dtype=torch.float16, device=de... | 1 | 13 | 3 | 91 | 0 | 39 | 51 | 39 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 39 and ends at 51. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [39.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x):return self.net(x) | 1 | 2 | 2 | 14 | 0 | 53 | 54 | 53 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 53 and ends at 54. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [53.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_uintx_quant_on_cpu_then_move_to_cuda | def test_uintx_quant_on_cpu_then_move_to_cuda(dtype, group_size):scale = 512fp16_mod_on_cpu = Linear16(scale, "cpu")quantize_(fp16_mod_on_cpu, UIntXWeightOnlyConfig(dtype, group_size=group_size))test_input_on_cpu = torch.randn(scale * 2, dtype=torch.float16, device="cpu")output_on_cpu = fp16_mod_on_cpu(test_input_on_cp... | 1 | 12 | 2 | 104 | 7 | 60 | 71 | 60 | null | ['test_input_on_cpu', 'fp16_mod_on_cpu', 'output_on_cuda', 'scale', 'test_input_on_cuda', 'fp16_mod_on_cuda', 'output_on_cpu'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_uintx_quant_on_cpu_then_move_to_cuda) defined within the public class called public.The function start at line 60 and ends at 71. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [60.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_uintx_weight_only_model_quant | def test_uintx_weight_only_model_quant(dtype, group_size, device):scale = 512fp16 = Linear16(scale, device)quantize_(fp16, UIntXWeightOnlyConfig(dtype, group_size=group_size))uintx = torch.compile(fp16, fullgraph=True)test_input = torch.randn(scale * 2, dtype=torch.float16, device=device)output = uintx.forward(test_inp... | 1 | 8 | 3 | 80 | 5 | 78 | 85 | 78 | null | ['output', 'test_input', 'fp16', 'scale', 'uintx'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_uintx_weight_only_model_quant) defined within the public class called public.The function start at line 78 and ends at 85. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [78.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_uintx_weight_only_quant | def test_uintx_weight_only_quant(dtype, group_size, device):input_float = torch.randn((1, 256), dtype=torch.float16, device=device)mapping_type = MappingType.SYMMETRICeps = torch.finfo(torch.float32).epszero_point_dtype = torch.int32block_size = (1, group_size)scale, zero_point = choose_qparams_affine(input_float,mappi... | 1 | 26 | 3 | 143 | 8 | 92 | 121 | 92 | null | ['input_float', 'deqaunt', 'q', 'block_size', 'aqt', 'eps', 'mapping_type', 'zero_point_dtype'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_uintx_weight_only_quant) defined within the public class called public.The function start at line 92 and ends at 121. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [92.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_uintx_target_dtype | def test_uintx_target_dtype(dtype):linear = torch.nn.Linear(128, 256, dtype=torch.bfloat16, device="cuda")# make sure it runsquantize_(linear, UIntXWeightOnlyConfig(dtype))linear(torch.randn(1, 128, dtype=torch.bfloat16, device="cuda")) | 1 | 4 | 1 | 57 | 1 | 126 | 130 | 126 | null | ['linear'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_uintx_target_dtype) defined within the public class called public.The function start at line 126 and ends at 130. 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 | test_uintx_target_dtype_compile | def test_uintx_target_dtype_compile(dtype):linear = torch.nn.Linear(128, 256, dtype=torch.bfloat16, device="cuda")# make sure it runsquantize_(linear, UIntXWeightOnlyConfig(dtype))linear = torch.compile(linear)linear(torch.randn(1, 128, dtype=torch.bfloat16, device="cuda")) | 1 | 5 | 1 | 65 | 1 | 135 | 140 | 135 | null | ['linear'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_uintx_target_dtype_compile) defined within the public class called public.The function start at line 135 and ends at 140. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_uintx_model_size | def test_uintx_model_size(dtype):from torchao.utils import get_model_size_in_bytes# scale size = 1/64 * 2 bytes = 1/32 bytes# zero_point size = 1/64 * 4 bytes = 1/16 bytes# dtype data size = 1 * bit_width/8 = bit_width/8 bytes_dtype_to_ratio = {torch.uint1: (1 / 8 + 1 / 16 + 1 / 32) / 2,torch.uint2: (2 / 8 + 1 / 16 + 1... | 1 | 18 | 1 | 221 | 4 | 145 | 167 | 145 | null | ['bf16_size', 'linear', 'quantized_size', '_dtype_to_ratio'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_uintx_model_size) defined within the public class called public.The function start at line 145 and ends at 167. 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 | __init__ | def __init__(self,hidden_dim: int,lora_rank: int = None,lora_alpha: float = 16,dtype: torch.dtype = torch.float32,):super().__init__()self.hidden_dim = hidden_dimif lora_rank is None:lora_rank = hidden_dim // 2weight = torch.randn(hidden_dim, hidden_dim, dtype=dtype)self.lora_rank = lora_rankself.lora_alpha = lora_alph... | 2 | 24 | 5 | 146 | 0 | 22 | 46 | 22 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 22 and ends at 46. It contains 24 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [22.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | initialize_parameters | def initialize_parameters(self):nn.init.kaiming_uniform_(self.lora_a.weight, a=math.sqrt(5))nn.init.kaiming_uniform_(self.lora_b.weight, a=math.sqrt(5)) | 1 | 3 | 1 | 47 | 0 | 48 | 50 | 48 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (initialize_parameters) defined within the public class called public.The function start at line 48 and ends at 50. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x: torch.Tensor) -> torch.Tensor:out = linear_nf4(input=x, weight=self.weight)lora_out = self.lora_a(x)lora_out = (self.lora_alpha / self.lora_rank) * self.lora_b(lora_out)return out + lora_out | 1 | 5 | 2 | 59 | 0 | 52 | 56 | 52 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 52 and ends at 56. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [52.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _init_model | def _init_model(dim, num_linears, device, dtype) -> nn.Module:with torch.device(device):modules = []for i in range(num_linears):modules += [LoRALinear(hidden_dim=dim, dtype=dtype)]seq = nn.Sequential(*modules)return seq | 2 | 7 | 4 | 60 | 2 | 59 | 66 | 59 | null | ['seq', 'modules'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_init_model) defined within the public class called public.The function start at line 59 and ends at 66. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [59.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | dist_print | def dist_print(*args, delay=0.5):rank = dist.get_rank()time.sleep(delay * rank)print(f"[rank{rank}]: ", *args, flush=True) | 1 | 4 | 2 | 39 | 1 | 69 | 72 | 69 | null | ['rank'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (dist_print) defined within the public class called public.The function start at line 69 and ends at 72. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [69.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | make_batch | def make_batch(global_bs, dim, dtype, device):batch = torch.randn((global_bs, dim), dtype=dtype, device=device)if dist.get_world_size() > 1:batch = batch.chunk(dist.get_world_size(), dim=0)[dist.get_rank()]return batch | 2 | 5 | 4 | 65 | 1 | 75 | 79 | 75 | null | ['batch'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (make_batch) defined within the public class called public.The function start at line 75 and ends at 79. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [75.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_ddp | def run_ddp(global_bs, dim, num_linears, device, dtype, num_steps, save_dir, compile):os.makedirs(save_dir, exist_ok=True)model = _init_model(dim, num_linears, device, dtype)model = DDP(model, device_ids=[device])if compile:model = torch.compile(model)optim = torch.optim.Adam(model.parameters(), lr=1e-2)losses = []for ... | 3 | 19 | 8 | 166 | 6 | 82 | 105 | 82 | null | ['optim', 'losses', 'save_path', 'model', 'loss', 'inp'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_ddp) defined within the public class called public.The function start at line 82 and ends at 105. It contains 19 lines of code and it has a cyclomatic complexity of 3. It takes 8 parameters, represented as [82.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | init_dist | def init_dist():dist.init_process_group(backend="nccl")torch.cuda.set_device(dist.get_rank())dist_print("Dist initialized with world size", dist.get_world_size()) | 1 | 4 | 0 | 34 | 0 | 108 | 111 | 108 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (init_dist) defined within the public class called public.The function start at line 108 and ends at 111. 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 | cleanup_dist | def cleanup_dist():dist.barrier()if dist.get_rank() == 0:print("Cleaning up dist")dist.destroy_process_group() | 2 | 5 | 0 | 27 | 0 | 114 | 118 | 114 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (cleanup_dist) defined within the public class called public.The function start at line 114 and ends at 118. 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 | distributed_context | def distributed_context():init_dist()yieldcleanup_dist() | 1 | 4 | 0 | 11 | 0 | 122 | 125 | 122 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (distributed_context) defined within the public class called public.The function start at line 122 and ends at 125. 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 | test_end_to_end_filtering | def test_end_to_end_filtering(recipe_type, module_dims, fqn, filter_fqns, expected):"""Test complete filtering workflow for both recipe types."""in_features, out_features = module_dims# Get the filter functionfilter_func = _auto_filter_for_recipe(recipe_type, filter_fqns)# Create test moduletest_module = nn.Linear(in_f... | 1 | 6 | 5 | 49 | 3 | 33 | 45 | 33 | null | ['filter_func', 'result', 'test_module'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_end_to_end_filtering) defined within the public class called public.The function start at line 33 and ends at 45. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [33.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_exact_boundary_dimensions_rowwise | def test_exact_boundary_dimensions_rowwise():"""Test exact boundary dimensions for rowwise filtering."""# Test exact thresholdsmodule_n_2048 = nn.Linear(4096, 2048)# N exactly 2048assert _auto_filter_for_rowwise(module_n_2048, "layer", []) is Falsemodule_k_1024 = nn.Linear(1024, 4112)# K exactly 1024assert _auto_filter... | 1 | 5 | 0 | 49 | 2 | 48 | 55 | 48 | null | ['module_n_2048', 'module_k_1024'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_exact_boundary_dimensions_rowwise) defined within the public class called public.The function start at line 48 and ends at 55. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_exact_boundary_dimensions_tensorwise | def test_exact_boundary_dimensions_tensorwise():"""Test exact boundary dimensions for tensorwise filtering."""# Test exact combined thresholdmodule_boundary = nn.Linear(4096, 1024)# K=4096, N=1024assert _auto_filter_for_tensorwise(module_boundary, "layer", []) is False | 1 | 3 | 0 | 27 | 1 | 58 | 62 | 58 | null | ['module_boundary'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_exact_boundary_dimensions_tensorwise) defined within the public class called public.The function start at line 58 and ends at 62. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_partial_fqn_matching | def test_partial_fqn_matching():"""Test partial FQN matching behavior."""filter_fqns = ["embed", "norm"]large_module = nn.Linear(8192, 4096)# (fqn, expected result from filter func)test_cases = [("model.embeddings.linear", False),# Contains "embed"("layer.norm.weight", False),# Contains "norm"("model.transformer.layer"... | 2 | 18 | 0 | 95 | 5 | 65 | 86 | 65 | null | ['result_rowwise', 'large_module', 'result_tensorwise', 'filter_fqns', 'test_cases'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_partial_fqn_matching) defined within the public class called public.The function start at line 65 and ends at 86. It contains 18 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 | bitwise_identical | def bitwise_identical(a: Float8TrainingTensor, b: Float8TrainingTensor) -> bool:assert torch.all(a._scale == b._scale).item(), "scales are not identical"assert torch.all(a._data == b._data).item(), "data is not identical"return True | 1 | 4 | 2 | 53 | 0 | 57 | 60 | 57 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (bitwise_identical) defined within the public class called public.The function start at line 57 and ends at 60. It contains 4 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 | test_preserves_dtype | def test_preserves_dtype(self) -> None:# hp means high precision, lp means low precisionhp_dtypes = (torch.float32, torch.float16, torch.bfloat16)lp_dtypes = FP8_TYPESfor hp_dtype, lp_dtype in itertools.product(hp_dtypes, lp_dtypes):x1_hp = torch.randn(4, 4, dtype=hp_dtype)x1_s = tensor_to_scale(x1_hp, lp_dtype)x2_lp =... | 2 | 9 | 1 | 84 | 0 | 64 | 73 | 64 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_preserves_dtype) defined within the public class called public.The function start at line 64 and ends at 73. 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 | test_differentiable_casts | def test_differentiable_casts(self) -> None:lp_dtypes = (e4m3_dtype, e5m2_dtype)for f8_dtype in lp_dtypes:x = torch.randn(1).requires_grad_()grad = torch.randn(1)x_s = tensor_to_scale(x, f8_dtype)x_f8 = hp_tensor_and_scale_to_float8(x, x_s, f8_dtype)x_f8_hp = x_f8.to_original_precision()x_f8_hp.backward(grad)# the grad... | 2 | 10 | 1 | 90 | 0 | 75 | 85 | 75 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_differentiable_casts) defined within the public class called public.The function start at line 75 and ends at 85. It contains 10 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_split_cat | def test_split_cat(self):a = torch.rand(16, 16, dtype=torch.bfloat16)scale = tensor_to_scale(a, e4m3_dtype)fp8_a = hp_tensor_and_scale_to_float8(a, scale, e4m3_dtype)splits = torch.split(fp8_a, 16)catted = torch.cat(splits, dim=0)assert bitwise_identical(fp8_a, catted) | 1 | 7 | 1 | 68 | 0 | 87 | 94 | 87 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_split_cat) defined within the public class called public.The function start at line 87 and ends at 94. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_index_put | def test_index_put(self):a = torch.rand(16, dtype=torch.bfloat16)scale_a = tensor_to_scale(a, e4m3_dtype)fp8_a = hp_tensor_and_scale_to_float8(a, scale_a, e4m3_dtype)index = torch.randint(0, 15, (16,), dtype=torch.long)b = torch.rand(16, 16, dtype=torch.bfloat16)scale_b = tensor_to_scale(b, e4m3_dtype)fp8_b = hp_tensor... | 1 | 14 | 1 | 134 | 0 | 96 | 112 | 96 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_index_put) defined within the public class called public.The function start at line 96 and ends at 112. 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_copy_ | def test_copy_(self):a = torch.rand(16, dtype=torch.bfloat16)scale_a = tensor_to_scale(a, e4m3_dtype)fp8_a = hp_tensor_and_scale_to_float8(a, scale_a, e4m3_dtype)b = torch.empty(16, dtype=torch.bfloat16)b.copy_(fp8_a)# Should worktorch.testing.assert_close(b, fp8_a.to_original_precision())with pytest.raises(RuntimeErro... | 1 | 17 | 1 | 131 | 0 | 114 | 132 | 114 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_copy_) defined within the public class called public.The function start at line 114 and ends at 132. It contains 17 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_transpose | def test_transpose(self):a = torch.rand((16, 16), dtype=torch.bfloat16)for axiswise_dim in (None, 0, -1):scale_a = tensor_to_scale(a, e4m3_dtype)fp8_a = hp_tensor_and_scale_to_float8(a, scale_a, e4m3_dtype, axiswise_dim=axiswise_dim)fp8_b = hp_tensor_and_scale_to_float8(a, scale_a, e4m3_dtype, axiswise_dim=axiswise_dim... | 2 | 16 | 1 | 115 | 0 | 134 | 151 | 134 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_transpose) defined within the public class called public.The function start at line 134 and ends at 151. It contains 16 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_axiswise_dynamic_cast | def test_axiswise_dynamic_cast(self, shape, axiswise_dim, round_scales_to_power_of_2):a = torch.randn(*shape, dtype=torch.bfloat16)linear_mm_config = LinearMMConfig()a_fp8 = hp_tensor_to_float8_dynamic(a,e4m3_dtype,linear_mm_config,scaling_granularity=ScalingGranularity.AXISWISE,axiswise_dim=axiswise_dim,round_scales_t... | 1 | 16 | 4 | 77 | 0 | 156 | 171 | 156 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_axiswise_dynamic_cast) defined within the public class called public.The function start at line 156 and ends at 171. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [156.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_axiswise_reshape | def test_axiswise_reshape(self):a = torch.randn(3, 5, 7, dtype=torch.bfloat16)linear_mm_config = LinearMMConfig()# if we scale across dim0, we can only reshape to [3, -1]a_fp8_d0 = hp_tensor_to_float8_dynamic(a,e4m3_dtype,linear_mm_config,scaling_granularity=ScalingGranularity.AXISWISE,axiswise_dim=0,)assert list(a_fp8... | 1 | 43 | 1 | 329 | 0 | 173 | 223 | 173 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_axiswise_reshape) defined within the public class called public.The function start at line 173 and ends at 223. It contains 43 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_axiswise_gemm | def test_axiswise_gemm(self, a_shape, a_granularity, b_granularity):a = torch.randn(*a_shape, dtype=torch.bfloat16, device="cuda")b = torch.randn(64, 32, dtype=torch.bfloat16, device="cuda")linear_mm_config = LinearMMConfig()a_fp8 = hp_tensor_to_float8_dynamic(a,e4m3_dtype,linear_mm_config,gemm_input_role=GemmInputRole... | 1 | 26 | 4 | 189 | 0 | 236 | 265 | 236 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_axiswise_gemm) defined within the public class called public.The function start at line 236 and ends at 265. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [236.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_dtype | def test_fp8_dtype(self,):if is_ROCM() and is_MI300():assert e4m3_dtype == torch.float8_e4m3fnuzelse:assert e4m3_dtype == torch.float8_e4m3fn | 3 | 7 | 1 | 29 | 0 | 268 | 274 | 268 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_dtype) defined within the public class called public.The function start at line 268 and ends at 274. 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 | _test_linear_impl | def _test_linear_impl(self,x,m_ref,config: Float8LinearConfig,use_ac: bool = False,):m_fp8 = Float8Linear.from_float(copy.deepcopy(m_ref),config,)for _ in range(2):if use_ac:y_fp8 = torch.utils.checkpoint.checkpoint(m_fp8, x, use_reentrant=False)else:y_fp8 = m_fp8(x)y_fp8.sum().backward()if use_ac:y_ref = torch.utils.c... | 5 | 29 | 5 | 196 | 0 | 278 | 311 | 278 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_test_linear_impl) defined within the public class called public.The function start at line 278 and ends at 311. It contains 29 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [278.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_linear_from_config_params | def test_linear_from_config_params(self,x_shape,emulate: bool,scaling_type_input: ScalingType,scaling_type_weight: ScalingType,scaling_type_grad_output: ScalingType,linear_dtype: torch.dtype,linear_bias: bool,use_ac: bool,):x = torch.randn(*x_shape, device="cuda", dtype=linear_dtype)m_ref = nn.Linear(16, 32, bias=linea... | 1 | 25 | 9 | 103 | 0 | 333 | 359 | 333 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_linear_from_config_params) defined within the public class called public.The function start at line 333 and ends at 359. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [333.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_linear_from_recipe | def test_linear_from_recipe(self,recipe_name,x_shape,linear_dtype: torch.dtype,linear_bias: bool,):x = torch.randn(*x_shape, device="cuda", dtype=linear_dtype)m_ref = nn.Linear(16, 32, bias=linear_bias, device="cuda", dtype=linear_dtype)config = Float8LinearConfig.from_recipe_name(recipe_name)self._test_linear_impl(x,m... | 1 | 15 | 5 | 78 | 0 | 382 | 396 | 382 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_linear_from_recipe) defined within the public class called public.The function start at line 382 and ends at 396. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [382.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_autocast_outputs | def test_autocast_outputs(self,emulate: bool,linear_dtype: torch.dtype,recipe_name: Float8LinearRecipeName,):m_ref = nn.Sequential(nn.Linear(32, 32, device="cuda", dtype=linear_dtype),nn.Linear(32, 32, device="cuda", dtype=linear_dtype),)config = Float8LinearConfig.from_recipe_name(recipe_name)# work around config bein... | 1 | 24 | 4 | 185 | 0 | 413 | 443 | 413 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_autocast_outputs) defined within the public class called public.The function start at line 413 and ends at 443. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [413.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_repr | def test_repr(self):m = nn.Linear(32, 16)config = Float8LinearConfig(emulate=True,)m = Float8Linear.from_float(copy.deepcopy(m),config=config,)s = m.__repr__()assert "i:dyn_ten_e4m3,w:dyn_ten_e4m3,go:dyn_ten_e5m2" in s | 1 | 11 | 1 | 53 | 0 | 445 | 455 | 445 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_repr) defined within the public class called public.The function start at line 445 and ends at 455. 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 | test_inference_mode | def test_inference_mode(self):x = torch.randn(32, 32, device="cuda")m = nn.Sequential(nn.Linear(32, 32)).cuda()m = convert_to_float8_training(m)with torch.inference_mode(mode=True):m(x) | 1 | 6 | 1 | 58 | 0 | 458 | 463 | 458 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_inference_mode) defined within the public class called public.The function start at line 458 and ends at 463. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_quantize | def test_quantize(self):x = torch.randn(32, 32, device="cuda")m = nn.Sequential(nn.Linear(32, 32)).cuda()m = convert_to_float8_training(m)assert isinstance(m[0], Float8Linear), "Module is not a Float8Linear"from torchao.quantization import Float8WeightOnlyConfig, quantize_quantize_(m, Float8WeightOnlyConfig())assert m[... | 1 | 12 | 1 | 102 | 0 | 466 | 478 | 466 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_quantize) defined within the public class called public.The function start at line 466 and ends at 478. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_scaled_mm_vs_emulated | def test_scaled_mm_vs_emulated(self, base_dtype, use_fast_accum):torch.manual_seed(42)input_dtype = e4m3_dtypeoutput_dtype = base_dtypecompare_type = torch.float32a = torch.randn(16, 16, device="cuda", dtype=base_dtype)b = torch.randn(32, 16, device="cuda", dtype=base_dtype).t()a_scale = tensor_to_scale(a, input_dtype)... | 3 | 31 | 3 | 251 | 0 | 490 | 526 | 490 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_scaled_mm_vs_emulated) defined within the public class called public.The function start at line 490 and ends at 526. It contains 31 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [490.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_different_configs_error | def test_different_configs_error(self):x_fp32 = torch.randn(16, 16, device="cuda")x_scale = torch.tensor(1.0, device="cuda")fp8_dtype = e4m3_dtypelinear_config_a = LinearMMConfig(ScaledMMConfig(False, True, False, False),ScaledMMConfig(False, False, False, False),ScaledMMConfig(False, False, False, False),)linear_confi... | 1 | 33 | 1 | 162 | 0 | 529 | 561 | 529 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_different_configs_error) defined within the public class called public.The function start at line 529 and ends at 561. It contains 33 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_pad_inner_dim | def test_pad_inner_dim(self, base_dtype, use_fast_accum):torch.manual_seed(42)input_dtype = e4m3_dtypecompare_type = torch.float32a = torch.randn(16, 41, device="cuda", dtype=base_dtype)b = torch.randn(41, 128, device="cuda", dtype=base_dtype)a_scale = tensor_to_scale(a, input_dtype).float()b_scale = tensor_to_scale(b,... | 1 | 65 | 3 | 285 | 0 | 571 | 642 | 571 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_pad_inner_dim) defined within the public class called public.The function start at line 571 and ends at 642. It contains 65 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [571.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_small_amax_float16 | def test_small_amax_float16(self, float8_dtype):# If we calculate scale naively with FP8_MAX_POS / amax,# the result may not be representable in fp16. Verify that# the way we calculate scales actually works for tensors with# small values.## naive_s = fp8_max_pos / (amax + eps)## failing case:## fp8_max_pos / (amax + ep... | 1 | 7 | 2 | 81 | 0 | 656 | 676 | 656 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_small_amax_float16) defined within the public class called public.The function start at line 656 and ends at 676. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [656.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_swap_root_linear | def test_swap_root_linear(self):for emulate in [True, False]:module = nn.Linear(3, 3)config = Float8LinearConfig(emulate=emulate)module = convert_to_float8_training(module, config=config)self.assertIsInstance(module, Float8Linear)self.assertEqual(module.linear_mm_config.output.emulate, emulate)self.assertEqual(module.l... | 2 | 8 | 1 | 78 | 0 | 680 | 687 | 680 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_root_linear) defined within the public class called public.The function start at line 680 and ends at 687. 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 | test_swap_root_linear_with_children_raises | def test_swap_root_linear_with_children_raises(self):for emulate in [True, False]:module = nn.Linear(3, 3)module.child = nn.Sequential(nn.Linear(3, 3))config = Float8LinearConfig(emulate=emulate)with self.assertRaisesRegex(AssertionError,"Does not support a root nn.Linear with children",):convert_to_float8_training(mod... | 2 | 10 | 1 | 68 | 0 | 689 | 698 | 689 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_root_linear_with_children_raises) defined within the public class called public.The function start at line 689 and ends at 698. It contains 10 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_swap_submodule_linears.__init__ | def __init__(self, dim: int):super().__init__()self.lin1 = nn.Linear(dim, 4 * dim)self.lin2 = nn.Linear(4 * dim, dim) | 1 | 4 | 2 | 44 | 0 | 702 | 705 | 702 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_submodule_linears.__init__) defined within the public class called public.The function start at line 702 and ends at 705. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [702.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_swap_submodule_linears | def test_swap_submodule_linears(self):class MLP(nn.Module):def __init__(self, dim: int):super().__init__()self.lin1 = nn.Linear(dim, 4 * dim)self.lin2 = nn.Linear(4 * dim, dim)for emulate in [True, False]:model = nn.Sequential(MLP(3), nn.Linear(3, 3), MLP(3))config = Float8LinearConfig(emulate=emulate)model = convert_t... | 2 | 12 | 1 | 130 | 0 | 700 | 715 | 700 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_submodule_linears) defined within the public class called public.The function start at line 700 and ends at 715. 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_swap_linears_with_filters.__init__ | def __init__(self, dim: int):super().__init__()self.lin1 = nn.Linear(dim, 4 * dim)self.lin2 = nn.Linear(4 * dim, 4 * dim) | 1 | 4 | 2 | 46 | 0 | 719 | 722 | 719 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_linears_with_filters.__init__) defined within the public class called public.The function start at line 719 and ends at 722. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [719.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_swap_linears_with_filters.module_filter_fn | def module_filter_fn(mod, fqn):return (mod.in_features >= size_limitand mod.out_features >= size_limitand mod.in_features % 16 == 0and mod.out_features % 16 == 0) | 4 | 7 | 2 | 37 | 0 | 729 | 735 | 729 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_linears_with_filters.module_filter_fn) defined within the public class called public.The function start at line 729 and ends at 735. It contains 7 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [729.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_swap_linears_with_filters | def test_swap_linears_with_filters(self):class MLP(nn.Module):def __init__(self, dim: int):super().__init__()self.lin1 = nn.Linear(dim, 4 * dim)self.lin2 = nn.Linear(4 * dim, 4 * dim)model = nn.Sequential(MLP(8), nn.Linear(32, 32), MLP(40))# filter out the linear layers whose shape is smaller than 32 or non-divisible b... | 1 | 17 | 1 | 131 | 0 | 717 | 752 | 717 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_linears_with_filters) defined within the public class called public.The function start at line 717 and ends at 752. It contains 17 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_swap_submodule_linears_with_skip.__init__ | def __init__(self, dim: int):super().__init__()self.lin1 = nn.Linear(dim, 4 * dim)self.lin2 = nn.Linear(4 * dim, dim) | 1 | 4 | 2 | 44 | 0 | 756 | 759 | 756 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_submodule_linears_with_skip.__init__) defined within the public class called public.The function start at line 756 and ends at 759. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [756.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_swap_submodule_linears_with_skip | def test_swap_submodule_linears_with_skip(self):class MLP(nn.Module):def __init__(self, dim: int):super().__init__()self.lin1 = nn.Linear(dim, 4 * dim)self.lin2 = nn.Linear(4 * dim, dim)model = nn.Sequential(MLP(3), nn.Linear(3, 3), MLP(3))module_filter_fn = lambda mod, fqn: fqn not in ["0.lin2","2.lin1",]config = Floa... | 1 | 19 | 1 | 161 | 0 | 754 | 776 | 754 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_swap_submodule_linears_with_skip) defined within the public class called public.The function start at line 754 and ends at 776. It contains 19 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_tensor_statistics | def test_fp8_tensor_statistics(self):hp_dtypes = (torch.float32, torch.float16, torch.bfloat16)lp_dtypes = (e4m3_dtype, e5m2_dtype)for hp_dtype, lp_dtype in itertools.product(hp_dtypes, lp_dtypes):x1_hp = torch.ones(4, 4, dtype=hp_dtype)tensor_len = x1_hp.numel()# Overflow caused by a too large scaling factors_overflow... | 2 | 20 | 1 | 227 | 0 | 778 | 803 | 778 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_tensor_statistics) defined within the public class called public.The function start at line 778 and ends at 803. It contains 20 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_compile_base | def _test_compile_base(backend: str,fullgraph: bool,config: Float8LinearConfig,dtype: torch.dtype,):random.seed(0)torch.manual_seed(0)x_shape = (16, 16)linear_dtype = torch.bfloat16x = torch.randn(*x_shape, device="cuda", dtype=linear_dtype).requires_grad_()x_ref = copy.deepcopy(x)m_ref = nn.Linear(16, 32, bias=True, d... | 1 | 29 | 4 | 287 | 8 | 41 | 74 | 41 | null | ['linear_dtype', 'x_shape', 'm_fp8', 'x', 'y_fp8', 'm_ref', 'y_ref', 'x_ref'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_test_compile_base) defined within the public class called public.The function start at line 41 and ends at 74. It contains 29 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [41.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_eager_only | def test_eager_only(fullgraph,emulate: bool,scaling_type_input: ScalingType,scaling_type_weight: ScalingType,scaling_type_grad_output: ScalingType,dtype: torch.dtype,):torch._dynamo.reset()config = get_test_float8_linear_config(scaling_type_input,scaling_type_weight,scaling_type_grad_output,emulate,)_test_compile_base(... | 1 | 21 | 6 | 59 | 1 | 90 | 110 | 90 | null | ['config'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_eager_only) defined within the public class called public.The function start at line 90 and ends at 110. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [90.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.