class_docstr: The multivariate normal distribution on `R^k`.
  
  The Multivariate Normal distribution is defined over `R^k` and parameterized
  by a (batch of) length-`k` `loc` vector (aka "mu") and a (batch of) `k x k`
  `scale` matrix; `covariance = scale @ scale.T` where `@` denotes
  matrix-multiplication.
  
  #### Mathematical Details
  
  The probability density function (pdf) is,
  
  ```none
  pdf(x; loc, scale) = exp(-0.5 ||y||**2) / Z,
  y = inv(scale) @ (x - loc),
  Z = (2 pi)**(0.5 k) |det(scale)|,
  ```
  
  where:
  
  * `loc` is a vector in `R^k`,
  * `scale` is a matrix in `R^{k x k}`, `covariance = scale @ scale.T`,
  * `Z` denotes the normalization constant, and,
  * `||y||**2` denotes the squared Euclidean norm of `y`.
  
  A (non-batch) `scale` matrix is:
  
  ```none
  scale = scale_tril
  ```
  
  where `scale_tril` is lower-triangular `k x k` matrix with non-zero diagonal,
  i.e., `tf.diag_part(scale_tril) != 0`.
  
  Additional leading dimensions (if any) will index batches.
  
  The MultivariateNormal distribution is a member of the [location-scale
  family](https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be
  constructed as,
  
  ```none
  X ~ MultivariateNormal(loc=0, scale=1)   # Identity scale, zero shift.
  Y = scale @ X + loc
  ```
  
  Trainable (batch) lower-triangular matrices can be created with
  `tfp.distributions.matrix_diag_transform()` and/or
  `tfp.math.fill_triangular()`
  
  #### Examples
  
  ```python
  tfd = tfp.distributions
  
  # Initialize a single 3-variate Gaussian.
  mu = [1., 2, 3]
  cov = [[ 0.36,  0.12,  0.06],
         [ 0.12,  0.29, -0.13],
         [ 0.06, -0.13,  0.26]]
  scale = tf.linalg.cholesky(cov)
  # ==> [[ 0.6,  0. ,  0. ],
  #      [ 0.2,  0.5,  0. ],
  #      [ 0.1, -0.3,  0.4]])
  mvn = tfd.MultivariateNormalTriL(
      loc=mu,
      scale_tril=scale)
  
  mvn.mean()
  # ==> [1., 2, 3]
  
  # Covariance agrees with cholesky(cov) parameterization.
  mvn.covariance()
  # ==> [[ 0.36,  0.12,  0.06],
  #      [ 0.12,  0.29, -0.13],
  #      [ 0.06, -0.13,  0.26]]
  
  # Compute the pdf of an observation in `R^3` ; return a scalar.
  mvn.prob([-1., 0, 1])  # shape: []
  
  # Initialize a 2-batch of 3-variate Gaussians.
  mu = [[1., 2, 3],
        [11, 22, 33]]              # shape: [2, 3]
  tril = ...  # shape: [2, 3, 3], lower triangular, non-zero diagonal.
  mvn = tfd.MultivariateNormalTriL(
      loc=mu,
      scale_tril=tril)
  
  # Compute the pdf of two `R^3` observations; return a length-2 vector.
  x = [[-0.9, 0, 0.1],
       [-10, 0, 9]]     # shape: [2, 3]
  mvn.prob(x)           # shape: [2]
  
  # Instantiate a "learnable" MVN.
  dims = 4
  mvn = tfd.MultivariateNormalTriL(
      loc=tf.Variable(tf.zeros([dims], dtype=tf.float32), name="mu"),
      scale_tril=tfp.util.TransformedVariable(
          tf.eye(dims, dtype=tf.float32),
          tfp.bijectors.FillScaleTriL(),
          name="raw_scale_tril")
  ```
class_docstr_tok: ["The","multivariate","normal","distribution","on","`","R^k","`",".","The","Multivariate","Normal","distribution","is","defined","over","`","R^k","`","and","parameterized","by","a","(","batch","of",")","length-","`","k","`","`","loc","`","vector","(","aka","``","mu","''",")","and","a","(","batch","of",")","`","k","x","k","`","`","scale","`","matrix",";","`","covariance","=","scale","@","scale.T","`","where","`","@","`","denotes","matrix-multiplication",".","#","#","#","#","Mathematical","Details","The","probability","density","function","(","pdf",")","is",",","``","`","none","pdf","(","x",";","loc",",","scale",")","=","exp","(","-0.5","||y||","*","*","2",")","\/","Z",",","y","=","inv","(","scale",")","@","(","x","-","loc",")",",","Z","=","(","2","pi",")","*","*","(","0.5","k",")","|det","(","scale",")","|",",","``","`","where",":","*","`","loc","`","is","a","vector","in","`","R^k","`",",","*","`","scale","`","is","a","matrix","in","`","R^","{","k","x","k","}","`",",","`","covariance","=","scale","@","scale.T","`",",","*","`","Z","`","denotes","the","normalization","constant",",","and",",","*","`","||y||","*","*","2","`","denotes","the","squared","Euclidean","norm","of","`","y","`",".","A","(","non-batch",")","`","scale","`","matrix","is",":","``","`","none","scale","=","scale_tril","``","`","where","`","scale_tril","`","is","lower-triangular","`","k","x","k","`","matrix","with","non-zero","diagonal",",","i.e.",",","`","tf.diag_part","(","scale_tril",")","!","=","0","`",".","Additional","leading","dimensions","(","if","any",")","will","index","batches",".","The","MultivariateNormal","distribution","is","a","member","of","the","[","location-scale","family","]","(","https",":","\/\/en.wikipedia.org\/wiki\/Location-scale_family",")",",","i.e.",",","it","can","be","constructed","as",",","``","`","none","X","~","MultivariateNormal","(","loc=0",",","scale=1",")","#","Identity","scale",",","zero","shift",".","Y","=","scale","@","X","+","loc","``","`","Trainable","(","batch",")","lower-triangular","matrices","can","be","created","with","`","tfp.distributions.matrix_diag_transform","(",")","`","and\/or","`","tfp.math.fill_triangular","(",")","`","#","#","#","#","Examples","``","`","python","tfd","=","tfp.distributions","#","Initialize","a","single","3-variate","Gaussian",".","mu","=","[","1.",",","2",",","3","]","cov","=","[","[","0.36",",","0.12",",","0.06","]",",","[","0.12",",","0.29",",","-0.13","]",",","[","0.06",",","-0.13",",","0.26","]","]","scale","=","tf.linalg.cholesky","(","cov",")","#","==",">","[","[","0.6",",","0.",",","0",".","]",",","#","[","0.2",",","0.5",",","0",".","]",",","#","[","0.1",",","-0.3",",","0.4","]","]",")","mvn","=","tfd.MultivariateNormalTriL","(","loc=mu",",","scale_tril=scale",")","mvn.mean","(",")","#","==",">","[","1.",",","2",",","3","]","#","Covariance","agrees","with","cholesky","(","cov",")","parameterization",".","mvn.covariance","(",")","#","==",">","[","[","0.36",",","0.12",",","0.06","]",",","#","[","0.12",",","0.29",",","-0.13","]",",","#","[","0.06",",","-0.13",",","0.26","]","]","#","Compute","the","pdf","of","an","observation","in","`","R^3","`",";","return","a","scalar",".","mvn.prob","(","[","-1.",",","0",",","1","]",")","#","shape",":","[","]","#","Initialize","a","2-batch","of","3-variate","Gaussians",".","mu","=","[","[","1.",",","2",",","3","]",",","[","11",",","22",",","33","]","]","#","shape",":","[","2",",","3","]","tril","=","...","#","shape",":","[","2",",","3",",","3","]",",","lower","triangular",",","non-zero","diagonal",".","mvn","=","tfd.MultivariateNormalTriL","(","loc=mu",",","scale_tril=tril",")","#","Compute","the","pdf","of","two","`","R^3","`","observations",";","return","a","length-2","vector",".","x","=","[","[","-0.9",",","0",",","0.1","]",",","[","-10",",","0",",","9","]","]","#","shape",":","[","2",",","3","]","mvn.prob","(","x",")","#","shape",":","[","2","]","#","Instantiate","a","``","learnable","''","MVN",".","dims","=","4","mvn","=","tfd.MultivariateNormalTriL","(","loc=tf.Variable","(","tf.zeros","(","[","dims","]",",","dtype=tf.float32",")",",","name=","''","mu","''",")",",","scale_tril=tfp.util.TransformedVariable","(","tf.eye","(","dims",",","dtype=tf.float32",")",",","tfp.bijectors.FillScaleTriL","(",")",",","name=","''","raw_scale_tril","''",")","``","`"]
code: def _parameter_properties(cls, dtype, num_classes=None):
      # pylint: disable=g-long-lambda
      return dict(
          loc=parameter_properties.ParameterProperties(event_ndims=1),
          scale_tril=parameter_properties.ParameterProperties(
              event_ndims=2,
              shape_fn=lambda sample_shape: ps.concat(
                  [sample_shape, sample_shape[-1:]], axis=0
              ),
              default_constraining_bijector_fn=lambda: fill_scale_tril_bijector.FillScaleTriL(
                  diag_shift=dtype_util.eps(dtype)
              ),
          ),
      )
  
file_path: probability/tensorflow_probability/python/distributions/mvn_tril.py
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import fill_scale_tril
  from tensorflow_probability.python.distributions import mvn_linear_operator
  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 tensor_util
  from tensorflow_probability.python.math import generic
  from tensorflow_probability.python.stats import sample_stats
  from tensorflow.python.ops.linalg import linear_operator
label_desc: Use image node_id 2 for calling the MultivariateNormalTriL obj's underlying member method code with example usage: obj._parameter_properties(cls, dtype, num_classes) and returns: dict