code: def test_merging_batch_outputs(
      existing_outputs: Dict[
          Text, Union[np.ndarray, Dict[Text, np.ndarray]]
      ],
      new_batch_outputs: Dict[
          Text, Union[np.ndarray, Dict[Text, np.ndarray]]
      ],
      expected_output: Dict[
          Text, Union[np.ndarray, Dict[Text, np.ndarray]]
      ],
  ):
      predicted_output = RasaModel._merge_batch_outputs(
          existing_outputs, new_batch_outputs
      )
  
      def test_equal_dicts(
          dict1: Dict[Text, Union[np.ndarray, Dict[Text, np.ndarray]]],
          dict2: Dict[Text, Union[np.ndarray, Dict[Text, np.ndarray]]],
      ) -> None:
          assert dict2.keys() == dict1.keys()
          for key in dict1:
              val_1 = dict1[key]
              val_2 = dict2[key]
              assert type(val_1) == type(val_2)
  
              if isinstance(val_2, np.ndarray):
                  assert np.array_equal(val_1, val_2)
  
              elif isinstance(val_2, dict):
                  test_equal_dicts(val_1, val_2)
  
      test_equal_dicts(predicted_output, expected_output)
  
file_path: rasa/tests/utils/tensorflow/test_models.py
imports: import pytest
  from typing import Dict, Text, Union, Tuple, List
  import numpy
  import tensorflow
  from rasa.utils.tensorflow.models import RasaModel, TransformerRasaModel
  from rasa.utils.tensorflow.model_data import RasaModelData
  from rasa.utils.tensorflow.model_data import FeatureArray
  from rasa.utils.tensorflow.constants import LABEL, IDS, SENTENCE
  from rasa.shared.nlu.constants import TEXT, FEATURE_TYPE_SENTENCE, FEATURE_TYPE_SEQUENCE
label_desc: Use image node_id 1 for calling a global function with example usage: test_merging_batch_outputs(existing_outputs, new_batch_outputs, expected_output) without return types