code: def test_dot_product_loss_get_similarities_and_confidences_from_embeddings(
      model_confidence: Text,
      mock_similarities: List,
      expected_confidences: List,
      monkeypatch: MonkeyPatch,
  ):
      def mock_sim(*args, **kwargs) -> tf.Tensor:
          return tf.constant(mock_similarities)
  
      monkeypatch.setattr(DotProductLoss, "sim", mock_sim)
  
      similarities, confidences = DotProductLoss(
          1, model_confidence=model_confidence
      ).get_similarities_and_confidences_from_embeddings(
          # Inputs are not used due to mocking of `sim`
          tf.zeros([1]),
          tf.zeros([1]),
          tf.zeros([1]),
      )
      assert np.all(similarities == mock_similarities)
      assert np.all(confidences == expected_confidences)
  
imports: from typing import Text, List, Tuple, Union, Optional
  import pytest
  from _pytest.monkeypatch import MonkeyPatch
  import numpy
  import tensorflow
  from rasa.utils.tensorflow.layers import DotProductLoss, MultiLabelDotProductLoss, RandomlyConnectedDense, DenseForSparse
  from rasa.utils.tensorflow.constants import INNER, SOFTMAX, LABEL, LABEL_PAD_ID
  import rasa.utils.tensorflow.layers_utils
  from rasa.shared.nlu.constants import TEXT, INTENT, ACTION_NAME, ACTION_TEXT, FEATURE_TYPE_SENTENCE, FEATURE_TYPE_SEQUENCE
  from rasa.core.constants import DIALOGUE
label_desc: Use image node_id 9 for calling a global function with example usage: test_dot_product_loss_get_similarities_and_confidences_from_embeddings(model_confidence, mock_similarities, expected_confidences, monkeypatch) and returns: tf