class_docstr: InverseGamma distribution.
  
  The `InverseGamma` distribution is defined over positive real numbers using
  parameters `concentration` (aka "alpha") and `scale` (aka "beta").
  
  #### Mathematical Details
  
  The probability density function (pdf) is,
  
  ```none
  pdf(x; alpha, beta, x > 0) = x**(-alpha - 1) exp(-beta / x) / Z
  Z = Gamma(alpha) beta**-alpha
  ```
  
  where:
  
  * `concentration = alpha`,
  * `scale = beta`,
  * `Z` is the normalizing constant, and,
  * `Gamma` is the [gamma function](
    https://en.wikipedia.org/wiki/Gamma_function).
  
  The cumulative density function (cdf) is,
  
  ```none
  cdf(x; alpha, beta, x > 0) = GammaInc(alpha, beta / x) / Gamma(alpha)
  ```
  
  where `GammaInc` is the [upper incomplete Gamma function](
  https://en.wikipedia.org/wiki/Incomplete_gamma_function).
  
  The parameters can be intuited via their relationship to mean and variance
  when these moments exist,
  
  ```none
  mean = beta / (alpha - 1)                           when alpha > 1
  variance = beta**2 / (alpha - 1)**2 / (alpha - 2)   when alpha > 2
  ```
  
  i.e., under the same conditions:
  
  ```none
  alpha = mean**2 / variance + 2
  beta = mean * (mean**2 / variance + 1)
  ```
  
  Distribution parameters are automatically broadcast in all functions; see
  examples for details.
  
  Samples of this distribution are reparameterized (pathwise differentiable).
  The derivatives are computed using the approach described in the paper
  
  [Michael Figurnov, Shakir Mohamed, Andriy Mnih.
  Implicit Reparameterization Gradients, 2018](https://arxiv.org/abs/1805.08498)
  
  #### Examples
  
  ```python
  tfd = tfp.distributions
  dist = tfd.InverseGamma(concentration=3.0, scale=2.0)
  dist2 = tfd.InverseGamma(concentration=[3.0, 4.0], scale=[2.0, 3.0])
  ```
  
  Compute the gradients of samples w.r.t. the parameters:
  
  ```python
  tfd = tfp.distributions
  concentration = tf.constant(3.0)
  scale = tf.constant(2.0)
  dist = tfd.InverseGamma(concentration, scale)
  samples = dist.sample(5)  # Shape [5]
  loss = tf.reduce_mean(tf.square(samples))  # Arbitrary loss function
  # Unbiased stochastic gradients of the loss function
  grads = tf.gradients(loss, [concentration, scale])
  ```
class_docstr_tok: ["InverseGamma","distribution",".","The","`","InverseGamma","`","distribution","is","defined","over","positive","real","numbers","using","parameters","`","concentration","`","(","aka","``","alpha","''",")","and","`","scale","`","(","aka","``","beta","''",")",".","#","#","#","#","Mathematical","Details","The","probability","density","function","(","pdf",")","is",",","``","`","none","pdf","(","x",";","alpha",",","beta",",","x",">","0",")","=","x","*","*","(","-alpha","-","1",")","exp","(","-beta","\/","x",")","\/","Z","Z","=","Gamma","(","alpha",")","beta","*","*","-alpha","``","`","where",":","*","`","concentration","=","alpha","`",",","*","`","scale","=","beta","`",",","*","`","Z","`","is","the","normalizing","constant",",","and",",","*","`","Gamma","`","is","the","[","gamma","function","]","(","https",":","\/\/en.wikipedia.org\/wiki\/Gamma_function",")",".","The","cumulative","density","function","(","cdf",")","is",",","``","`","none","cdf","(","x",";","alpha",",","beta",",","x",">","0",")","=","GammaInc","(","alpha",",","beta","\/","x",")","\/","Gamma","(","alpha",")","``","`","where","`","GammaInc","`","is","the","[","upper","incomplete","Gamma","function","]","(","https",":","\/\/en.wikipedia.org\/wiki\/Incomplete_gamma_function",")",".","The","parameters","can","be","intuited","via","their","relationship","to","mean","and","variance","when","these","moments","exist",",","``","`","none","mean","=","beta","\/","(","alpha","-","1",")","when","alpha",">","1","variance","=","beta","*","*","2","\/","(","alpha","-","1",")","*","*","2","\/","(","alpha","-","2",")","when","alpha",">","2","``","`","i.e.",",","under","the","same","conditions",":","``","`","none","alpha","=","mean","*","*","2","\/","variance","+","2","beta","=","mean","*","(","mean","*","*","2","\/","variance","+","1",")","``","`","Distribution","parameters","are","automatically","broadcast","in","all","functions",";","see","examples","for","details",".","Samples","of","this","distribution","are","reparameterized","(","pathwise","differentiable",")",".","The","derivatives","are","computed","using","the","approach","described","in","the","paper","[","Michael","Figurnov",",","Shakir","Mohamed",",","Andriy","Mnih",".","Implicit","Reparameterization","Gradients",",","2018","]","(","https",":","\/\/arxiv.org\/abs\/1805.08498",")","#","#","#","#","Examples","``","`","python","tfd","=","tfp.distributions","dist","=","tfd.InverseGamma","(","concentration=3.0",",","scale=2.0",")","dist2","=","tfd.InverseGamma","(","concentration=","[","3.0",",","4.0","]",",","scale=","[","2.0",",","3.0","]",")","``","`","Compute","the","gradients","of","samples","w.r.t",".","the","parameters",":","``","`","python","tfd","=","tfp.distributions","concentration","=","tf.constant","(","3.0",")","scale","=","tf.constant","(","2.0",")","dist","=","tfd.InverseGamma","(","concentration",",","scale",")","samples","=","dist.sample","(","5",")","#","Shape","[","5","]","loss","=","tf.reduce_mean","(","tf.square","(","samples",")",")","#","Arbitrary","loss","function","#","Unbiased","stochastic","gradients","of","the","loss","function","grads","=","tf.gradients","(","loss",",","[","concentration",",","scale","]",")","``","`"]
code: def _log_prob(self, x):
      concentration = tf.convert_to_tensor(self.concentration)
      scale = tf.convert_to_tensor(self.scale)
      unnormalized_prob = (
          -(1.0 + concentration) * tf.math.log(x) - scale / x
      )
      normalization = tf.math.lgamma(
          concentration
      ) - concentration * tf.math.log(scale)
      return unnormalized_prob - normalization
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import reciprocal
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.math import special
label_desc: Use image node_id 8 for calling the InverseGamma obj's underlying member method code with example usage: obj._log_prob(x) and returns: unknown