code: def unpad_with_graphs(
      padded_graph: gn_graph.GraphsTuple,
  ) -> gn_graph.GraphsTuple:
      """Unpads the given graph by removing the dummy graph and empty graphs.
  
      This function assumes that the given graph was padded with the
      ``pad_with_graphs`` function.
  
      This function does not support jax.jit, because the shape of the output
      is data-dependent!
  
      Args:
        padded_graph: ``GraphsTuple`` padded with a dummy graph and empty graphs.
  
      Returns:
        The unpadded graph.
      """
      n_padding_graph = get_number_of_padding_with_graphs_graphs(
          padded_graph
      )
      n_padding_node = get_number_of_padding_with_graphs_nodes(
          padded_graph
      )
      n_padding_edge = get_number_of_padding_with_graphs_edges(
          padded_graph
      )
  
      def remove_edge_padding(edge_array):
          if n_padding_edge == 0:
              return edge_array
          return edge_array[:-n_padding_edge]
  
      unpadded_graph = gn_graph.GraphsTuple(
          n_node=padded_graph.n_node[:-n_padding_graph],
          n_edge=padded_graph.n_edge[:-n_padding_graph],
          nodes=tree.tree_map(
              lambda x: x[:-n_padding_node], padded_graph.nodes
          ),
          edges=tree.tree_map(remove_edge_padding, padded_graph.edges),
          globals=tree.tree_map(
              lambda x: x[:-n_padding_graph], padded_graph.globals
          ),
          senders=remove_edge_padding(padded_graph.senders),
          receivers=remove_edge_padding(padded_graph.receivers),
      )
      return unpadded_graph
  
imports: import functools
  from typing import Any, Callable, Generator, Iterable, Iterator, List, Mapping, Optional, Sequence, Union
  import jax
  from jax import lax
  import jax.numpy
  import jax.tree_util
  from jraph._src import graph
  import numpy
label_desc: Use image node_id 22 for calling a global function with example usage: unpad_with_graphs(padded_graph) and returns: unpadded_graph, edge_array, edge_array