code: def test_LogNormalDistributionLoss(center, transformation):
      mean = 2.0
      std = 0.2
      n = 100000
      target = LogNormalDistributionLoss.distribution_class(
          loc=mean, scale=std
      ).sample((n,))
      normalizer = TorchNormalizer(
          center=center, transformation=transformation
      )
      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 = LogNormalDistributionLoss()
  
      if transformation not in ["log", "log1p"]:
          with pytest.raises(AssertionError):
              rescaled_parameters = loss.rescale_parameters(
                  parameters,
                  target_scale=target_scale,
                  encoder=normalizer,
              )
      else:
          rescaled_parameters = loss.rescale_parameters(
              parameters, target_scale=target_scale, encoder=normalizer
          )
          samples = loss.sample(rescaled_parameters, 1)
          assert torch.isclose(
              torch.as_tensor(mean),
              samples.log().mean(),
              atol=0.1,
              rtol=0.2,
          )
          if (
              center
          ):  # if not centered, softplus distorts std too much for testing
              assert torch.isclose(
                  torch.as_tensor(std),
                  samples.log().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 5 for calling a global function with example usage: test_LogNormalDistributionLoss(center, transformation) without return types