docstr: Tests that fqn_to_module works for tensors, actually all parameters
  of the model. This is tested by identifying a module with a tensor,
  and generating the tensor_fqn using module_to_fqn on the module +
  the name of the tensor.
docstr_tok: ["Tests","that","fqn_to_module","works","for","tensors",",","actually","all","parameters","of","the","model",".","This","is","tested","by","identifying","a","module","with","a","tensor",",","and","generating","the","tensor_fqn","using","module_to_fqn","on","the","module","+","the","name","of","the","tensor","."]
code: def test_fqn_to_module_for_tensors(self):
      """
      Tests that fqn_to_module works for tensors, actually all parameters
      of the model. This is tested by identifying a module with a tensor,
      and generating the tensor_fqn using module_to_fqn on the module +
      the name of the tensor.
      """
      for model_class in model_list:
          model = model_class()
          list_of_modules = [m for _, m in model.named_modules()] + [
              model
          ]
          for module in list_of_modules:
              module_fqn = module_to_fqn(model, module)
              for tensor_name, tensor in module.named_parameters(
                  recurse=False
              ):
                  tensor_fqn = (  # string manip to handle tensors on root
                      module_fqn
                      + ("." if module_fqn != "" else "")
                      + tensor_name
                  )
                  check_tensor = fqn_to_module(model, tensor_fqn)
                  self.assertEqual(tensor, check_tensor)
  
file_path: pytorch/test/ao/sparsity/test_sparsity_utils.py
imports: import logging
  import torch
  from torch.ao.pruning.sparsifier.utils import fqn_to_module, get_arg_info_from_tensor_fqn, module_to_fqn
  from torch.testing._internal.common_quantization import ConvBnReLUModel, ConvModel, FunctionalLinear, LinearAddModel, ManualEmbeddingBagLinear, SingleLayerLinearModel, TwoLayerLinearModel
  from torch.testing._internal.common_utils import TestCase
label_desc: Use image node_id 6 for calling the TestSparsityUtilFunctions obj's underlying member method code with example usage: obj.test_fqn_to_module_for_tensors() without return types