class_docstr: Calculate the Inception Score (IS) which is used to access how realistic generated images are.
  
  .. math::
      IS = exp(\mathbb{E}_x KL(p(y | x ) || p(y)))
  
  where :math:`KL(p(y | x) || p(y))` is the KL divergence between the conditional distribution :math:`p(y|x)`
  and the margianl distribution :math:`p(y)`. Both the conditional and marginal distribution is calculated
  from features extracted from the images. The score is calculated on random splits of the images such that
  both a mean and standard deviation of the score are returned. The metric was originally proposed in
  `inception ref1`_.
  
  Using the default feature extraction (Inception v3 using the original weights from `inception ref2`_), the input
  is expected to be mini-batches of 3-channel RGB images of shape ``(3xHxW)``. If argument ``normalize``
  is ``True`` images are expected to be dtype ``float`` and have values in the ``[0,1]`` range, else if
  ``normalize`` is set to ``False`` images are expected to have dtype uint8 and take values in the ``[0, 255]``
  range. All images will be resized to 299 x 299 which is the size of the original training data.
  
  .. note:: using this metric with the default feature extractor requires that ``torch-fidelity``
      is installed. Either install as ``pip install torchmetrics[image]`` or
      ``pip install torch-fidelity``
  
  As input to ``forward`` and ``update`` the metric accepts the following input
  
  - ``imgs`` (:class:`~torch.Tensor`): tensor with images feed to the feature extractor
  
  As output of `forward` and `compute` the metric returns the following output
  
  - ``fid`` (:class:`~torch.Tensor`): float scalar tensor with mean FID value over samples
  
  Args:
      feature:
          Either an str, integer or ``nn.Module``:
  
          - an str or integer will indicate the inceptionv3 feature layer to choose. Can be one of the following:
            'logits_unbiased', 64, 192, 768, 2048
          - an ``nn.Module`` for using a custom feature extractor. Expects that its forward method returns
            an ``(N,d)`` matrix where ``N`` is the batch size and ``d`` is the feature size.
  
      splits: integer determining how many splits the inception score calculation should be split among
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Raises:
      ValueError:
          If ``feature`` is set to an ``str`` or ``int`` and ``torch-fidelity`` is not installed
      ValueError:
          If ``feature`` is set to an ``str`` or ``int`` and not one of ``('logits_unbiased', 64, 192, 768, 2048)``
      TypeError:
          If ``feature`` is not an ``str``, ``int`` or ``torch.nn.Module``
  
  Example:
      >>> import torch
      >>> _ = torch.manual_seed(123)
      >>> from torchmetrics.image.inception import InceptionScore
      >>> inception = InceptionScore()
      >>> # generate some images
      >>> imgs = torch.randint(0, 255, (100, 3, 299, 299), dtype=torch.uint8)
      >>> inception.update(imgs)
      >>> inception.compute()
      (tensor(1.0544), tensor(0.0117))
code: def __init__(
      self,
      feature: Union[str, int, Module] = "logits_unbiased",
      splits: int = 10,
      normalize: bool = False,
      **kwargs: Any,
  ) -> None:
      super().__init__(**kwargs)
  
      rank_zero_warn(
          "Metric `InceptionScore` will save all extracted features in buffer."
          " For large datasets this may lead to large memory footprint.",
          UserWarning,
      )
  
      if isinstance(feature, (str, int)):
          if not _TORCH_FIDELITY_AVAILABLE:
              raise ModuleNotFoundError(
                  "InceptionScore metric requires that `Torch-fidelity` is installed."
                  " Either install as `pip install torchmetrics[image]` or `pip install torch-fidelity`."
              )
          valid_int_input = ("logits_unbiased", 64, 192, 768, 2048)
          if feature not in valid_int_input:
              raise ValueError(
                  f"Integer input to argument `feature` must be one of {valid_int_input}, but got {feature}."
              )
  
          self.inception = NoTrainInceptionV3(
              name="inception-v3-compat", features_list=[str(feature)]
          )
      elif isinstance(feature, Module):
          self.inception = feature
      else:
          raise TypeError("Got unknown input to argument `feature`")
  
      if not isinstance(normalize, bool):
          raise ValueError("Argument `normalize` expected to be a bool")
      self.normalize = normalize
  
      self.splits = splits
      self.add_state("features", [], dist_reduce_fx=None)
  
file_path: torchmetrics/src/torchmetrics/image/inception.py
imports: from typing import Any, List, Optional, Sequence, Tuple, Union
  import torch
  from torch import Tensor
  from torch.nn import Module
  from torchmetrics.image.fid import NoTrainInceptionV3
  from torchmetrics.metric import Metric
  from torchmetrics.utilities import rank_zero_warn
  from torchmetrics.utilities.data import dim_zero_cat
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE, _TORCH_FIDELITY_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 1 to create a new InceptionScore object from inherited base classes: Metric with example: obj = InceptionScore(feature, splits, normalize)