<commit_before>class TorchAttributes(object):
    """
    TorchAttributes is a special class where all custom attributes related
    to the torch module can be added.
    """

    def __init__(self, torch):
        # SECTION: List all functions in torch module that we want to overload

        # List modules that we will hook
        self.torch_modules = {"torch": torch, "torch.nn.functional": torch.nn.functional}

        # List all the function names with module as prefix in the modules to hook
        self.torch_modules_functions = {
            f"{module_name}.{func_name}"
            for module_name, torch_module in self.torch_modules.items()
            for func_name in dir(torch_module)
        }

        self.eval_torch_modules_functions = {
            f"{module_name}.{func_name}": getattr(torch_module, func_name)
            for module_name, torch_module in self.torch_modules.items()
            for func_name in dir(torch_module)
        }

        # Add special functions to exclude from the hook
        self.torch_exclude = ["save", "load", "typename", "is_tensor", "manual_seed"]

        # SECTION: List all torch tensor methods we want to overload

        self.tensor_types = [torch.Tensor]

        self.tensorvar_methods = list(
            {method for tensorvar in self.tensor_types for method in dir(tensorvar)}
        )
        self.tensorvar_methods += ["get_shape", "share", "fix_precision", "decode", "end_get"]

        # Methods that caused infinite recursion during testing<commit_msg>removed unused/untested methods<commit_after>class TorchAttributes(object):
    """
    TorchAttributes is a special class where all custom attributes related
    to the torch module can be added.
    """

    def __init__(self, torch):
        # SECTION: List all functions in torch module that we want to overload

        # List modules that we will hook
        self.torch_modules = {"torch": torch, "torch.nn.functional": torch.nn.functional}

        # List all the function names with module as prefix in the modules to hook
        self.torch_modules_functions = {
            f"{module_name}.{func_name}"
            for module_name, torch_module in self.torch_modules.items()
            for func_name in dir(torch_module)
        }

        self.eval_torch_modules_functions = {
            f"{module_name}.{func_name}": getattr(torch_module, func_name)
            for module_name, torch_module in self.torch_modules.items()
            for func_name in dir(torch_module)
        }

        # Add special functions to exclude from the hook
        self.torch_exclude = ["save", "load", "typename", "is_tensor", "manual_seed"]

        # SECTION: List all torch tensor methods we want to overload

        # self.tensor_types = [torch.Tensor]

        self.tensorvar_methods = list(
            {method for tensorvar in self.tensor_types for method in dir(tensorvar)}
        )
        self.tensorvar_methods += ["get_shape", "share", "fix_precision", "decode", "end_get"]

        # Methods that caused infinite recursion during testing
{'fraction_non_alphanumeric': 0.0858257477243173, 'fraction_numerical': 0.0, 'mean_word_length': 2.7027677496991576, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4811800', 'n_tokens_mistral': 842, 'n_tokens_neox': 829, 'n_words': 267}