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: Returns an instance of `LowrankMultivariateGaussian` after fitting
  parameters to the given data. Only the special case of `rank` = 0 is
  supported at the moment.
  
  Parameters
  ----------
  F
  samples
      Tensor of shape (num_samples, batch_size, seq_len, target_dim)
  rank
      Rank of W
  
  Returns
  -------
  Distribution instance of type `LowrankMultivariateGaussian`.
docstr_tok: ["Returns","an","instance","of","`","LowrankMultivariateGaussian","`","after","fitting","parameters","to","the","given","data",".","Only","the","special","case","of","`","rank","`","=","0","is","supported","at","the","moment",".","Parameters","--","--","--","--","--","F","samples","Tensor","of","shape","(","num_samples",",","batch_size",",","seq_len",",","target_dim",")","rank","Rank","of","W","Returns","--","--","--","-","Distribution","instance","of","type","`","LowrankMultivariateGaussian","`","."]
code: def fit(cls, F, samples: Tensor, rank: int = 0) -> Distribution:
      """
      Returns an instance of `LowrankMultivariateGaussian` after fitting
      parameters to the given data. Only the special case of `rank` = 0 is
      supported at the moment.
  
      Parameters
      ----------
      F
      samples
          Tensor of shape (num_samples, batch_size, seq_len, target_dim)
      rank
          Rank of W
  
      Returns
      -------
      Distribution instance of type `LowrankMultivariateGaussian`.
  
      """
      # TODO: Implement it for the general case: `rank` > 0
      assert (
          rank == 0
      ), "Fit is not only implemented for the case rank = 0!"
  
      # Compute mean and variances
      mu = samples.mean(axis=0)
      var = F.square(samples - samples.mean(axis=0)).mean(axis=0)
      return cls(dim=samples.shape[-1], rank=rank, mu=mu, D=var)
  
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 10 for calling the LowrankMultivariateGaussian obj's underlying member method code with example usage: obj.fit(cls, F, samples, rank) and returns: cls