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","."]
code: def _convert_dense_features(
      batch: BatchData,
      feature_dimension: int,
      idx: int,
      number_of_dimensions: int,
  ) -> Tuple[tf.Tensor, int]:
      batch_at_idx = batch[idx]
      if isinstance(batch_at_idx, tf.Tensor):
          # explicitly substitute last dimension in shape with known
          # static value
          if number_of_dimensions > 1 and (
              batch_at_idx.shape is None
              or batch_at_idx.shape[-1] is None
          ):
              shape: List[Optional[int]] = [None] * (
                  number_of_dimensions - 1
              )
              shape.append(feature_dimension)
              batch_at_idx.set_shape(shape)
  
          return batch_at_idx, idx + 1
  
      # convert to Tensor
      return (
          tf.constant(
              batch[idx], dtype=tf.float32, shape=batch[idx].shape
          ),
          idx + 1,
      )
  
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 18 for calling the RasaModel obj's underlying member method code with example usage: obj._convert_dense_features(batch, feature_dimension, idx, number_of_dimensions) and returns: tf,  unknown, batch_at_idx,  unknown