code: def without_state(f: MultiTransformedWithState) -> MultiTransformed:
      """Converts ``MultiTransformedWithState`` to ``MultiTransformed``."""
  
      def init_fn(rng, *args, **kwargs) -> hk.MutableParams:
          params, state = f.init(rng, *args, **kwargs)
          if state:
              raise ValueError(
                  "If your transformed function uses `hk.{get,set}_state` then use "
                  "`hk.multi_transform_with_state`."
              )
          return params
  
      def apply_without_state(orig_apply_fn):
          def apply_fn(params: hk.Params, rng, *args, **kwargs):
              out, state = orig_apply_fn(
                  params, None, rng, *args, **kwargs
              )
              if state:
                  raise ValueError(
                      "If your transformed function uses `hk.{get,set}_state` then use "
                      "`hk.multi_transform_with_state`."
                  )
              return out
  
          return apply_fn
  
      apply_fns = jax.tree_util.tree_map(apply_without_state, f.apply)
  
      return MultiTransformed(init_fn, apply_fns)
  
file_path: dm-haiku/haiku/_src/multi_transform.py
imports: import dataclasses
  import functools
  import inspect
  from typing import Any, Callable, NamedTuple, Optional, TypeVar
  from haiku._src import analytics
  from haiku._src import transform
  from haiku._src import typing
  import jax
label_desc: Use image node_id 3 for calling a global function with example usage: without_state(f) and returns: MultiTransformed, params, apply_fn, out