code: def NestFlatten() -> (
      tf.keras.layers.Layer
  ):  # pylint: disable=invalid-name
      """Returns a Keras layer that takes a nest of inputs, and returns a list.
  
      Useful in combination with `NestMap` to combine processed inputs:
  
      ```python
      # Process inputs in dictionary {"inp1": ..., "inp2": ...}, then
      # flatten the resulting tensors into a list, and finally pass this
      # list to tf.keras.layers.Add() to sum the values element-wise.
      net = tf_agents.networks.Sequence([
        NestMap({"inp1": layer1, "inp2": layer2}),
        NestFlatten(),
        tf.keras.layers.Add(),
      ])
      combined_outputs, next_state = net({"inp1": inp1, "inp2": inp2}, state)
      ```
      """
      return tf.keras.layers.Lambda(tf.nest.flatten)
  
file_path: agents/tf_agents/networks/nest_map.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import typing
  import tensorflow.compat.v2
  from tf_agents.networks import network
  from tf_agents.networks import sequential
  from tf_agents.typing import types
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 for calling a global function with example usage: NestFlatten() and returns: tf