code: def test_NormalDistributionLoss(center, transformation):
      mean = 1.0
      std = 0.1
      n = 100000
      target = NormalDistributionLoss.distribution_class(
          loc=mean, scale=std
      ).sample((n,))
      normalizer = TorchNormalizer(
          center=center, transformation=transformation
      )
      if transformation in ["log", "log1p", "relu", "softplus"]:
          target = target.abs()
      target = normalizer.inverse_preprocess(target)
  
      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.stack(
          [normalized_target, scale],
          dim=-1,
      )
      loss = NormalDistributionLoss()
      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=0.1, 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 4 for calling a global function with example usage: test_NormalDistributionLoss(center, transformation) without return types