class_docstr: This class defines an nn.Module whose parameters are renamed. This is useful when you want to
  reimplement a layer but make sure its state_dict and list of parameters are exactly the same
  as another reference layer so that you can have a drop-in replacement that does not depend on
  how your layer is actually implemented. In Opacus, this is used for DPLSTM, where our
  implementation leverages submodules and requires alignment to the state_dict of nn.LSTM.
  
  Example:
  
      >>> class DPModel(RenameParamsMixin, nn.Module):
      ...    def __init__(self, hidden_size):
      ...        super().__init__()
      ...        self.w = nn.Parameter(torch.zeros(hidden_size, requires_grad=True))
      ...        self.set_rename_map({"w": "weights"})
      ...
      >>> model = DPModel(5)
      >>> model.state_dict()
      {'weights': tensor([0., 0., 0., 0., 0.])}
docstr: Internal function. This function simply registers parameters under their new name. They will
  automatically mask their duplicates coming from submodules. This trick works because
  self.parameters() proceeds recursively from the top, going into submodules after processing
  items at the current level, and will not return duplicates.
docstr_tok: ["Internal","function",".","This","function","simply","registers","parameters","under","their","new","name",".","They","will","automatically","mask","their","duplicates","coming","from","submodules",".","This","trick","works","because","self.parameters","(",")","proceeds","recursively","from","the","top",",","going","into","submodules","after","processing","items","at","the","current","level",",","and","will","not","return","duplicates","."]
code: def _register_renamed_parameters(self):
      """
      Internal function. This function simply registers parameters under their new name. They will
      automatically mask their duplicates coming from submodules. This trick works because
      self.parameters() proceeds recursively from the top, going into submodules after processing
      items at the current level, and will not return duplicates.
      """
      for old_name, param in super().named_parameters():
          if old_name in self.old_to_new:
              new_name = self.old_to_new[old_name]
              self.register_parameter(new_name, param)
  
file_path: opacus/opacus/layers/param_rename.py
imports: from typing import Dict, Union
  import torch.nn
  from torch import Tensor
  from torch.nn.modules.module import _IncompatibleKeys
label_desc: Use image node_id 2 for calling the RenameParamsMixin obj's underlying member method code with example usage: obj._register_renamed_parameters() without return types