code: def test_MultivariateNormalDistributionLoss(center, transformation):
      normalizer = TorchNormalizer(
          center=center, transformation=transformation
      )
  
      mean = torch.tensor([1.0, 1.0])
      std = torch.tensor([0.2, 0.1])
      cov_factor = torch.tensor([[0.0], [0.0]])
      n = 1000000
  
      loss = MultivariateNormalDistributionLoss()
      target = loss.distribution_class(
          loc=mean, cov_diag=std**2, cov_factor=cov_factor
      ).sample((n,))
      target = normalizer.inverse_preprocess(target)
      target = target[:, 0]
      normalized_target = normalizer.fit_transform(target).view(1, -1)
      target_scale = normalizer.get_parameters().unsqueeze(0)
      scale = (
          torch.ones_like(normalized_target) * normalized_target.std()
      )
      parameters = torch.concat(
          [
              normalized_target[..., None],
              scale[..., None],
              torch.zeros((1, normalized_target.size(1), loss.rank)),
          ],
          dim=-1,
      )
  
      rescaled_parameters = loss.rescale_parameters(
          parameters, target_scale=target_scale, encoder=normalizer
      )
      samples = loss.sample(rescaled_parameters, 1)
      assert torch.isclose(
          target.mean(), samples.mean(), atol=3.0, rtol=0.5
      )
      if (
          center
      ):  # if not centered, softplus distorts std too much for testing
          assert torch.isclose(
              target.std(), samples.std(), atol=0.1, rtol=0.7
          )
  
file_path: pytorch-forecasting/tests/test_metrics.py
imports: import itertools
  import numpy
  import pytest
  import torch
  from torch.nn.utils import rnn
  from pytorch_forecasting.data.encoders import TorchNormalizer
  from pytorch_forecasting.metrics import MAE, SMAPE, BetaDistributionLoss, ImplicitQuantileNetworkDistributionLoss, LogNormalDistributionLoss, MultivariateNormalDistributionLoss, NegativeBinomialDistributionLoss, NormalDistributionLoss
  from pytorch_forecasting.metrics.base_metrics import AggregationMetric, CompositeMetric
label_desc: Use image node_id 8 for calling a global function with example usage: test_MultivariateNormalDistributionLoss(center, transformation) without return types