code: def Threshold(A, p):
      N = A.shape[0]
      Ap = np.zeros((N, N))
      for i in range(N):
          thr = sorted(A[i, :], reverse=True)[p]
          Ap[i, A[i, :] > thr] = A[i, A[i, :] > thr]
      return Ap
  
file_path: espnet/egs/libri_css/asr1/diarization/spec_clust.py
imports: import argparse
  import numpy
  import scipy
  from kaldiio import ReadHelper
  from sklearn.cluster import SpectralClustering
label_desc: Use image node_id 6 for calling a global function with example usage: Threshold(A, p) and returns: Ap