class_docstr: A subclass of ``torch.nn.Module`` that wraps a C++ frontend module and delegates all access.
class_docstr_tok: ["A","subclass","of","``","torch.nn.Module","``","that","wraps","a","C++","frontend","module","and","delegates","all","access","."]
code: def __init__(self, cpp_module):
      # Assign before the super class constructor so ``self.training`` can be
      # assigned to in the super class constructor.
      self.cpp_module = cpp_module
      super().__init__()
      self._parameters = OrderedDictWrapper(cpp_module, "_parameters")  # type: ignore[assignment]
      self._buffers: OrderedDictWrapper = OrderedDictWrapper(cpp_module, "_buffers")  # type: ignore[assignment]
      self._modules: OrderedDictWrapper = OrderedDictWrapper(cpp_module, "_modules")  # type: ignore[assignment]
      for attr in dir(cpp_module):
          # Skip magic methods and the three attributes above.
          if not attr.startswith("_"):
              setattr(self, attr, getattr(self.cpp_module, attr))
  
file_path: pytorch/torch/nn/cpp.py
imports: from torch import nn
label_desc: Use image node_id 1 to create a new ModuleWrapper object from inherited base classes: nn with example: obj = ModuleWrapper(cpp_module)