docstr: Updates `DenseForSparse` layers.
  
  Updates sizes of `DenseForSparse` layers by comparing current sparse feature
  sizes to old ones. This must be done before fine-tuning starts to account
  for any change in the size of sparse features that might have happened
  because of addition of new data.
  
  Args:
      new_sparse_feature_sizes: sizes of current sparse features.
      old_sparse_feature_sizes: sizes of sparse features the model was
                                previously trained on.
docstr_tok: ["Updates","`","DenseForSparse","`","layers",".","Updates","sizes","of","`","DenseForSparse","`","layers","by","comparing","current","sparse","feature","sizes","to","old","ones",".","This","must","be","done","before","fine-tuning","starts","to","account","for","any","change","in","the","size","of","sparse","features","that","might","have","happened","because","of","addition","of","new","data",".","Args",":","new_sparse_feature_sizes",":","sizes","of","current","sparse","features",".","old_sparse_feature_sizes",":","sizes","of","sparse","features","the","model","was","previously","trained","on","."]
code: def _update_dense_for_sparse_layers(
      self,
      new_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
      old_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
  ) -> None:
      """Updates `DenseForSparse` layers.
  
      Updates sizes of `DenseForSparse` layers by comparing current sparse feature
      sizes to old ones. This must be done before fine-tuning starts to account
      for any change in the size of sparse features that might have happened
      because of addition of new data.
  
      Args:
          new_sparse_feature_sizes: sizes of current sparse features.
          old_sparse_feature_sizes: sizes of sparse features the model was
                                    previously trained on.
      """
      for name, layer in self._tf_layers.items():
          # `if` condition is necessary because only `RasaCustomLayer`
          # can adjust sparse layers for incremental training by default.
          if isinstance(layer, rasa_layers.RasaCustomLayer):
              layer.adjust_sparse_layers_for_incremental_training(
                  new_sparse_feature_sizes,
                  old_sparse_feature_sizes,
                  self.config[REGULARIZATION_CONSTANT],
              )
  
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 5 for calling the TransformerRasaModel obj's underlying member method code with example usage: obj._update_dense_for_sparse_layers(new_sparse_feature_sizes, old_sparse_feature_sizes) without return types