class_docstr: Calculates `CLIP Score`_ which is a text-to-image similarity metric.
  
  CLIP Score is a reference free metric that can be used to evaluate the correlation between a generated caption for
  an image and the actual content of the image. It has been found to be highly correlated with human judgement. The
  metric is defined as:
  
  .. math::
      \text{CLIPScore(I, C)} = max(100 * cos(E_I, E_C), 0)
  
  which corresponds to the cosine similarity between visual `CLIP`_ embedding :math:`E_i` for an image :math:`i` and
  textual CLIP embedding :math:`E_C` for an caption :math:`C`. The score is bound between 0 and 100 and the closer
  to 100 the better.
  
  .. note:: Metric is not scriptable
  
  As input to ``forward`` and ``update`` the metric accepts the following input
  
  - ``images`` (:class:`~torch.Tensor` or list of tensors): tensor with images feed to the feature extractor with. If
      a single tensor it should have shape ``(N, C, H, W)``. If a list of tensors, each tensor should have shape
      ``(C, H, W)``. ``C`` is the number of channels, ``H`` and ``W`` are the height and width of the image.
  - ``text`` (:class:`~str` or :class:`~list` of :class:`~str`): text to compare with the images, one for each image.
  
  As output of `forward` and `compute` the metric returns the following output
  
  - ``clip_score`` (:class:`~torch.Tensor`): float scalar tensor with mean CLIP score over samples
  
  Args:
      model_name_or_path: string indicating the version of the CLIP model to use. Available models are:
  
          - `"openai/clip-vit-base-patch16"`
          - `"openai/clip-vit-base-patch32"`
          - `"openai/clip-vit-large-patch14-336"`
          - `"openai/clip-vit-large-patch14"`
  
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Raises:
      ModuleNotFoundError:
          If transformers package is not installed or version is lower than 4.10.0
  
  Example:
      >>> import torch
      >>> from torchmetrics.multimodal.clip_score import CLIPScore
      >>> metric = CLIPScore(model_name_or_path="openai/clip-vit-base-patch16")
      >>> score = metric(torch.randint(255, (3, 224, 224), generator=torch.manual_seed(42)), "a photo of a cat")
      >>> score.detach()
      tensor(24.4255)
class_docstr_tok: ["Calculates","`","CLIP","Score","`","_","which","is","a","text-to-image","similarity","metric",".","CLIP","Score","is","a","reference","free","metric","that","can","be","used","to","evaluate","the","correlation","between","a","generated","caption","for","an","image","and","the","actual","content","of","the","image",".","It","has","been","found","to","be","highly","correlated","with","human","judgement",".","The","metric","is","defined","as",":","..","math",":",":","\\text","{","CLIPScore","(","I",",","C",")","}","=","max","(","100","*","cos","(","E_I",",","E_C",")",",","0",")","which","corresponds","to","the","cosine","similarity","between","visual","`","CLIP","`","_","embedding",":","math",":","`","E_i","`","for","an","image",":","math",":","`","i","`","and","textual","CLIP","embedding",":","math",":","`","E_C","`","for","an","caption",":","math",":","`","C","`",".","The","score","is","bound","between","0","and","100","and","the","closer","to","100","the","better",".","..","note",":",":","Metric","is","not","scriptable","As","input","to","``","forward","``","and","``","update","``","the","metric","accepts","the","following","input","-","``","images","``","(",":","class",":","`","~torch.Tensor","`","or","list","of","tensors",")",":","tensor","with","images","feed","to","the","feature","extractor","with",".","If","a","single","tensor","it","should","have","shape","``","(","N",",","C",",","H",",","W",")","``",".","If","a","list","of","tensors",",","each","tensor","should","have","shape","``","(","C",",","H",",","W",")","``",".","``","C","``","is","the","number","of","channels",",","``","H","``","and","``","W","``","are","the","height","and","width","of","the","image",".","-","``","text","``","(",":","class",":","`","~str","`","or",":","class",":","`","~list","`","of",":","class",":","`","~str","`",")",":","text","to","compare","with","the","images",",","one","for","each","image",".","As","output","of","`","forward","`","and","`","compute","`","the","metric","returns","the","following","output","-","``","clip_score","``","(",":","class",":","`","~torch.Tensor","`",")",":","float","scalar","tensor","with","mean","CLIP","score","over","samples","Args",":","model_name_or_path",":","string","indicating","the","version","of","the","CLIP","model","to","use",".","Available","models","are",":","-","`","``","openai\/clip-vit-base-patch16","''","`","-","`","``","openai\/clip-vit-base-patch32","''","`","-","`","``","openai\/clip-vit-large-patch14-336","''","`","-","`","``","openai\/clip-vit-large-patch14","''","`","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info",".","Raises",":","ModuleNotFoundError",":","If","transformers","package","is","not","installed","or","version","is","lower","than","4.10.0","Example",":",">",">",">","import","torch",">",">",">","from","torchmetrics.multimodal.clip_score","import","CLIPScore",">",">",">","metric","=","CLIPScore","(","model_name_or_path=","''","openai\/clip-vit-base-patch16","''",")",">",">",">","score","=","metric","(","torch.randint","(","255",",","(","3",",","224",",","224",")",",","generator=torch.manual_seed","(","42",")",")",",","``","a","photo","of","a","cat","''",")",">",">",">","score.detach","(",")","tensor","(","24.4255",")"]
docstr: Compute accumulated clip score.
docstr_tok: ["Compute","accumulated","clip","score","."]
code: def compute(self) -> Tensor:
      """Compute accumulated clip score."""
      return torch.max(
          self.score / self.n_samples, torch.zeros_like(self.score)
      )
  
file_path: torchmetrics/src/torchmetrics/multimodal/clip_score.py
imports: from typing import Any, List, Optional, Sequence, Union
  import torch
  from torch import Tensor
  from typing_extensions import Literal
  from torchmetrics import Metric
  from torchmetrics.functional.multimodal.clip_score import _clip_score_update, _get_clip_model_and_processor
  from torchmetrics.utilities.checks import _SKIP_SLOW_DOCTEST, _try_proceed_with_timeout
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE, _TRANSFORMERS_GREATER_EQUAL_4_10
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 3 for calling the CLIPScore obj's underlying member method code with example usage: obj.compute() and returns: torch