base_autograd.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:pyannote-audio 作者: pyannote 项目源码 文件源码
def angular(embedding, other_embedding=None):
        """Compute angular distance

        Parameters
        ----------
        embedding : (n_samples, n_dimension) numpy array
        other_embedding : (n_other_samples, n_dimension, ) numpy array, optional
            L2-normalized embeddings

        Returns
        -------
        distance : (n_samples, n_other_samples) numpy array or float
            Angular distance
        """

        n_samples, _ = embedding.shape

        if other_embedding is None:
            other_embedding = embedding

        return arccos(ag_np.stack(
            ag_np.sum(embedding[i] * other_embedding, axis=1)
            for i in range(n_samples)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号