test/python/testann.py
def normalize(self, embeddings):
        """
        Normalizes embeddings using L2 normalization. Operation applied directly on array.

        Args:
            embeddings: input embeddings matrix
        """

        # Calculation is different for matrices vs vectors
        if len(embeddings.shape) > 1:
            embeddings /= np.linalg.norm(embeddings, axis=1)[:, np.newaxis]
        else:
            embeddings /= np.linalg.norm(embeddings)

        Normalizes embeddings using L2 normalization. Operation applied directly on array.

        Args:
            embeddings: input embeddings matrix
        
Normalizes embeddings using L2 normalization. Operation applied directly on array.
Normalizes embeddings using L2 normalization . Operation applied directly on array .
def normalize(self, embeddings):
        if len(embeddings.shape) > 1:
            embeddings /= np.linalg.norm(embeddings, axis=1)[:, np.newaxis]
        else:
            embeddings /= np.linalg.norm(embeddings)
def normalize ( self , embeddings ) : if len ( embeddings . shape ) > 1 : embeddings /= np . linalg . norm ( embeddings , axis = 1 ) [ : , np . newaxis ] else : embeddings /= np . linalg . norm ( embeddings )
Normalizes embeddings using L2 normalization.
Normalizes embeddings using L2 normalization .
"""
        Normalizes embeddings using L2 normalization. Operation applied directly on array.

        Args:
            embeddings: input embeddings matrix
        """ # Calculation is different for matrices vs vectors
self
embeddings
input embeddings matrix
input embeddings matrix