code: def test_label_embedding_collection(
      self, trained_policy: UnexpecTEDIntentPolicy
  ):
      label_ids = tf.constant(
          [[[2], [-1]], [[1], [2]], [[0], [-1]]], dtype=tf.int32
      )
  
      all_label_embeddings = np.random.random((10, 20))
  
      # `-1` is used as padding label id. The embedding for it
      # will be the same as `label_id=0`
      expected_extracted_label_embeddings = tf.constant(
          np.concatenate(
              [
                  all_label_embeddings[2],
                  all_label_embeddings[0],
                  all_label_embeddings[1],
                  all_label_embeddings[2],
                  all_label_embeddings[0],
                  all_label_embeddings[0],
              ]
          ).reshape((3, 2, 20)),
          dtype=tf.float32,
      )
  
      actual_extracted_label_embeddings = (
          trained_policy.model._get_labels_embed(
              label_ids,
              tf.constant(all_label_embeddings, dtype=tf.float32),
          )
      )
  
      assert np.all(
          expected_extracted_label_embeddings
          == actual_extracted_label_embeddings
      )
  
imports: import json
  from pathlib import Path
  from typing import Optional, List, Dict, Type
  import tensorflow
  import numpy
  import pytest
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.logging import LogCaptureFixture
  import logging
  from rasa.core.featurizers.single_state_featurizer import IntentTokenizerSingleStateFeaturizer
  from rasa.core.featurizers.tracker_featurizers import TrackerFeaturizer
  from rasa.core.featurizers.tracker_featurizers import IntentMaxHistoryTrackerFeaturizer
  from rasa.nlu.classifiers import LABEL_RANKING_LENGTH
  from rasa.shared.constants import LATEST_TRAINING_DATA_FORMAT_VERSION
  from rasa.shared.core.generator import TrackerWithCachedStates
  from rasa.core.policies.ted_policy import PREDICTION_FEATURES
  from rasa.core.policies.unexpected_intent_policy import UnexpecTEDIntentPolicy, RankingCandidateMetadata
  from rasa.engine.graph import ExecutionContext
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.shared.core.constants import ACTION_UNLIKELY_INTENT_NAME, ACTION_LISTEN_NAME
  from rasa.shared.core.domain import Domain
  from rasa.shared.core.events import ActionExecuted, UserUttered, EntitiesAdded, SlotSet, ActionExecutionRejected, ActiveLoop
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.utils.tensorflow.constants import IGNORE_INTENTS_LIST, LABEL, MASK, SENTENCE, IDS, POSITIVE_SCORES_KEY, NEGATIVE_SCORES_KEY, RANKING_KEY, RANKING_LENGTH
  from rasa.shared.nlu.constants import INTENT
  from rasa.shared.core.events import Event
  from rasa.utils.tensorflow import model_data_utils
  from tests.core.test_policies import train_trackers
  from tests.core.policies.test_ted_policy import TestTEDPolicy
label_desc: Use image node_id 20 for calling the TestUnexpecTEDIntentPolicy obj's underlying member method code with example usage: obj.test_label_embedding_collection(trained_policy) without return types