code: def _covariance(x, y=None):
      """Sample covariance, assuming samples are the leftmost axis."""
      x = tf.convert_to_tensor(x, name="x")
      # Covariance *only* uses the centered versions of x (and y).
      x = x - tf.reduce_mean(x, axis=0)
  
      if y is None:
          y = x
      else:
          y = tf.convert_to_tensor(y, name="y", dtype=x.dtype)
          y = y - tf.reduce_mean(y, axis=0)
  
      return tf.reduce_mean(
          tf.linalg.matmul(
              x[..., tf.newaxis], y[..., tf.newaxis], adjoint_b=True
          ),
          axis=0,
      )
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.experimental.sequential import ensemble_kalman_filter
  from tensorflow_probability.python.internal import dtype_util
label_desc: Use image node_id 1 for calling a global function with example usage: _covariance(x, y) and returns: tf