class_docstr: Abstract custom Keras model.
  
   This model overwrites the following methods:
  - train_step
  - test_step
  - predict_step
  - save
  - load
  Cannot be used as tf.keras.Model.
class_docstr_tok: ["Abstract","custom","Keras","model",".","This","model","overwrites","the","following","methods",":","-","train_step","-","test_step","-","predict_step","-","save","-","load","Can","not","be","used","as","tf.keras.Model","."]
docstr: Merges a batch's output into the output for all batches.
  
  Function assumes that the schema of batch output remains the same,
  i.e. keys and their value types do not change from one batch's
  output to another.
  
  Args:
      all_outputs: Existing output for all previous batches.
      batch_output: Output for a batch.
  
  Returns:
      Merged output with the output for current batch stacked
      below the output for all previous batches.
docstr_tok: ["Merges","a","batch","'s","output","into","the","output","for","all","batches",".","Function","assumes","that","the","schema","of","batch","output","remains","the","same",",","i.e",".","keys","and","their","value","types","do","not","change","from","one","batch's","output","to","another",".","Args",":","all_outputs",":","Existing","output","for","all","previous","batches",".","batch_output",":","Output","for","a","batch",".","Returns",":","Merged","output","with","the","output","for","current","batch","stacked","below","the","output","for","all","previous","batches","."]
code: def _merge_batch_outputs(
      all_outputs: Dict[Text, Union[np.ndarray, Dict[Text, Any]]],
      batch_output: Dict[
          Text, Union[np.ndarray, Dict[Text, np.ndarray]]
      ],
  ) -> Dict[Text, Union[np.ndarray, Dict[Text, Any]]]:
      """Merges a batch's output into the output for all batches.
  
      Function assumes that the schema of batch output remains the same,
      i.e. keys and their value types do not change from one batch's
      output to another.
  
      Args:
          all_outputs: Existing output for all previous batches.
          batch_output: Output for a batch.
  
      Returns:
          Merged output with the output for current batch stacked
          below the output for all previous batches.
      """
      if not all_outputs:
          return batch_output
      for key, val in batch_output.items():
          if isinstance(val, np.ndarray):
              all_outputs[key] = np.concatenate(
                  [all_outputs[key], batch_output[key]], axis=0
              )
  
          elif isinstance(val, dict):
              # recurse and merge the inner dict first
              all_outputs[key] = RasaModel._merge_batch_outputs(
                  all_outputs[key], val
              )
  
      return all_outputs
  
imports: import time
  import random
  import tensorflow
  import numpy
  import logging
  import os
  from collections import defaultdict
  from typing import List, Text, Dict, Tuple, Union, Optional, Any, TYPE_CHECKING
  from keras.utils import tf_utils
  from keras import Model
  from rasa.shared.constants import DIAGNOSTIC_DATA
  from rasa.utils.tensorflow.constants import LABEL, IDS, INTENT_CLASSIFICATION, SENTENCE, SEQUENCE_LENGTH, RANDOM_SEED, EMBEDDING_DIMENSION, REGULARIZATION_CONSTANT, SIMILARITY_TYPE, CONNECTION_DENSITY, NUM_NEG, LOSS_TYPE, MAX_POS_SIM, MAX_NEG_SIM, USE_MAX_NEG_SIM, NEGATIVE_MARGIN_SCALE, SCALE_LOSS, LEARNING_RATE, CONSTRAIN_SIMILARITIES, MODEL_CONFIDENCE, RUN_EAGERLY
  from rasa.utils.tensorflow.model_data import RasaModelData, FeatureSignature, FeatureArray
  import rasa.utils.train_utils
  from rasa.utils.tensorflow import layers
  from rasa.utils.tensorflow import rasa_layers
  from rasa.utils.tensorflow.data_generator import RasaDataGenerator, RasaBatchDataGenerator
  from rasa.shared.nlu.constants import TEXT
  from rasa.shared.exceptions import RasaException
  from rasa.utils.tensorflow.types import BatchData, MaybeNestedBatchData
label_desc: Use image node_id 12 for calling the RasaModel obj's underlying member method code with example usage: obj._merge_batch_outputs(all_outputs, batch_output) and returns: all_outputs, batch_output