def encode_image(self, images: Union[str, ImageType, List[Union[str, ImageType, Tensor]], Tensor],
                     normalize=True, media_download_headers: Optional[Dict] = None) -> FloatTensor:
        """Encode the input image to a tensor representation.

        Args:
            images (Union[str, ImageType, List[Union[str, ImageType, Tensor]], Tensor]): input image,
            can be a str(url), a PIL image, or a tensor, or a list of them
            normalize (bool): whether to normalize the output tensor
            media_download_headers (Optional[Dict]): headers for the image download
        Return:
            FloatTensor: the encoded image tensor with shape (batch_size, embedding_dim)
        """
        self.image_input_processed: Tensor = self._preprocess_images(images, media_download_headers)
        with torch.no_grad():
            outputs = self.model.encode_image(self.image_input_processed)

        if normalize:
            _shape_before = outputs.shape
            outputs /= self.normalize(outputs)
            assert outputs.shape == _shape_before
        return self._convert_output(outputs)
Encode the input image to a tensor representation.

        Args:
            images (Union[str, ImageType, List[Union[str, ImageType, Tensor]], Tensor]): input image,
            can be a str(url), a PIL image, or a tensor, or a list of them
            normalize (bool): whether to normalize the output tensor
            media_download_headers (Optional[Dict]): headers for the image download
        Return:
            FloatTensor: the encoded image tensor with shape (batch_size, embedding_dim)
        
src/marqo/s2_inference/clip_utils.py