code: def estimateNumofSpeakers(
      affinity_mat: torch.Tensor,
      max_num_speakers: int,
      cuda: bool = False,
  ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
      """
      Estimate the number of speakers using eigendecomposition on the Laplacian Matrix.
  
      Args:
          affinity_mat (Tensor):
              N by N affinity matrix
          max_num_speakers (int):
              Maximum number of clusters to consider for each session
          cuda (bool):
              If cuda available eigendecomposition is computed on GPUs.
  
      Returns:
          num_of_spk (Tensor):
              The estimated number of speakers
          lambdas (Tensor):
              The lambda values from eigendecomposition
          lambda_gap (Tensor):
              The gap between the lambda values from eigendecomposition
      """
      laplacian = getLaplacian(affinity_mat)
      lambdas = eigValueSh(
          laplacian, cuda=cuda, device=affinity_mat.device
      )
      lambdas = torch.sort(lambdas)[0]
      lambda_gap = getLamdaGaplist(lambdas)
      num_of_spk = (
          torch.argmax(
              lambda_gap[: min(max_num_speakers, lambda_gap.shape[0])]
          )
          + 1
      )
      return num_of_spk, lambdas, lambda_gap
  
imports: from typing import Dict, List, Tuple
  import torch
  from torch.linalg import eigh, eigvalsh
label_desc: Use image node_id 23 for calling a global function with example usage: estimateNumofSpeakers(affinity_mat, max_num_speakers, cuda) and returns: num_of_spk,  lambdas,  lambda_gap