examples/research_projects/vqgan-clip/VQGAN_CLIP.py/VQGAN_CLIP/_get_clip_similarity
class VQGAN_CLIP:    def _get_clip_similarity(self, prompts, image, weights=None):
        clip_inputs = self.clip_preprocessor(text=prompts, images=image, return_tensors="pt", padding=True)
        clip_outputs = self.clip(**clip_inputs)
        similarity_logits = clip_outputs.logits_per_image
        if weights is not None:
            similarity_logits = similarity_logits * weights
        return similarity_logits.sum()