class_docstr: Permutation Invariant Training (PIT) module.
  
  :parameter int num_spkrs: number of speakers for PIT process (2 or 3)
class_docstr_tok: ["Permutation","Invariant","Training","(","PIT",")","module",".",":","parameter","int","num_spkrs",":","number","of","speakers","for","PIT","process","(","2","or","3",")"]
docstr: Compute the PIT loss for each sample.
  
  :param 1-D torch.Tensor loss: list of losses for one sample,
      including [h1r1, h1r2, h2r1, h2r2] or
      [h1r1, h1r2, h1r3, h2r1, h2r2, h2r3, h3r1, h3r2, h3r3]
  :return minimum loss of best permutation
  :rtype torch.Tensor (1)
  :return the best permutation
  :rtype List: len=2
docstr_tok: ["Compute","the","PIT","loss","for","each","sample",".",":","param","1-D","torch.Tensor","loss",":","list","of","losses","for","one","sample",",","including","[","h1r1",",","h1r2",",","h2r1",",","h2r2","]","or","[","h1r1",",","h1r2",",","h1r3",",","h2r1",",","h2r2",",","h2r3",",","h3r1",",","h3r2",",","h3r3","]",":","return","minimum","loss","of","best","permutation",":","rtype","torch.Tensor","(","1",")",":","return","the","best","permutation",":","rtype","List",":","len=2"]
code: def min_pit_sample(self, loss):
      """Compute the PIT loss for each sample.
  
      :param 1-D torch.Tensor loss: list of losses for one sample,
          including [h1r1, h1r2, h2r1, h2r2] or
          [h1r1, h1r2, h1r3, h2r1, h2r2, h2r3, h3r1, h3r2, h3r3]
      :return minimum loss of best permutation
      :rtype torch.Tensor (1)
      :return the best permutation
      :rtype List: len=2
  
      """
      score_perms = (
          torch.stack(
              [
                  torch.sum(loss[loss_perm_idx])
                  for loss_perm_idx in self.loss_perm_idx
              ]
          )
          / self.num_spkrs
      )
      perm_loss, min_idx = torch.min(score_perms, 0)
      permutation = self.perm_choices[min_idx]
      return perm_loss, permutation
  
imports: import argparse
  import logging
  import math
  import os
  import sys
  from itertools import groupby
  import numpy
  import torch
  from espnet.nets.asr_interface import ASRInterface
  from espnet.nets.e2e_asr_common import get_vgg2l_odim, label_smoothing_dist
  from espnet.nets.pytorch_backend.ctc import ctc_for
  from espnet.nets.pytorch_backend.e2e_asr import E2E
  from espnet.nets.pytorch_backend.e2e_asr import Reporter
  from espnet.nets.pytorch_backend.frontends.feature_transform import feature_transform_for
  from espnet.nets.pytorch_backend.frontends.frontend import frontend_for
  from espnet.nets.pytorch_backend.initialization import lecun_normal_init_parameters, set_forget_bias_to_one
  from espnet.nets.pytorch_backend.nets_utils import get_subsample, make_pad_mask, pad_list, to_device, to_torch_tensor
  from espnet.nets.pytorch_backend.rnn.attentions import att_for
  from espnet.nets.pytorch_backend.rnn.decoders import decoder_for
  from espnet.nets.pytorch_backend.rnn.encoders import RNNP, VGG2L
  from espnet.nets.pytorch_backend.rnn.encoders import encoder_for
label_desc: Use image node_id 2 for calling the PIT obj's underlying member method code with example usage: obj.min_pit_sample(loss) and returns: perm_loss,  permutation