code: def with_empty_state(f: Transformed) -> TransformedWithState:
      """Wraps a transformed tuple and passes empty state in/out.
  
      The example below is equivalent to ``f = hk.transform_with_state(f)``:
  
      >>> def f(x):
      ...   mod = hk.Linear(10)
      ...   return mod(x)
      >>> f = hk.with_empty_state(hk.transform(f))
      >>> rng = jax.random.PRNGKey(42)
      >>> x = jnp.zeros([1, 1])
      >>> params, state = f.init(rng, x)
      >>> state
      {}
      >>> out, state = f.apply(params, state, rng, x)
      >>> print(out)
      [[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]
      >>> state
      {}
  
      Args:
        f: A transformed function.
  
      Returns:
        A transformed function that does accepts and returns state.
      """
  
      def init_fn(
          *args, **kwargs
      ) -> tuple[hk.MutableParams, hk.MutableState]:
          params = f.init(*args, **kwargs)
          state = data_structures.to_haiku_dict({})
          return params, state
  
      init_fn.__signature__ = sig_add_state(inspect.signature(f.init))
  
      def apply_fn(
          params: hk.Params, state: Optional[hk.State], *args, **kwargs
      ) -> tuple[Any, hk.MutableState]:
          del state
          out = f.apply(params, *args, **kwargs)
          state = data_structures.to_haiku_dict({})
          return out, state
  
      apply_fn.__signature__ = sig_add_state(
          sig_replace_leading_parameters(
              inspect.signature(f.apply),
              1,
              [
                  inspect.Parameter(
                      "param",
                      inspect.Parameter.POSITIONAL_OR_KEYWORD,
                      annotation=hk.Params,
                  ),
                  inspect.Parameter(
                      "state",
                      inspect.Parameter.POSITIONAL_OR_KEYWORD,
                      annotation=hk.Params,
                  ),
              ],
          )
      )
  
      tie_in_original_fn(f, init_fn, apply_fn)
  
      return TransformedWithState(init=init_fn, apply=apply_fn)
  
imports: from collections.abc import Mapping
  import inspect
  from typing import Any, Callable, NamedTuple, Optional, TypeVar, Union
  from haiku._src import analytics
  from haiku._src import base
  from haiku._src import data_structures
  from haiku._src import typing
  import jax
label_desc: Use image node_id 6 for calling a global function with example usage: with_empty_state(f) and returns: TransformedWithState, params,  state, out,  state