code: def detect_duplicates(
      X: Tensor,
      rtol: float = 0,
      atol: float = 1e-8,
  ) -> Iterator[Tuple[int, int]]:
      """Returns an iterator over index pairs `(duplicate index, original index)` for all
      duplicate entries of `X`. Supporting 2-d Tensor only.
  
      Args:
          X: the datapoints tensor with potential duplicated entries
          rtol: relative tolerance
          atol: absolute tolerance
      """
      if len(X.shape) != 2:
          raise ValueError("X must have 2 dimensions.")
  
      tols = atol
      if rtol:
          rval = X.abs().max(dim=-1, keepdim=True).values
          tols = tols + rtol * rval.max(rval.transpose(-1, -2))
  
      n = X.shape[-2]
      dist = torch.full(
          (n, n), float("inf"), device=X.device, dtype=X.dtype
      )
      dist[
          torch.triu_indices(n, n, offset=1).unbind()
      ] = torch.nn.functional.pdist(X, p=float("inf"))
      return (
          (i, int(j))
          # pyre-fixme[19]: Expected 1 positional argument.
          for diff, j, i in zip(*(dist - tols).min(dim=-2), range(n))
          if diff < 0
      )
  
imports: from __future__ import annotations
  import warnings
  from contextlib import contextmanager, ExitStack
  from typing import Iterator, List, Optional, Tuple
  import torch
  from botorch import settings
  from botorch.exceptions import InputDataError, InputDataWarning
  from botorch.settings import _Flag
  from gpytorch import settings
  from gpytorch.module import Module
  from torch import Tensor
label_desc: Use image node_id 10 for calling a global function with example usage: detect_duplicates(X, rtol, atol) and returns: unknown