code: def _dot_diag(x, d):
      # If d were a full diagonal matrix, x @ d would always do what we want.
      # Special treatment is needed for n-dimensional `d` in which each row
      # includes only the diagonal elements of a covariance matrix.
      return x * d if x.ndim < 2 else x * np.expand_dims(d, -2)
  
imports: from functools import cached_property
  import numpy
  from scipy import linalg
  from scipy.stats import _multivariate
label_desc: Use image node_id 1 for calling a global function with example usage: _dot_diag(x, d) and returns: unknown