<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/components/utils/cosine_similarity.py#L39-L68) |

Utility function to compute cosine similarity between two embedding.

    mp.tasks.components.utils.cosine_similarity.cosine_similarity(
        u: https://developers.google.com/edge/api/mediapipe/python/mp/tasks/components/containers/Embedding,
        v: https://developers.google.com/edge/api/mediapipe/python/mp/tasks/components/containers/Embedding
    ) -> float

May return an InvalidArgumentError if e.g. the feature vectors are of
different types (quantized vs. float), have different sizes, or have an
L2-norm of 0.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `u` | An embedding. |
| `v` | An embedding. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Cosine similarity value. ||

<br />