code: def test_parametrization(self, tensor_cls, leave_parametrized):
      # TODO: Either implement set_() properly for these tensor subclasses or apply a
      # more general fix to avoid the need for special set_() handling. For now, skip
      # testing these as they're expected to fail.
      if tensor_cls in [LoggingTensor, DiagTensorBelow]:
          return
  
      create_fn = partial(self._create_tensor, tensor_cls)
  
      class MyModule(nn.Module):
          def __init__(self):
              super().__init__()
              self.weight = nn.Parameter(create_fn())
  
          def forward(self, x):
              return self.weight + x
  
      class MyParametrization(nn.Module):
          def forward(self, X):
              return -X
  
      m = MyModule()
      self.assertEqual(len(m.state_dict()), 1)
      register_parametrization(m, "weight", MyParametrization())
      self.assertIsInstance(m.weight, tensor_cls)
      output = m(self._create_tensor(torch.Tensor))
      self.assertIsInstance(output, tensor_cls)
      remove_parametrizations(
          m, "weight", leave_parametrized=leave_parametrized
      )
  
imports: import tempfile
  from copy import deepcopy
  from functools import partial
  from unittest import expectedFailure
  import torch
  from torch import nn
  from torch.nn.modules.lazy import LazyModuleMixin
  from torch.nn.utils.parametrize import register_parametrization, remove_parametrizations
  from torch.testing._internal.common_subclass import DiagTensorBelow, subclass_db
  from torch.testing._internal.common_utils import TestCase, instantiate_parametrized_tests, parametrize, run_tests, skipIfTorchDynamo, subtest
  from torch.testing._internal.logging_tensor import LoggingTensor
  from torch.utils._pytree import tree_map
label_desc: Use image node_id 8 for calling the TestSubclass obj's underlying member method code with example usage: obj.test_parametrization(tensor_cls, leave_parametrized) and returns: unknown, unknown