code: def fa_model_loop(
      batch_start,
      mini_batch_indices,
      factor_analyser,
      stat0,
      stat1,
      e_h,
      e_hh,
  ):
      """A function for PLDA estimation.
  
      Arguments
      ---------
      batch_start : int
          Index to start at in the list.
      mini_batch_indices : list
          Indices of the elements in the list (should start at zero).
      factor_analyser : instance of PLDA class
          PLDA class object.
      stat0 : tensor
          Matrix of zero-order statistics.
      stat1: tensor
          Matrix of first-order statistics.
      e_h : tensor
          An accumulator matrix.
      e_hh: tensor
          An accumulator matrix.
      """
      rank = factor_analyser.F.shape[1]
      if factor_analyser.Sigma.ndim == 2:
          A = factor_analyser.F.T.dot(factor_analyser.F)
          inv_lambda_unique = dict()
          for sess in numpy.unique(stat0[:, 0]):
              inv_lambda_unique[sess] = linalg.inv(
                  sess * A + numpy.eye(A.shape[0])
              )
  
      tmp = numpy.zeros(
          (factor_analyser.F.shape[1], factor_analyser.F.shape[1]),
          dtype=numpy.float64,
      )
  
      for idx in mini_batch_indices:
          if factor_analyser.Sigma.ndim == 1:
              inv_lambda = linalg.inv(
                  numpy.eye(rank)
                  + (
                      factor_analyser.F.T * stat0[idx + batch_start, :]
                  ).dot(factor_analyser.F)
              )
          else:
              inv_lambda = inv_lambda_unique[
                  stat0[idx + batch_start, 0]
              ]
  
          aux = factor_analyser.F.T.dot(stat1[idx + batch_start, :])
          numpy.dot(aux, inv_lambda, out=e_h[idx])
          e_hh[idx] = inv_lambda + numpy.outer(e_h[idx], e_h[idx], tmp)
  
imports: import numpy
  import copy
  import pickle
  from scipy import linalg
label_desc: Use image node_id 3 for calling a global function with example usage: fa_model_loop(batch_start, mini_batch_indices, factor_analyser, stat0, stat1, e_h, e_hh) without return types