class_docstr: Generalised Pareto distribution.
  
  Parameters
  ----------
  xi
      Tensor containing the xi (heaviness) shape parameters. The tensor is
      of shape (*batch_shape, 1)
  beta
      Tensor containing the beta scale parameters. The tensor is of
      shape (*batch_shape, 1)
docstr: Log probability for a tensor x of shape (*batch_shape)
docstr_tok: ["Log","probability","for","a","tensor","x","of","shape","(","*","batch_shape",")"]
code: def log_prob(self, x):
      """
      Log probability for a tensor x of shape (*batch_shape)
      """
      # both xi and beta have shape (*batch_shape)
      # and so do all the elements bellow
  
      x = x.unsqueeze(dim=-1)
  
      logp = -self.beta.log().double()
      logp += torch.where(
          self.xi == torch.zeros_like(self.xi),
          -x / self.beta,
          -(1 + 1.0 / (self.xi + 1e-6))
          * torch.log(1 + self.xi * x / self.beta),
      )
      logp = torch.where(
          x < torch.zeros_like(x),
          (-np.inf * torch.ones_like(x)).double(),
          logp,
      )
      return logp.squeeze(dim=-1)
  
imports: from numbers import Number
  from typing import Dict, Optional, Tuple, cast
  import numpy
  import torch
  from torch.distributions import Distribution, constraints
  from torch.distributions.utils import broadcast_all
  from gluonts.core.component import validated
  from .distribution_output import DistributionOutput
label_desc: Use image node_id 5 for calling the GeneralizedPareto obj's underlying member method code with example usage: obj.log_prob(x) and returns: logp