code: def compute_mask(sequence_lengths: tf.Tensor) -> tf.Tensor:
      """Computes binary mask given real sequence lengths.
  
      Takes a 1-D tensor of shape `(batch_size,)` containing the lengths of sequences
      (in terms of number of tokens) in the batch. Creates a binary mask of shape
      `(batch_size, max_seq_length, 1)` with 1s at positions with real tokens and 0s
      elsewhere.
      """
      mask = tf.sequence_mask(sequence_lengths, dtype=tf.float32)
      return tf.expand_dims(mask, -1)
  
imports: import tensorflow
  import numpy
  from typing import Text, List, Dict, Any, Union, Optional, Tuple, Callable
  from rasa.shared.nlu.constants import TEXT
  from rasa.utils.tensorflow.model_data import FeatureSignature
  from rasa.utils.tensorflow.constants import REGULARIZATION_CONSTANT, CONNECTION_DENSITY, NUM_TRANSFORMER_LAYERS, TRANSFORMER_SIZE, NUM_HEADS, UNIDIRECTIONAL_ENCODER, KEY_RELATIVE_ATTENTION, VALUE_RELATIVE_ATTENTION, MAX_RELATIVE_POSITION, MASKED_LM, HIDDEN_LAYERS_SIZES, DROP_RATE, SPARSE_INPUT_DROPOUT, DENSE_INPUT_DROPOUT, DENSE_DIMENSION, CONCAT_DIMENSION, DROP_RATE_ATTENTION, SEQUENCE, SENTENCE
  from rasa.utils.tensorflow import layers
  from rasa.utils.tensorflow.exceptions import TFLayerConfigException
  from rasa.utils.tensorflow.transformer import TransformerEncoder
  from rasa.nlu.constants import DEFAULT_TRANSFORMER_SIZE
label_desc: Use image node_id 1 for calling a global function with example usage: compute_mask(sequence_lengths) and returns: tf