code: def test_sequence_layer_correct_output(
      attribute_signature: Dict[Text, List[FeatureSignature]],
      inputs: List[
          Union[tf.Tensor, List[Union[tf.SparseTensor, tf.Tensor]]]
      ],
      expected_outputs_train: List[np.ndarray],
  ) -> None:
      layer = RasaSequenceLayer(
          attribute=attribute_name,
          # Use MLM but no transformer and no hidden layers.
          config=dict(
              model_config_basic_no_hidden_layers, **{MASKED_LM: True}
          ),
          attribute_signature=attribute_signature,
      )
  
      # Training-time check
      (
          seq_sent_features_expected,
          mask_seq_sent_expected,
          token_ids_expected,
      ) = expected_outputs_train
      (
          _,
          seq_sent_features,
          mask_seq_sent,
          token_ids,
          mlm_boolean_mask,
          _,
      ) = layer(inputs, training=True)
      assert (
          seq_sent_features.numpy() == seq_sent_features_expected
      ).all()
      assert (mask_seq_sent.numpy() == mask_seq_sent_expected).all()
      assert (token_ids.numpy() == token_ids_expected).all()
      assert mlm_boolean_mask.dtype == bool
      # no masking at the padded position found in the shorter sequence
      assert not mlm_boolean_mask[-1][-1][0]
      # when sentence-level features are present, also ensure that no masking is done at
      # sentence-level feature positions (determined by sequence lengths)
      if len(attribute_signature[SENTENCE]) > 0:
          assert not mlm_boolean_mask.numpy()[0][
              realistic_sequence_lengths.numpy()
          ][0]
  
      # Test-time check
      (
          seq_sent_features_expected,
          mask_seq_sent_expected,
          _,
      ) = expected_outputs_train
      (
          transformer_outputs,
          seq_sent_features,
          mask_seq_sent,
          token_ids,
          mlm_boolean_mask,
          _,
      ) = layer(inputs, training=False)
      # Check that transformer outputs match the combined features, i.e. that MLM wasn't
      # applied
      assert (
          transformer_outputs.numpy() == seq_sent_features_expected
      ).all()
      assert (
          seq_sent_features.numpy() == seq_sent_features_expected
      ).all()
      assert (mask_seq_sent.numpy() == mask_seq_sent_expected).all()
      assert token_ids.numpy().size == 0
      assert mlm_boolean_mask.numpy().size == 0
  
imports: import pytest
  import tensorflow
  import numpy
  from typing import Text, Union, Any, Dict, List, Type
  from rasa.shared.nlu.constants import TEXT, FEATURE_TYPE_SENTENCE, FEATURE_TYPE_SEQUENCE
  from rasa.utils.tensorflow import layers
  from rasa.utils.tensorflow.rasa_layers import ConcatenateSparseDenseFeatures, RasaFeatureCombiningLayer, RasaSequenceLayer, RasaCustomLayer
  from rasa.utils.tensorflow.constants import DENSE_INPUT_DROPOUT, SPARSE_INPUT_DROPOUT, DROP_RATE, DENSE_DIMENSION, REGULARIZATION_CONSTANT, CONCAT_DIMENSION, CONNECTION_DENSITY, DROP_RATE_ATTENTION, KEY_RELATIVE_ATTENTION, VALUE_RELATIVE_ATTENTION, MAX_RELATIVE_POSITION, UNIDIRECTIONAL_ENCODER, HIDDEN_LAYERS_SIZES, NUM_TRANSFORMER_LAYERS, TRANSFORMER_SIZE, NUM_HEADS, SENTENCE, SEQUENCE, MASKED_LM, LABEL
  from rasa.utils.tensorflow.exceptions import TFLayerConfigException
  from rasa.utils.tensorflow.model_data import FeatureSignature
label_desc: Use image node_id 9 for calling a global function with example usage: test_sequence_layer_correct_output(attribute_signature, inputs, expected_outputs_train) without return types