code: def test_BetaDistributionLoss(center, transformation):
      initial_mean = 0.1
      initial_shape = 10
      n = 100000
      target = (
          BetaDistributionLoss()
          .map_x_to_distribution(
              torch.tensor([initial_mean, initial_shape])
          )
          .sample((n,))
      )
      normalizer = TorchNormalizer(
          center=center, transformation=transformation
      )
      normalized_target = normalizer.fit_transform(target).view(1, -1)
      target_scale = normalizer.get_parameters().unsqueeze(0)
      parameters = torch.stack(
          [normalized_target, 1.0 * torch.ones_like(normalized_target)],
          dim=-1,
      )
      loss = BetaDistributionLoss()
  
      if transformation not in ["logit"] or not center:
          with pytest.raises(AssertionError):
              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(initial_mean),
              samples.mean(),
              atol=0.01,
              rtol=0.01,
          )  # mean=0.1
          assert torch.isclose(
              target.std(), samples.std(), atol=0.02, rtol=0.3
          )
  
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 7 for calling a global function with example usage: test_BetaDistributionLoss(center, transformation) without return types