code: def _log_multivariate_normal_density_diag(X, means, covars):
      """Compute Gaussian log-density at X for a diagonal model."""
      # X: (ns, nf); means: (nc, nf); covars: (nc, nf) -> (ns, nc)
      nc, nf = means.shape
      # Avoid 0 log 0 = nan in degenerate covariance case.
      covars = np.maximum(covars, np.finfo(float).tiny)
      with np.errstate(over="ignore"):
          return -0.5 * (
              nf * np.log(2 * np.pi)
              + np.log(covars).sum(axis=-1)
              + ((X[:, None, :] - means) ** 2 / covars).sum(axis=-1)
          )
  
imports: import numpy
  from scipy import linalg
label_desc: Use image node_id 2 for calling a global function with example usage: _log_multivariate_normal_density_diag(X, means, covars) and returns: unknown