docstr: Find all internal variables in obj. Return empty Container if obj is
  None.
  
  Parameters
  ----------
  obj
      The submodule whose internal variables are to be returned. Default
      is None.
  without_initialization
      Whether or not to initialize the variables, to avoid initialization when
      the model variables are passed in the input directly.
  _visited
      Placeholder for tracking the visited nodes, do not set this parameter.
  
  Returns
  -------
  ret
      The internal variables of the submodule passed in the argument.
docstr_tok: ["Find","all","internal","variables","in","obj",".","Return","empty","Container","if","obj","is","None",".","Parameters","--","--","--","--","--","obj","The","submodule","whose","internal","variables","are","to","be","returned",".","Default","is","None",".","without_initialization","Whether","or","not","to","initialize","the","variables",",","to","avoid","initialization","when","the","model","variables","are","passed","in","the","input","directly",".","_visited","Placeholder","for","tracking","the","visited","nodes",",","do","not","set","this","parameter",".","Returns","--","--","--","-","ret","The","internal","variables","of","the","submodule","passed","in","the","argument","."]
code: def _find_variables(
      self,
      /,
      *,
      obj=None,
      without_initialisation=False,
      _visited=None,
  ):
      """Find all internal variables in obj. Return empty Container if obj is
      None.
  
      Parameters
      ----------
      obj
          The submodule whose internal variables are to be returned. Default
          is None.
      without_initialization
          Whether or not to initialize the variables, to avoid initialization when
          the model variables are passed in the input directly.
      _visited
          Placeholder for tracking the visited nodes, do not set this parameter.
  
      Returns
      -------
      ret
          The internal variables of the submodule passed in the argument.
      """
      _visited = ivy.default(_visited, {})
      vs = Container()
      if id(obj) in _visited:
          return vs
      _visited[id(obj)] = True
      # ToDo: add support for finding local variables, if/when JAX supports
      #  uniquely flagging variables
      if isinstance(obj, ModuleHelpers) and obj is not self:
          if not obj.built and without_initialisation:
              return lambda: obj._build_and_return_v(
                  *obj._args,
                  dynamic_backend=self._dynamic_backend,
                  **obj._kwargs,
              )
  
          return obj._build_and_return_v(
              *obj._args,
              dynamic_backend=obj._dynamic_backend,
              **obj._kwargs,
          )
      elif isinstance(obj, (list, tuple)):
          for i, v in enumerate(obj):
              ret = self._find_variables(
                  obj=v,
                  without_initialisation=without_initialisation,
                  _visited=_visited,
              )
              if ret:
                  vs[f"v{str(i)}"] = ret
          return vs
      elif isinstance(obj, dict):
          for k, v in obj.items():
              ret = self._find_variables(
                  obj=v,
                  without_initialisation=without_initialisation,
                  _visited=_visited,
              )
              if ret:
                  vs[k[1:] if k[0] == "_" else k] = ret
          return vs
      elif not hasattr(obj, "__dict__"):
          return vs
      for k, v in obj.__dict__.items():
          if v is not None and k[0:2] != "__" and k != "_module_dict":
              ret = self._find_variables(
                  obj=v,
                  without_initialisation=without_initialisation,
                  _visited=_visited,
              )
              if ret:
                  vs[k[1:] if k[0] == "_" else k] = ret
      return vs
  
file_path: ivy/ivy/stateful/helpers.py
imports: import functools
  import logging
  import ivy
  from ivy.data_classes.container import Container
  from ivy.func_wrapper import _get_first_array
label_desc: Use image node_id 1 for calling the ModuleHelpers obj's underlying member method code with example usage: obj._find_variables() and returns: vs, vs, obj, function, vs, vs, vs