code: def sample_random_indices(
      n_indices: int,
      n_samples: int,
      device: Optional[torch.device] = None,
  ) -> Optional[torch.Tensor]:
      """
      Samples `n_samples` random indices from range `[0..n_indices - 1]`.
      If `n_indices` is smaller than `n_samples`, returns `None` meaning that all indices
      are selected.
      Args:
          n_indices (int): total number of indices
          n_samples (int): number of indices to sample
          device (torch.device): the desired device of returned tensor
      Return:
          Tensor of selected vertex indices, or `None`, if all vertices are selected
      """
      if (n_samples <= 0) or (n_indices <= n_samples):
          return None
      indices = torch.randperm(n_indices, device=device)[:n_samples]
      return indices
  
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from torch.nn import functional
  from detectron2.structures import BoxMode, Instances
  from densepose import DensePoseDataRelative
label_desc: Use image node_id 4 for calling a global function with example usage: sample_random_indices(n_indices, n_samples, device) and returns: indices, None