code: def test_distribution():
      """
      Makes sure additional tensors can be accessed and have expected shapes
      """
      prediction_length = ds_info.prediction_length
  
      # todo adapt loader to anomaly detection use-case
      batch_size = 2
      num_samples = 3
  
      estimator = DeepAREstimator(
          freq=freq,
          prediction_length=prediction_length,
          trainer=Trainer(epochs=2, num_batches_per_epoch=1),
          distr_output=StudentTOutput(),
          batch_size=batch_size,
      )
  
      train_output = estimator.train_model(train_ds, test_ds)
  
      training_data_loader = estimator.create_training_data_loader(
          estimator.create_transformation().apply(train_ds)
      )
  
      seq_len = 2 * ds_info.prediction_length
  
      for data_entry in islice(training_data_loader, 1):
          input_names = get_hybrid_forward_input_names(
              type(train_output.trained_net)
          )
  
          distr = train_output.trained_net.distribution(
              *[data_entry[k] for k in input_names]
          )
  
          assert distr.sample(num_samples).shape == (
              num_samples,
              batch_size,
              seq_len,
          )
  
imports: from itertools import islice
  from gluonts.dataset.artificial import constant_dataset
  from gluonts.mx import DeepAREstimator
  from gluonts.mx.distribution import StudentTOutput
  from gluonts.mx.trainer import Trainer
  from gluonts.mx.util import get_hybrid_forward_input_names
label_desc: Use image node_id 1 for calling a global function with example usage: test_distribution() without return types