code: def to_module(f: Callable[..., Any]) -> type[CallableModule]:
      """Converts a function into a callable module class.
  
      Sample usage:
  
      >>> def bias_fn(x):
      ...   b = hk.get_parameter("b", [], init=hk.initializers.RandomNormal())
      ...   return x + b
      >>> Bias = hk.to_module(bias_fn)
      >>> def net(x, y):
      ...   b = Bias(name="my_bias")
      ...   # Bias x and y by the same amount.
      ...   return b(x) * b(y)
  
      Args:
        f: The function to convert.
  
      Returns:
        A module class which runs ``f`` when called.
      """
  
      class ToModuleWrapper(CallableModule):
          """Module produced by `hk.to_module`."""
  
          def __init__(self, name=None):
              if name is None:
                  name = f.__name__
              elif not isinstance(name, str):
                  raise TypeError(
                      "Expected a string name as the first argument to the "
                      f"module constructor, got: {name}. Note that "
                      "`hk.to_module` returns a class not an object, so to "
                      "use your module you need to instantiate it first: "
                      "`cls = hk.to_module(fn); mod = cls(); out = mod(x)`."
                  )
  
              super().__init__(name=name)
  
          def __call__(self, *a, **k):
              return f(*a, **k)
  
      if hasattr(f, "__doc__") and f.__doc__:
          ToModuleWrapper.__doc__ = f.__doc__
      functools.update_wrapper(ToModuleWrapper.__call__, f)
  
      return ToModuleWrapper
  
imports: from collections.abc import Iterable, Sequence
  import functools
  from typing import Any, Callable, Optional
  from haiku._src import base
  from haiku._src import initializers
  from haiku._src import module
  from haiku._src import typing
  from haiku._src.typing import PRNGKey
  import jax
  from jax import lax
  import jax.numpy
  import numpy
label_desc: Use image node_id 10 for calling a global function with example usage: to_module(f) and returns: ToModuleWrapper, f