class_docstr: Distribution class for the model MQF2 proposed in the paper
  ``Multivariate Quantile Function Forecaster``
  by Kan, Aubet, Januschowski, Park, Benidis, Ruthotto, Gasthaus
  Parameters
  ----------
  picnn
      A SequentialNet instance of a
      partially input convex neural network (picnn)
  hidden_state
      hidden_state obtained by unrolling the RNN encoder
      shape = (batch_size, context_length, hidden_size) in training
      shape = (batch_size, hidden_size) in inference
  prediction_length
      Length of the prediction horizon
  is_energy_score
      If True, use energy score as objective function
      otherwise use maximum likelihood as
      objective function (normalizing flows)
  es_num_samples
      Number of samples drawn to approximate the energy score
  beta
      Hyperparameter of the energy score (power of the two terms)
  threshold_input
      Clamping threshold of the (scaled) input when maximum
      likelihood is used as objective function
      this is used to make the forecaster more robust
      to outliers in training samples
  validate_args
      Sets whether validation is enabled or disabled
      For more details, refer to the descriptions in
      torch.distributions.distribution.Distribution
docstr: Generates the sample paths
  Parameters
  ----------
  sample_shape
      Shape of the samples
  Returns
  -------
  sample_paths
      Tesnor of shape (batch_size, *sample_shape, prediction_length)
docstr_tok: ["Generates","the","sample","paths","Parameters","--","--","--","--","--","sample_shape","Shape","of","the","samples","Returns","--","--","--","-","sample_paths","Tesnor","of","shape","(","batch_size",",","*","sample_shape",",","prediction_length",")"]
code: def rsample(
      self, sample_shape: torch.Size = torch.Size()
  ) -> torch.Tensor:
      """
      Generates the sample paths
      Parameters
      ----------
      sample_shape
          Shape of the samples
      Returns
      -------
      sample_paths
          Tesnor of shape (batch_size, *sample_shape, prediction_length)
      """
  
      numel_batch = self.numel_batch
      prediction_length = self.prediction_length
  
      num_samples_per_batch = MQF2Distribution.get_numel(sample_shape)
      num_samples = num_samples_per_batch * numel_batch
  
      hidden_state_repeat = self.hidden_state.repeat_interleave(
          repeats=num_samples_per_batch, dim=0
      )
  
      alpha = torch.rand(
          (num_samples, prediction_length),
          dtype=self.hidden_state.dtype,
          device=self.hidden_state.device,
          layout=self.hidden_state.layout,
      ).clamp(
          min=1e-4, max=1 - 1e-4
      )  # prevent numerical issues by preventing to sample beyond 0.1% and 99.9% percentiles
  
      samples = (
          self.quantile(alpha, hidden_state_repeat)
          .reshape((numel_batch,) + sample_shape + (prediction_length,))
          .transpose(0, 1)
      )
      return samples
  
imports: from typing import List, Optional, Tuple
  from cpflows.flows import DeepConvexFlow, SequentialFlow
  import torch
  from torch.distributions import AffineTransform, Distribution, Normal, TransformedDistribution
  import torch.nn.functional
label_desc: Use image node_id 6 for calling the MQF2Distribution obj's underlying member method code with example usage: obj.rsample(sample_shape) and returns: samples