code: def linear_sum_assignment(
      cost_matrix: torch.Tensor, max_size: int = 100
  ):
      """
      Launch the linear sum assignment algorithm on a cost matrix.
  
      Args:
          cost_matrix (Tensor): The cost matrix of shape (N, M) where M should be larger than N.
  
      Returns:
          row_index (Tensor): The row indices of the optimal assignments.
          col_index (Tensor): The column indices of the optimal assignments.
      """
      cost_matrix = cost_matrix.clone().detach()
  
      if len(cost_matrix.shape) != 2:
          raise ValueError(
              f"2-d tensor is expected but got a {cost_matrix.shape} tensor"
          )
      if max(cost_matrix.shape) > max_size:
          raise ValueError(
              f"Cost matrix size {cost_matrix.shape} is too large. The maximum supported size is {max_size}x{max_size}."
          )
  
      # The algorithm expects more columns than rows in the cost matrix.
      if cost_matrix.shape[1] < cost_matrix.shape[0]:
          cost_matrix = cost_matrix.T
          transposed = True
      else:
          transposed = False
  
      lap_solver = LinearSumAssignmentSolver(cost_matrix)
      f_int: int = 0 if 0 in cost_matrix.shape else 1
  
      # while step is not Done (step 0):
      # NOTE: torch.jit.scipt does not support getattr with string argument.
      # Do not use getattr(lap_solver, f"_step{f_int}")()
      while f_int != 0:
          if f_int == 1:
              f_int = lap_solver._step1()
          elif f_int == 2:
              f_int = lap_solver._step2()
          elif f_int == 3:
              f_int = lap_solver._step3()
          elif f_int == 4:
              f_int = lap_solver._step4()
          elif f_int == 5:
              f_int = lap_solver._step5()
          elif f_int == 6:
              f_int = lap_solver._step6()
  
      if transposed:
          marked = lap_solver.marked.T
      else:
          marked = lap_solver.marked
      row_index, col_index = torch.where(marked == 1)
      return row_index, col_index
  
file_path: NeMo/nemo/collections/asr/parts/utils/optimization_utils.py
imports: import torch
label_desc: Use image node_id 2 for calling a global function with example usage: linear_sum_assignment(cost_matrix, max_size) and returns: row_index,  col_index