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: Custom prediction method that builds tf graph on the first call.
  
  Args:
      batch_in: Prepared batch ready for input to `predict_step` method of model.
  
  Return:
      Prediction output, including diagnostic data.
docstr_tok: ["Custom","prediction","method","that","builds","tf","graph","on","the","first","call",".","Args",":","batch_in",":","Prepared","batch","ready","for","input","to","`","predict_step","`","method","of","model",".","Return",":","Prediction","output",",","including","diagnostic","data","."]
code: def _rasa_predict(
      self, batch_in: Tuple[np.ndarray, ...]
  ) -> Dict[Text, Union[np.ndarray, Dict[Text, Any]]]:
      """Custom prediction method that builds tf graph on the first call.
  
      Args:
          batch_in: Prepared batch ready for input to `predict_step` method of model.
  
      Return:
          Prediction output, including diagnostic data.
      """
      self._training = False
      if not self.prepared_for_prediction:
          # in case the model is used for prediction without loading, e.g. directly
          # after training, we need to prepare the model for prediction once
          self.prepare_for_predict()
          self.prepared_for_prediction = True
  
      if self._run_eagerly:
          # Once we take advantage of TF's distributed training, this is where
          # scheduled functions will be forced to execute and return actual values.
          outputs = tf_utils.sync_to_numpy_or_python_type(
              self.predict_step(batch_in)
          )
          if DIAGNOSTIC_DATA in outputs:
              outputs[
                  DIAGNOSTIC_DATA
              ] = self._empty_lists_to_none_in_dict(
                  outputs[DIAGNOSTIC_DATA]
              )
          return outputs
  
      if self._tf_predict_step is None:
          self._tf_predict_step = tf.function(
              self.predict_step,
              input_signature=self._dynamic_signature(batch_in),
          )
  
      # Once we take advantage of TF's distributed training, this is where
      # scheduled functions will be forced to execute and return actual values.
      outputs = tf_utils.sync_to_numpy_or_python_type(
          self._tf_predict_step(batch_in)
      )
      if DIAGNOSTIC_DATA in outputs:
          outputs[DIAGNOSTIC_DATA] = self._empty_lists_to_none_in_dict(
              outputs[DIAGNOSTIC_DATA]
          )
      return 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 10 for calling the RasaModel obj's underlying member method code with example usage: obj._rasa_predict(batch_in) and returns: outputs, outputs