class_docstr: Multivariate Gaussian distribution, with covariance matrix parametrized
  as the sum of a diagonal matrix and a low-rank matrix
  
  .. math::
      \Sigma = D + W W^T
  
  When `W = None` the covariance matrix is just diagonal.
  
  The implementation is strongly inspired from Pytorch:
  https://github.com/pytorch/pytorch/blob/master/torch/distributions/lowrank_multivariate_normal.py.
  
  Complexity to compute log_prob is :math:`O(dim * rank + rank^3)` per element.
  
  Parameters
  ----------
  dim
      Dimension of the distribution's support
  rank
      Rank of W
  mu
      Mean tensor, of shape (..., dim)
  D
      Diagonal term in the covariance matrix, of shape (..., dim)
  W
      Low-rank factor in the covariance matrix, of shape (..., dim, rank)
      Optional; if not provided, the covariance matrix is just diagonal.
docstr: Draw samples from the multivariate Gaussian distribution:
  
  .. math::
      s = \mu + D u + W v,
  
  where :math:`u` and :math:`v` are standard normal samples.
  
  Parameters
  ----------
  num_samples
      number of samples to be drawn.
  dtype
      Data-type of the samples.
  
  Returns
  -------
      tensor with shape (num_samples, ..., dim)
docstr_tok: ["Draw","samples","from","the","multivariate","Gaussian","distribution",":","..","math",":",":","s","=","\\mu","+","D","u","+","W","v",",","where",":","math",":","`","u","`","and",":","math",":","`","v","`","are","standard","normal","samples",".","Parameters","--","--","--","--","--","num_samples","number","of","samples","to","be","drawn",".","dtype","Data-type","of","the","samples",".","Returns","--","--","--","-","tensor","with","shape","(","num_samples",",","...",",","dim",")"]
code: def sample_rep(
      self, num_samples: Optional[int] = None, dtype=np.float32
  ) -> Tensor:
      r"""
      Draw samples from the multivariate Gaussian distribution:
  
      .. math::
          s = \mu + D u + W v,
  
      where :math:`u` and :math:`v` are standard normal samples.
  
      Parameters
      ----------
      num_samples
          number of samples to be drawn.
      dtype
          Data-type of the samples.
  
      Returns
      -------
          tensor with shape (num_samples, ..., dim)
      """
  
      def s(
          mu: Tensor, D: Tensor, W: Optional[Tensor] = None
      ) -> Tensor:
          F = getF(mu)
  
          samples_D = F.sample_normal(
              mu=F.zeros_like(mu), sigma=F.ones_like(mu), dtype=dtype
          )
          cov_D = D.sqrt() * samples_D
  
          if W is not None:
              # dummy only use to get the shape (..., rank, 1)
              dummy_tensor = F.linalg_gemm2(
                  W, mu.expand_dims(axis=-1), transpose_a=True
              ).squeeze(axis=-1)
  
              samples_W = F.sample_normal(
                  mu=F.zeros_like(dummy_tensor),
                  sigma=F.ones_like(dummy_tensor),
                  dtype=dtype,
              )
  
              cov_W = F.linalg_gemm2(
                  W, samples_W.expand_dims(axis=-1)
              ).squeeze(axis=-1)
  
              samples = mu + cov_D + cov_W
          else:
              samples = mu + cov_D
  
          return samples
  
      return _sample_multiple(
          s, mu=self.mu, D=self.D, W=self.W, num_samples=num_samples
      )
  
imports: import math
  from typing import Optional, Tuple
  import numpy
  from mxnet import gluon
  from gluonts.core.component import validated
  from gluonts.mx import Tensor
  from .distribution import Distribution, _sample_multiple, getF
  from .distribution_output import ArgProj, DistributionOutput, AffineTransformedDistribution
label_desc: Use image node_id 9 for calling the LowrankMultivariateGaussian obj's underlying member method code with example usage: obj.sample_rep(num_samples, dtype) and returns: _sample_multiple, samples