code: def gmm_params(
      z: tf.Tensor, gamma: tf.Tensor
  ) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]:
      """
      Compute parameters of Gaussian Mixture Model.
  
      Parameters
      ----------
      z
          Observations.
      gamma
          Mixture probabilities to derive mixture distribution weights from.
  
      Returns
      -------
      phi
          Mixture component distribution weights.
      mu
          Mixture means.
      cov
          Mixture covariance.
      L
          Cholesky decomposition of `cov`.
      log_det_cov
          Log of the determinant of `cov`.
      """
      # compute gmm parameters phi, mu and cov
      N = gamma.shape[0]  # nb of samples in batch
      sum_gamma = tf.reduce_sum(gamma, 0)  # K
      phi = sum_gamma / N  # K
      mu = tf.reduce_sum(
          tf.expand_dims(gamma, -1) * tf.expand_dims(z, 1), 0
      ) / tf.expand_dims(
          sum_gamma, -1
      )  # K x D (D = latent_dim)
      z_mu = tf.expand_dims(z, 1) - tf.expand_dims(mu, 0)  # N x K x D
      z_mu_outer = tf.expand_dims(z_mu, -1) * tf.expand_dims(
          z_mu, -2
      )  # N x K x D x D
      cov = tf.reduce_sum(
          tf.expand_dims(tf.expand_dims(gamma, -1), -1) * z_mu_outer, 0
      ) / tf.expand_dims(
          tf.expand_dims(sum_gamma, -1), -1
      )  # K x D x D
  
      # cholesky decomposition of covariance and determinant derivation
      D = tf.shape(cov)[1]
      eps = 1e-6
      L = tf.linalg.cholesky(cov + tf.eye(D) * eps)  # K x D x D
      log_det_cov = 2.0 * tf.reduce_sum(
          tf.math.log(tf.linalg.diag_part(L)), 1
      )  # K
  
      return phi, mu, cov, L, log_det_cov
  
imports: import numpy
  import tensorflow
  from typing import Tuple
label_desc: Use image node_id 1 for calling a global function with example usage: gmm_params(z, gamma) and returns: phi,  mu,  cov,  L,  log_det_cov