code: def ravel_pytree(pytree):
      """Ravel (flatten) a pytree of arrays down to a 1D array.
  
      Args:
        pytree: a pytree of arrays and scalars to ravel.
  
      Returns:
        A pair where the first element is a 1D array representing the flattened and
        concatenated leaf values, with dtype determined by promoting the dtypes of
        leaf values, and the second element is a callable for unflattening a 1D
        vector of the same length back to a pytree of the same structure as the
        input ``pytree``. If the input pytree is empty (i.e. has no leaves) then as
        a convention a 1D empty array of dtype float32 is returned in the first
        component of the output.
  
      For details on dtype promotion, see
      https://jax.readthedocs.io/en/latest/type_promotion.html.
  
      """
      leaves, treedef = tree_flatten(pytree)
      flat, unravel_list = _ravel_list(leaves)
      return flat, HashablePartial(
          unravel_pytree, treedef, unravel_list
      )
  
file_path: jax/jax/_src/flatten_util.py
imports: import warnings
  import numpy
  from jax import lax
  import jax.numpy
  from jax._src import dtypes
  from jax._src.tree_util import tree_flatten, tree_unflatten
  from jax._src.util import safe_zip, unzip2, HashablePartial
label_desc: Use image node_id 1 for calling a global function with example usage: ravel_pytree(pytree) and returns: flat,  HashablePartial