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: Computes the log likelihood  log(g(z)) + logdet(dg(z)/dz),
  where g is the gradient of the picnn
  Parameters
  ----------
  z
      A batch of time series with shape
      (batch_size, context_length + prediciton_length - 1)
  Returns
  -------
  loss
      Tesnor of shape (batch_size * context_length,)
docstr_tok: ["Computes","the","log","likelihood","log","(","g","(","z",")",")","+","logdet","(","dg","(","z",")","\/dz",")",",","where","g","is","the","gradient","of","the","picnn","Parameters","--","--","--","--","--","z","A","batch","of","time","series","with","shape","(","batch_size",",","context_length","+","prediciton_length","-","1",")","Returns","--","--","--","-","loss","Tesnor","of","shape","(","batch_size","*","context_length",",",")"]
code: def log_prob(self, z: torch.Tensor) -> torch.Tensor:
      """
      Computes the log likelihood  log(g(z)) + logdet(dg(z)/dz),
      where g is the gradient of the picnn
      Parameters
      ----------
      z
          A batch of time series with shape
          (batch_size, context_length + prediciton_length - 1)
      Returns
      -------
      loss
          Tesnor of shape (batch_size * context_length,)
      """
  
      z = torch.clamp(
          z, min=-self.threshold_input, max=self.threshold_input
      )
      z = self.stack_sliding_view(z)
  
      loss = self.picnn.logp(
          z, self.hidden_state.reshape(-1, self.hidden_state.shape[-1])
      )
  
      return loss
  
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 4 for calling the MQF2Distribution obj's underlying member method code with example usage: obj.log_prob(z) and returns: loss