docstr: Non-batch KL for N(loc_a, scale_a), N(loc_b, scale_b).
docstr_tok: ["Non-batch","KL","for","N","(","loc_a",",","scale_a",")",",","N","(","loc_b",",","scale_b",")","."]
code: def _compute_non_batch_kl(self, loc_a, scale_a, loc_b, scale_b):
      """Non-batch KL for N(loc_a, scale_a), N(loc_b, scale_b)."""
      # Check using numpy operations
      # This mostly repeats the tensorflow code _kl_mvn_mvn(), but in numpy.
      # So it is important to also check that KL(mvn, mvn) = 0.
      covariance_a = np.dot(scale_a, scale_a.T)
      covariance_b = np.dot(scale_b, scale_b.T)
      covariance_b_inv = np.linalg.inv(covariance_b)
  
      t = np.trace(covariance_b_inv.dot(covariance_a))
      q = (loc_b - loc_a).dot(covariance_b_inv).dot(loc_b - loc_a)
      k = loc_a.shape[0]
      l = np.log(
          np.linalg.det(covariance_b) / np.linalg.det(covariance_a)
      )
  
      return 0.5 * (t + q - k + l)
  
imports: import numpy
  from scipy import stats
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.bijectors import transform_diagonal
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import mvn_linear_operator
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 15 for calling the MultivariateNormalLinearOperatorTest obj's underlying member method code with example usage: obj._compute_non_batch_kl(loc_a, scale_a, loc_b, scale_b) and returns: unknown