docstr: Permutation Invariant Training Solver.
  
  Args:
      criterion (AbsEnhLoss): an instance of AbsEnhLoss
      weight (float): weight (between 0 and 1) of current loss
          for multi-task learning.
      independent_perm (bool):
          If True, PIT will be performed in forward to find the best permutation;
          If False, the permutation from the last LossWrapper output will be
          inherited.
          NOTE (wangyou): You should be careful about the ordering of loss
              wrappers defined in the yaml config, if this argument is False.
      flexible_numspk (bool):
          If True, num_spk will be taken from inf to handle flexible numbers of
          speakers. This is because ref may include dummy data in this case.
code: def __init__(
      self,
      criterion: AbsEnhLoss,
      weight=1.0,
      independent_perm=True,
      flexible_numspk=False,
  ):
      """Permutation Invariant Training Solver.
  
      Args:
          criterion (AbsEnhLoss): an instance of AbsEnhLoss
          weight (float): weight (between 0 and 1) of current loss
              for multi-task learning.
          independent_perm (bool):
              If True, PIT will be performed in forward to find the best permutation;
              If False, the permutation from the last LossWrapper output will be
              inherited.
              NOTE (wangyou): You should be careful about the ordering of loss
                  wrappers defined in the yaml config, if this argument is False.
          flexible_numspk (bool):
              If True, num_spk will be taken from inf to handle flexible numbers of
              speakers. This is because ref may include dummy data in this case.
      """
      super().__init__()
      self.criterion = criterion
      self.weight = weight
      self.independent_perm = independent_perm
      self.flexible_numspk = flexible_numspk
  
file_path: espnet/espnet2/enh/loss/wrappers/pit_solver.py
imports: from collections import defaultdict
  from itertools import permutations
  import torch
  from espnet2.enh.loss.criterions.abs_loss import AbsEnhLoss
  from espnet2.enh.loss.wrappers.abs_wrapper import AbsLossWrapper
label_desc: Use image node_id 1 to create a new PITSolver object from inherited base classes: AbsLossWrapper with example: obj = PITSolver(criterion, weight, independent_perm, flexible_numspk)