parameters: (self, name: str, module: Optional['Module'])
docstring: r"""Adds a child module to the current module.
  
          The module can be accessed as an attribute using the given name.
  
          Args:
              name (string): name of the child module. The child module can be
                  accessed from this module using the given name
              module (Module): child module to be added to the module.
docstring_summary: r"""Adds a child module to the current module.
docstring_tokens: r Adds a child module to the current module .
function: def add_module(self, name: str, module: Optional['Module']) -> None:
          r"""Adds a child module to the current module.
  
          The module can be accessed as an attribute using the given name.
  
          Args:
              name (string): name of the child module. The child module can be
                  accessed from this module using the given name
              module (Module): child module to be added to the module.
          """
          if not isinstance(module, Module) and module is not None:
              raise TypeError("{} is not a Module subclass".format(
                  torch.typename(module)))
          elif not isinstance(name, torch._six.string_classes):
              raise TypeError("module name should be a string. Got {}".format(
                  torch.typename(name)))
          elif hasattr(self, name) and name not in self._modules:
              raise KeyError("attribute '{}' already exists".format(name))
          elif '.' in name:
              raise KeyError("module name can't contain \".\", got: {}".format(name))
          elif name == '':
              raise KeyError("module name can't be empty string \"\"")
          self._modules[name] = module
function_tokens: def add_module ( self , name : str , module : Optional [ 'Module' ] ) -> None : if not isinstance ( module , Module ) and module is not None : raise TypeError ( "{} is not a Module subclass" . format ( torch . typename ( module ) ) ) elif not isinstance ( name , torch . _six . string_classes ) : raise TypeError ( "module name should be a string. Got {}" . format ( torch . typename ( name ) ) ) elif hasattr ( self , name ) and name not in self . _modules : raise KeyError ( "attribute '{}' already exists" . format ( name ) ) elif '.' in name : raise KeyError ( "module name can't contain \".\", got: {}" . format ( name ) ) elif name == '' : raise KeyError ( "module name can't be empty string \"\"" ) self . _modules [ name ] = module