code: def _linop_covariance(dist):
      """LinearOperator backing Cov(dist), without unnecessary broadcasting."""
      # This helps, even if we immediately call .to_dense(). Why?
      # Simply calling dist.covariance() would broadcast up to the full batch shape.
      # Instead, we want the shape to be that of the linear operator only.
      # This (i) saves memory and (ii) allows operations done with this operator
      # to be more efficient.
      if hasattr(dist, "cov_operator"):
          cov = dist.cov_operator
      else:
          cov = dist.scale.matmul(dist.scale.H)
      # TODO(b/132466537) composition doesn't preserve SPD so we have to hard-set.
      cov._is_positive_definite = (
          True  # pylint: disable=protected-access
      )
      cov._is_self_adjoint = True  # pylint: disable=protected-access
      return cov
  
file_path: probability/tensorflow_probability/python/experimental/sequential/ensemble_kalman_filter.py
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import mvn_linear_operator
  from tensorflow_probability.python.distributions import mvn_low_rank_update_linear_operator_covariance
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
label_desc: Use image node_id 6 for calling a global function with example usage: _linop_covariance(dist) and returns: cov