class_docstr: Metaclass for `Module`.
class_docstr_tok: ["Metaclass","for","`","Module","`","."]
code: def __call__(
      cls, *args, **kwargs
  ) -> Any:  # pylint: disable=no-self-argument
      # Call new such that we have an un-initialized module instance that we can
      # still reference even if there is an exception during __init__. This is
      # needed such that we can make sure the name_scope constructed in __init__
      # is closed even if there is an exception.
  
      # NOTE: We disable pytype since (somewhat surprisingly) this method is bound
      # with the new class and not the metaclass.
      module = cls.__new__(
          cls, *args, **kwargs
      )  # pytype: disable=wrong-arg-types
  
      # Now attempt to initialize the object.
      init = wrap_method("__init__", cls.__init__, lambda: cls)
      init(module, *args, **kwargs)
  
      if config.get_config().module_auto_repr and getattr(
          module, "AUTO_REPR", True
      ):
          module._auto_repr = utils.auto_repr(
              cls, *args, **kwargs
          )  # pylint: disable=protected-access
      else:
          module._auto_repr = object.__repr__(module)
  
      ran_super_ctor = hasattr(module, "module_name")
      if not ran_super_ctor:
          raise ValueError(
              "Constructing an hk.Module without calling the super constructor "
              "is not supported. Add the following as the first line in your "
              "__init__ method:\n\nsuper(%s, self).__init__()"
              % cls.__name__
          )
  
      return module
  
imports: from collections.abc import Mapping
  import contextlib
  import functools
  import inspect
  import re
  from typing import Any, Callable, ContextManager, NamedTuple, Optional, Protocol, TypeVar
  from haiku._src import base
  from haiku._src import config
  from haiku._src import data_structures
  from haiku._src import utils
  import jax
  import jax.numpy
label_desc: Use image node_id 2 for calling the ModuleMetaclass obj's underlying member method code with example usage: obj.__call__(cls) and returns: module