class_docstr: The multivariate normal distribution on `R^k`.
  
  This Multivariate Normal distribution is defined over `R^k` and parameterized
  by a (batch of) length-`k` `loc` vector (the mean) and a (batch of) `k x k`
  `covariance` matrix. The covariance matrix for this particular Normal is given
  as a linear operator, `LinearOperatorLowRankUpdate`.
  
  #### Mathematical Details
  
  The probability density function (pdf) is,
  
  ```none
  pdf(x; loc, covariance) = exp(-0.5 y^T @ inv(covariance) @ y) / Z,
  y := x - loc
  Z := (2 pi)**(0.5 k) |det(covariance)|**0.5,
  ```
  
  where `^T` denotes matrix transpose and `@` matrix multiplication
  
  The MultivariateNormal distribution can also be parameterized as a
  [location-scale family](https://en.wikipedia.org/wiki/Location-scale_family),
  i.e., it can be constructed using a matrix `scale` such that
  `covariance = scale @ scale^T`, and then
  
  ```none
  X ~ MultivariateNormal(loc=0, scale=I)   # Identity scale, zero shift.
  Y = scale @ X + loc
  ```
  
  #### Examples
  
  ```python
  tfd = tfp.distributions
  
  # Initialize a single 2-variate Gaussian.
  # The covariance is a rank 1 update of a diagonal matrix.
  loc = [1., 2.]
  diag = [1., 1.]
  u = tf.ones((2, 1)) * np.sqrt(2)  # Unit vector
  cov_operator = tf.linalg.LinearOperatorLowRankUpdate(
      base_operator=tf.linalg.LinearOperatorDiag(diag,
                                                 is_positive_definite=True),
      u=u,
  )
  mvn = MultivariateNormalLowRankUpdateLinearOperatorCovariance(
      loc=loc, cov_operator=cov_operator)
  
  # Covariance agrees with the cov_operator.
  mvn.covariance()
  # ==> [[ 2., 1.],
  #      [ 1., 2.]]
  
  # Compute the pdf of an`R^2` observation; return a scalar.
  mvn.prob([-1., 0])  # shape: []
  
  # Initialize a 2-batch of 2-variate Gaussians.
  mu = [[1., 2],
        [11, 22]]              # shape: [2, 2]
  diag = [[1., 2],
          [0.5, 1]]     # shape: [2, 2]
  u = tf.ones((2, 1)) * np.sqrt(2)  # Unit vector, will broadcast over batches!
  cov_operator = tf.linalg.LinearOperatorLowRankUpdate(
      base_operator=tf.linalg.LinearOperatorDiag(diag,
                                                 is_positive_definite=True),
      u=u,
  )
  mvn = MultivariateNormalLowRankUpdateLinearOperatorCovariance(
      loc=loc, cov_operator=cov_operator)
  
  # Compute the pdf of two `R^2` observations; return a length-2 vector.
  x = [[-0.9, 0],
       [-10, 0]]     # shape: [2, 2]
  mvn.prob(x)    # shape: [2]
  ```
docstr: Construct Multivariate Normal distribution on `R^k`.
  
  The `batch_shape` is the broadcast shape between `loc` and
  `cov_operator` arguments.
  
  The `event_shape` is given by last dimension of the matrix implied by
  `cov_operator`. The last dimension of `loc` (if provided) must
  broadcast with this.
  
  Additional leading dimensions (if any) will index batches.
  
  Args:
    loc: Floating-point `Tensor`. If this is set to `None`, `loc` is
      implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where
      `b >= 0` and `k` is the event size.
    cov_operator: Instance of `LinearOperatorLowRankUpdate` with same
      `dtype` as `loc` and shape `[B1, ..., Bb, k, k]`.  Must have structure
      `A + UU^T` or `A + UDU^T`, where `A` and `D` (if provided) are
      self-adjoint and positive definite.
    validate_args: Python `bool`, default `False`. Whether to validate input
      with asserts. If `validate_args` is `False`, and the inputs are invalid,
      correct behavior is not guaranteed.
    allow_nan_stats: Python `bool`, default `True`. If `False`, raise an
      exception if a statistic (e.g. mean/mode/etc...) is undefined for any
      batch member. If `True`, batch members with valid parameters leading to
      undefined statistics will return NaN for this statistic.
    name: The name to give Ops created by the initializer.
  
  Raises:
    ValueError: if `cov_operator` is unspecified.
    ValueError: if `cov_operator` does not specify the self-adjoint
      positive definite conditions explained above.
    TypeError: if not `cov_operator.dtype.is_floating`
docstr_tok: ["Construct","Multivariate","Normal","distribution","on","`","R^k","`",".","The","`","batch_shape","`","is","the","broadcast","shape","between","`","loc","`","and","`","cov_operator","`","arguments",".","The","`","event_shape","`","is","given","by","last","dimension","of","the","matrix","implied","by","`","cov_operator","`",".","The","last","dimension","of","`","loc","`","(","if","provided",")","must","broadcast","with","this",".","Additional","leading","dimensions","(","if","any",")","will","index","batches",".","Args",":","loc",":","Floating-point","`","Tensor","`",".","If","this","is","set","to","`","None","`",",","`","loc","`","is","implicitly","`","0","`",".","When","specified",",","may","have","shape","`","[","B1",",","...",",","Bb",",","k","]","`","where","`","b",">","=","0","`","and","`","k","`","is","the","event","size",".","cov_operator",":","Instance","of","`","LinearOperatorLowRankUpdate","`","with","same","`","dtype","`","as","`","loc","`","and","shape","`","[","B1",",","...",",","Bb",",","k",",","k","]","`",".","Must","have","structure","`","A","+","UU^T","`","or","`","A","+","UDU^T","`",",","where","`","A","`","and","`","D","`","(","if","provided",")","are","self-adjoint","and","positive","definite",".","validate_args",":","Python","`","bool","`",",","default","`","False","`",".","Whether","to","validate","input","with","asserts",".","If","`","validate_args","`","is","`","False","`",",","and","the","inputs","are","invalid",",","correct","behavior","is","not","guaranteed",".","allow_nan_stats",":","Python","`","bool","`",",","default","`","True","`",".","If","`","False","`",",","raise","an","exception","if","a","statistic","(","e.g",".","mean\/mode\/etc","...",")","is","undefined","for","any","batch","member",".","If","`","True","`",",","batch","members","with","valid","parameters","leading","to","undefined","statistics","will","return","NaN","for","this","statistic",".","name",":","The","name","to","give","Ops","created","by","the","initializer",".","Raises",":","ValueError",":","if","`","cov_operator","`","is","unspecified",".","ValueError",":","if","`","cov_operator","`","does","not","specify","the","self-adjoint","positive","definite","conditions","explained","above",".","TypeError",":","if","not","`","cov_operator.dtype.is_floating","`"]
code: def __init__(
      self,
      loc=None,
      cov_operator=None,
      validate_args=False,
      allow_nan_stats=True,
      name="MultivariateNormalLowRankUpdateLinearOperatorCovariance",
  ):
      """Construct Multivariate Normal distribution on `R^k`.
  
      The `batch_shape` is the broadcast shape between `loc` and
      `cov_operator` arguments.
  
      The `event_shape` is given by last dimension of the matrix implied by
      `cov_operator`. The last dimension of `loc` (if provided) must
      broadcast with this.
  
      Additional leading dimensions (if any) will index batches.
  
      Args:
        loc: Floating-point `Tensor`. If this is set to `None`, `loc` is
          implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where
          `b >= 0` and `k` is the event size.
        cov_operator: Instance of `LinearOperatorLowRankUpdate` with same
          `dtype` as `loc` and shape `[B1, ..., Bb, k, k]`.  Must have structure
          `A + UU^T` or `A + UDU^T`, where `A` and `D` (if provided) are
          self-adjoint and positive definite.
        validate_args: Python `bool`, default `False`. Whether to validate input
          with asserts. If `validate_args` is `False`, and the inputs are invalid,
          correct behavior is not guaranteed.
        allow_nan_stats: Python `bool`, default `True`. If `False`, raise an
          exception if a statistic (e.g. mean/mode/etc...) is undefined for any
          batch member. If `True`, batch members with valid parameters leading to
          undefined statistics will return NaN for this statistic.
        name: The name to give Ops created by the initializer.
  
      Raises:
        ValueError: if `cov_operator` is unspecified.
        ValueError: if `cov_operator` does not specify the self-adjoint
          positive definite conditions explained above.
        TypeError: if not `cov_operator.dtype.is_floating`
      """
      parameters = dict(locals())
      if cov_operator is None:
          raise ValueError("Missing required `cov_operator` parameter.")
      if not dtype_util.is_floating(cov_operator.dtype):
          raise TypeError(
              "`cov_operator` parameter must have floating-point dtype."
          )
      if not isinstance(
          cov_operator, tf.linalg.LinearOperatorLowRankUpdate
      ):
          raise TypeError(
              "`cov_operator` must be a LinearOperatorLowRankUpdate. "
              "Found {}".format(type(cov_operator))
          )
  
      if cov_operator.u is not cov_operator.v:
          raise ValueError(
              "The `U` and `V` (typically low rank) matrices of "
              "`cov_operator` must be the same, but were not."
          )
  
      # For cov_operator, raise if the user explicitly set these to False,
      # or if False was inferred by the LinearOperator. The default value is None,
      # which will not trigger these raises.
      # pylint: disable=g-bool-id-comparison
      if cov_operator.is_self_adjoint is False:
          raise ValueError("`cov_operator` must be self-adjoint.")
      if cov_operator.is_positive_definite is False:
          raise ValueError("`cov_operator` must be positive definite.")
      # pylint: enable=g-bool-id-comparison
  
      # For the base_operator, we require the user to explicity set
      # is_self_adjoint and is_positive_definite.
      if not cov_operator.base_operator.is_self_adjoint:
          raise ValueError(
              "The `base_operator` of `cov_operator` must be self-adjoint. "
              "You may have to set the `is_self_adjoint` initialization hint."
          )
      if not cov_operator.base_operator.is_positive_definite:
          raise ValueError(
              "The `base_operator` of `cov_operator` must be positive "
              "definite. You may have to set the `is_positive_definite` "
              "initialization hint."
          )
  
      with tf.name_scope(name) as name:
          dtype = dtype_util.common_dtype(
              [loc, cov_operator], dtype_hint=tf.float32
          )
          if loc is not None:
              loc = tensor_util.convert_nonref_to_tensor(
                  loc, dtype=dtype, name="loc"
              )
  
          # Get dynamic shapes (for self.*shape_tensor methods).
          # shapes_from_loc_and_scale tries to return TensorShapes, but may return
          # tensors. So we can only use it for the *shape_tensor methods.
          # It is useful though, since it does lots of shape checks, and is a
          # well-tested function.
          (
              batch_shape,
              event_shape,
          ) = distribution_util.shapes_from_loc_and_scale(
              loc, cov_operator
          )
          self._batch_shape_tensor_value = ps.convert_to_shape_tensor(
              batch_shape, name="batch_shape"
          )
          self._event_shape_tensor_value = ps.convert_to_shape_tensor(
              event_shape, name="event_shape"
          )
  
          # Get static shapes (for self.*shape methods).
          self._batch_shape_value = cov_operator.batch_shape
          if loc is not None:
              self._batch_shape_value = tf.broadcast_static_shape(
                  self._batch_shape_value, loc.shape[:-1]
              )
          self._event_shape_value = cov_operator.shape[-1:]
          if loc is not None:
              self._event_shape_value = tf.broadcast_static_shape(
                  self._event_shape_value, loc.shape[-1:]
              )
  
      self._loc = loc
      self._cov_operator = cov_operator
  
      super(
          MultivariateNormalLowRankUpdateLinearOperatorCovariance, self
      ).__init__(
          dtype=dtype,
          reparameterization_type=reparameterization.FULLY_REPARAMETERIZED,
          validate_args=validate_args,
          allow_nan_stats=allow_nan_stats,
          parameters=parameters,
          name=name,
      )
      self._parameters = parameters
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
label_desc: Use image node_id 1 to create a new MultivariateNormalLowRankUpdateLinearOperatorCovariance object from inherited base classes: distribution with example: obj = MultivariateNormalLowRankUpdateLinearOperatorCovariance(loc, cov_operator, validate_args, allow_nan_stats, name)