examples/research_projects/vqgan-clip/VQGAN_CLIP.py/VQGAN_CLIP/_get_latent
class VQGAN_CLIP:    def _get_latent(self, path=None, img=None):
        if not (path or img):
            raise ValueError("Input either path or tensor")
        if img is not None:
            raise NotImplementedError
        x = preprocess(Image.open(path), target_image_size=256).to(self.device)
        x_processed = preprocess_vqgan(x)
        z, *_ = self.vqgan.encode(x_processed)
        return z