code: def _compute_cosine_distance(
      features1: Tensor,
      features2: Tensor,
      cosine_distance_eps: float = 0.1,
  ) -> Tensor:
      """Compute the cosine distance between two sets of features."""
      features1_nozero = features1[torch.sum(features1, dim=1) != 0]
      features2_nozero = features2[torch.sum(features2, dim=1) != 0]
  
      # normalize
      norm_f1 = features1_nozero / torch.norm(
          features1_nozero, dim=1, keepdim=True
      )
      norm_f2 = features2_nozero / torch.norm(
          features2_nozero, dim=1, keepdim=True
      )
  
      d = 1.0 - torch.abs(torch.matmul(norm_f1, norm_f2.t()))
      mean_min_d = torch.mean(d.min(dim=1).values)
      return (
          mean_min_d
          if mean_min_d < cosine_distance_eps
          else torch.ones_like(mean_min_d)
      )
  
file_path: torchmetrics/src/torchmetrics/image/mifid.py
imports: from typing import Any, List, Optional, Sequence, Union
  import torch
  from torch import Tensor
  from torch.nn import Module
  from torchmetrics.image.fid import NoTrainInceptionV3, _compute_fid
  from torchmetrics.metric import Metric
  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 for calling a global function with example usage: _compute_cosine_distance(features1, features2, cosine_distance_eps) and returns: unknown