def _count_intra_class_distances(embeddings: Tensor, mean_vectors: Tensor) -> Tensor:
        """
        Count matrix of distances from mean vector of each class to it's
        samples embeddings.

        Args:
            embeddings: tensor of shape (p, k, embed_dim) where p is a number
                of classes in the batch, k is a number of samples for each
                class
            mean_vectors: tensor of shape (p, embed_dim) -- mean vectors
                of each class in the batch

        Returns:
            tensor of shape (p, k) -- matrix of distances from mean vectors to
                related samples in the batch
        """
        p, k, embed_dim = embeddings.shape
        # Create (p, k, embed_dim) tensor of mean vectors for each class
        mean_vectors = mean_vectors.unsqueeze(1).repeat((1, k, 1))
        # Count euclidean distance between embeddings and mean vectors
        distances = torch.pow(embeddings - mean_vectors, 2).sum(2)
        return distances

        Count matrix of distances from mean vector of each class to it's
        samples embeddings.

        Args:
            embeddings: tensor of shape (p, k, embed_dim) where p is a number
                of classes in the batch, k is a number of samples for each
                class
            mean_vectors: tensor of shape (p, embed_dim) -- mean vectors
                of each class in the batch

        Returns:
            tensor of shape (p, k) -- matrix of distances from mean vectors to
                related samples in the batch
        
catalyst/contrib/data/sampler_inbatch.py