class_docstr: A featurizer that uses transformer-based language models.
  
  This component loads a pre-trained language model
  from the Transformers library (https://github.com/huggingface/transformers)
  including BERT, GPT, GPT-2, xlnet, distilbert, and roberta.
  It also tokenizes and featurizes the featurizable dense attributes of
  each message.
class_docstr_tok: ["A","featurizer","that","uses","transformer-based","language","models",".","This","component","loads","a","pre-trained","language","model","from","the","Transformers","library","(","https",":","\/\/github.com\/huggingface\/transformers",")","including","BERT",",","GPT",",","GPT-2",",","xlnet",",","distilbert",",","and","roberta",".","It","also","tokenizes","and","featurizes","the","featurizable","dense","attributes","of","each","message","."]
docstr: Adds extra zero padding to match the original sequence length.
  
  This is only done if the input was truncated during the batch
  preparation of input for the model.
  
  Args:
      sequence_embeddings: Embeddings returned from the model
      actual_sequence_lengths: original sequence length of all inputs
  
  Returns:
      Modified sequence embeddings with padding if necessary
docstr_tok: ["Adds","extra","zero","padding","to","match","the","original","sequence","length",".","This","is","only","done","if","the","input","was","truncated","during","the","batch","preparation","of","input","for","the","model",".","Args",":","sequence_embeddings",":","Embeddings","returned","from","the","model","actual_sequence_lengths",":","original","sequence","length","of","all","inputs","Returns",":","Modified","sequence","embeddings","with","padding","if","necessary"]
code: def _add_extra_padding(
      self,
      sequence_embeddings: np.ndarray,
      actual_sequence_lengths: List[int],
  ) -> np.ndarray:
      """Adds extra zero padding to match the original sequence length.
  
      This is only done if the input was truncated during the batch
      preparation of input for the model.
  
      Args:
          sequence_embeddings: Embeddings returned from the model
          actual_sequence_lengths: original sequence length of all inputs
  
      Returns:
          Modified sequence embeddings with padding if necessary
      """
      if self.max_model_sequence_length == NO_LENGTH_RESTRICTION:
          # No extra padding needed because there wouldn't have been any
          # truncation in the first place
          return sequence_embeddings
  
      reshaped_sequence_embeddings = []
      for index, embedding in enumerate(sequence_embeddings):
          embedding_size = embedding.shape[-1]
          if (
              actual_sequence_lengths[index]
              > self.max_model_sequence_length
          ):
              embedding = np.concatenate(
                  [
                      embedding,
                      np.zeros(
                          (
                              actual_sequence_lengths[index]
                              - self.max_model_sequence_length,
                              embedding_size,
                          ),
                          dtype=np.float32,
                      ),
                  ]
              )
          reshaped_sequence_embeddings.append(embedding)
      return ragged_array_to_ndarray(reshaped_sequence_embeddings)
  
imports: from __future__ import annotations
  import numpy
  import logging
  from typing import Any, Text, List, Dict, Tuple, Type
  import tensorflow
  from rasa.engine.graph import ExecutionContext, GraphComponent
  from rasa.engine.recipes.default_recipe import DefaultV1Recipe
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.nlu.featurizers.dense_featurizer.dense_featurizer import DenseFeaturizer
  from rasa.nlu.tokenizers.tokenizer import Token, Tokenizer
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
  from rasa.nlu.constants import DENSE_FEATURIZABLE_ATTRIBUTES, SEQUENCE_FEATURES, SENTENCE_FEATURES, NO_LENGTH_RESTRICTION, NUMBER_OF_SUB_TOKENS, TOKENS_NAMES
  from rasa.shared.nlu.constants import TEXT, ACTION_TEXT
  from rasa.utils import train_utils
  from rasa.utils.tensorflow.model_data import ragged_array_to_ndarray
label_desc: Use image node_id 21 for calling the LanguageModelFeaturizer obj's underlying member method code with example usage: obj._add_extra_padding(sequence_embeddings, actual_sequence_lengths) and returns: ragged_array_to_ndarray, sequence_embeddings