class_docstr: The scalar GeneralizedExtremeValue distribution.
  
  This distribution is a common choice for modeling the maximum value of a
  suitably normalized sequence of random variables. This distribution is closely
  related to Gumbel and Weibull distributions, with Gumbel in particular being a
  special case of this distribution with `concentration = 0`.
  
  #### Mathematical details
  
  The probability density function (pdf) of this distribution is,
  
  ```none
  pdf(x; loc, scale, conc) = t(x; loc, scale, conc) ** (1 + conc) * exp(
  -t(x; loc, scale, conc) ) / scale
  where t(x) =
    * (1 + conc * (x - loc) / scale) ) ** (-1 / conc) when conc != 0;
    * exp(-(x - loc) / scale) when conc = 0.
  ```
  
  where `concentration = conc`.
  
  The cumulative density function of this distribution is,
  
  ```cdf(x; mu, sigma) = exp(-t(x))```
  
  The generalized extreme value distribution is a member of the
  [location-scale family](https://en.wikipedia.org/wiki/Location-scale_family),
  i.e., it can be constructed as,
  
  ```none
  X ~ GeneralizedExtremeValue(loc=0, scale=1, concentration=conc)
  Y = loc + scale * X
  ```
  
  #### Examples
  
  Examples of initialization of one or a batch of distributions.
  
  ```python
  tfd = tfp.distributions
  
  # Define a single scalar generalized extreme values distribution.
  dist = tfd.GeneralizedExtremeValue(loc=0., scale=3., concentration=0.9)
  
  # Evaluate the cdf at 1, returning a scalar.
  dist.cdf(1.)
  
  # Define a batch of two scalar valued generalized extreme values.
  # The first has loc 1 and scale 11, the second 2 and 22.
  dist = tfd.GeneralizedExtremeValue(loc=[1, 2.], scale=[11, 22.])
  
  # Evaluate the pdf of the first distribution on 0, and the second on 1.5,
  # returning a length two tensor.
  dist.prob([0, 1.5])
  
  # Get 3 samples, returning a 3 x 2 tensor.
  dist.sample([3])
  ```
  
  Arguments are broadcast when possible.
  
  ```python
  # Define a batch of two scalar valued GEV distributions.
  # Both have location 1, but different concentrations.
  dist = tfd.GeneralizedExtremeValue(loc=1., scale=1, concentration=[0, 0.9])
  
  # Evaluate the pdf of both distributions on the same point, 3.0,
  # returning a length 2 tensor.
  dist.prob(3.0)
  ```
class_docstr_tok: ["The","scalar","GeneralizedExtremeValue","distribution",".","This","distribution","is","a","common","choice","for","modeling","the","maximum","value","of","a","suitably","normalized","sequence","of","random","variables",".","This","distribution","is","closely","related","to","Gumbel","and","Weibull","distributions",",","with","Gumbel","in","particular","being","a","special","case","of","this","distribution","with","`","concentration","=","0","`",".","#","#","#","#","Mathematical","details","The","probability","density","function","(","pdf",")","of","this","distribution","is",",","``","`","none","pdf","(","x",";","loc",",","scale",",","conc",")","=","t","(","x",";","loc",",","scale",",","conc",")","*","*","(","1","+","conc",")","*","exp","(","-t","(","x",";","loc",",","scale",",","conc",")",")","\/","scale","where","t","(","x",")","=","*","(","1","+","conc","*","(","x","-","loc",")","\/","scale",")",")","*","*","(","-1","\/","conc",")","when","conc","!","=","0",";","*","exp","(","-","(","x","-","loc",")","\/","scale",")","when","conc","=","0",".","``","`","where","`","concentration","=","conc","`",".","The","cumulative","density","function","of","this","distribution","is",",","``","`","cdf","(","x",";","mu",",","sigma",")","=","exp","(","-t","(","x",")",")","``","`","The","generalized","extreme","value","distribution","is","a","member","of","the","[","location-scale","family","]","(","https",":","\/\/en.wikipedia.org\/wiki\/Location-scale_family",")",",","i.e.",",","it","can","be","constructed","as",",","``","`","none","X","~","GeneralizedExtremeValue","(","loc=0",",","scale=1",",","concentration=conc",")","Y","=","loc","+","scale","*","X","``","`","#","#","#","#","Examples","Examples","of","initialization","of","one","or","a","batch","of","distributions",".","``","`","python","tfd","=","tfp.distributions","#","Define","a","single","scalar","generalized","extreme","values","distribution",".","dist","=","tfd.GeneralizedExtremeValue","(","loc=0.",",","scale=3.",",","concentration=0.9",")","#","Evaluate","the","cdf","at","1",",","returning","a","scalar",".","dist.cdf","(","1",".",")","#","Define","a","batch","of","two","scalar","valued","generalized","extreme","values",".","#","The","first","has","loc","1","and","scale","11",",","the","second","2","and","22.","dist","=","tfd.GeneralizedExtremeValue","(","loc=","[","1",",","2",".","]",",","scale=","[","11",",","22",".","]",")","#","Evaluate","the","pdf","of","the","first","distribution","on","0",",","and","the","second","on","1.5",",","#","returning","a","length","two","tensor",".","dist.prob","(","[","0",",","1.5","]",")","#","Get","3","samples",",","returning","a","3","x","2","tensor",".","dist.sample","(","[","3","]",")","``","`","Arguments","are","broadcast","when","possible",".","``","`","python","#","Define","a","batch","of","two","scalar","valued","GEV","distributions",".","#","Both","have","location","1",",","but","different","concentrations",".","dist","=","tfd.GeneralizedExtremeValue","(","loc=1.",",","scale=1",",","concentration=","[","0",",","0.9","]",")","#","Evaluate","the","pdf","of","both","distributions","on","the","same","point",",","3.0",",","#","returning","a","length","2","tensor",".","dist.prob","(","3.0",")","``","`"]
code: def _log_prob(self, x):
      with tf.control_dependencies(
          self._gev_bijector._maybe_assert_valid_x(x)
      ):  # pylint: disable=protected-access
          scale = tf.convert_to_tensor(self.scale)
          z = (x - self.loc) / scale
  
          conc = tf.convert_to_tensor(self.concentration)
          equal_zero = tf.equal(conc, 0.0)
          safe_conc = tf.where(equal_zero, tf.ones_like(conc), conc)
          log_t = tf.where(
              equal_zero, -z, -tf.math.log1p(z * safe_conc) / safe_conc
          )
  
          result = (
              (conc + 1) * log_t - tf.exp(log_t) - tf.math.log(scale)
          )
          return tf.where(
              z * safe_conc <= -1.0,
              tf.constant(-np.inf, dtype=result.dtype),
              result,
          )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import gev_cdf
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensor_util
label_desc: Use image node_id 7 for calling the GeneralizedExtremeValue obj's underlying member method code with example usage: obj._log_prob(x) and returns: tf