class_docstr: Perform spectral clustering by calculating spectral embeddings then run k-means clustering
  algorithm on the spectral embeddings.
class_docstr_tok: ["Perform","spectral","clustering","by","calculating","spectral","embeddings","then","run","k-means","clustering","algorithm","on","the","spectral","embeddings","."]
docstr: Calculate eigenvalues and eigenvectors to extract spectral embeddings.
  
  Args:
      affinity (Tensor):
          Affinity matrix input
      cuda (torch.bool):
          Use cuda for spectral clustering if cuda=True
      device (torch.device):
          Torch device variable
  
  Returns:
      labels (Tensor):
          clustering label output
code: def getSpectralEmbeddings(
      self,
      affinity_mat: torch.Tensor,
      n_spks: int = 8,
      cuda: bool = False,
  ) -> torch.Tensor:
      """
      Calculate eigenvalues and eigenvectors to extract spectral embeddings.
  
      Args:
          affinity (Tensor):
              Affinity matrix input
          cuda (torch.bool):
              Use cuda for spectral clustering if cuda=True
          device (torch.device):
              Torch device variable
  
      Returns:
          labels (Tensor):
              clustering label output
      """
      laplacian = getLaplacian(affinity_mat)
      _, diffusion_map_ = eigDecompose(
          laplacian, cuda=cuda, device=affinity_mat.device
      )
      diffusion_map = diffusion_map_[:, :n_spks]
      inv_idx = torch.arange(diffusion_map.size(1) - 1, -1, -1).long()
      embedding = diffusion_map.T[inv_idx, :]
      return embedding[:n_spks].T
  
imports: from typing import Dict, List, Tuple
  import torch
  from torch.linalg import eigh, eigvalsh
label_desc: Use image node_id 4 for calling the SpectralClustering obj's underlying member method code with example usage: obj.getSpectralEmbeddings(affinity_mat, n_spks, cuda) and returns: embedding