class_docstr: DISTS PyTorch Metric.
  
  This torchmetric class implements the metric described in the following
  paper:
  
  Image Quality Assessment: Unifying Structure and Texture Similarity
  Keyan Ding, Kede Ma, Shiqi Wang, Eero P. Simoncelli
  
  It has similar properties to LPIPS, but with a greater emphasis on texture.
  
  Args:
      reduction: str indicating how to reduce over the batch dimension.
          Choose between `'sum'` or `'mean'`.
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more
          info.
class_docstr_tok: ["DISTS","PyTorch","Metric",".","This","torchmetric","class","implements","the","metric","described","in","the","following","paper",":","Image","Quality","Assessment",":","Unifying","Structure","and","Texture","Similarity","Keyan","Ding",",","Kede","Ma",",","Shiqi","Wang",",","Eero","P.","Simoncelli","It","has","similar","properties","to","LPIPS",",","but","with","a","greater","emphasis","on","texture",".","Args",":","reduction",":","str","indicating","how","to","reduce","over","the","batch","dimension",".","Choose","between","`","'sum","'","`","or","`","'mean","'","`",".","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info","."]
docstr: Update internal states with lpips score.
  Args:
      img1: tensor with images of shape ``[N, 3, H, W]``
      img2: tensor with images of shape ``[N, 3, H, W]``
docstr_tok: ["Update","internal","states","with","lpips","score",".","Args",":","img1",":","tensor","with","images","of","shape","``","[","N",",","3",",","H",",","W","]","``","img2",":","tensor","with","images","of","shape","``","[","N",",","3",",","H",",","W","]","``"]
code: def update(self, img1: Tensor, img2: Tensor) -> None:  # type: ignore
      """Update internal states with lpips score.
      Args:
          img1: tensor with images of shape ``[N, 3, H, W]``
          img2: tensor with images of shape ``[N, 3, H, W]``
      """
      if not (_valid_img(img1) and _valid_img(img2)):
          raise ValueError(
              "Expected both input arguments to be normalized tensors with "
              f"shape [N, 3, H, W]. Got input with shape {img1.shape} and "
              f"{img2.shape} and values in range {[img1.min(), img1.max()]} "
              f"and {[img2.min(), img2.max()]} when all values are expected "
              f"to be in the {[0,1]} range."
          )
      loss = self.net(img1, img2).squeeze()
      self.sum_scores += loss.sum()
      self.total += img1.shape[0]
  
file_path: NeuralCompression/neuralcompression/metrics/_dists.py
imports: from typing import Any, List
  import torch
  from DISTS_pytorch import DISTS
  from torch import Tensor
  from torchmetrics.metric import Metric
  from typing_extensions import Literal
label_desc: Use image node_id 2 for calling the DeepImageStructureTextureSimilarity obj's underlying member method code with example usage: obj.update(img1, img2) without return types