class_docstr: The Two-Piece Student's t-distribution.
  
  This distribution generalizes the Student's t-distribution with an additional
  shape parameter. Under the general formulation proposed by [Fernández and
  Steel (1998)][1], it is parameterized by degree of freedom `df`, location
  `loc`, scale `scale`, and skewness `skewness`. If `skewness` is above one,
  the distribution becomes right-skewed (or positively skewed). If `skewness`
  is greater than zero and less than one, the distribution becomes left-skewed
  (or negatively skewed). The Student's t-distribution is retrieved when
  `skewness` is equal to one.
  
  This distribution is also called the Skewed Student distribution [Fernández
  and Steel (1998)][1] and the Skew T Type 3 (ST3) distribution [(Rigby et al.,
  2019, Section 18.4.14, p414)][2].
  
  #### Mathematical details
  
  The probability density function (pdf) is,
  
  ```none
  pdf(x; df, loc, scale, skewness) =
      k * t_pdf(y * skewness; df, 0, 1), when x < loc
      k * t_pdf(y / skewness; df, 0, 1), when x >= loc
  where
      k = (2 * skewness) / ((1 + skewness**2) * scale)
      y = (x - loc) / scale
  ```
  
  where `df` is the degree of freedom, `loc` is the location, `scale` is the
  scale, `skewness` is the shape parameter, and `t_pdf(x; df, 0, 1)` is the pdf
  of the Student's t-distribution with `df` degree of freedom, zero mean, and
  unit scale.
  
  The cumulative distribution function (cdf) is,
  
  ```none
  cdf(x; df, loc, scale, skewness) =
      k0 * t_cdf(y * skewness; df, 0, 1), when x < loc
      k1 + k2 * (t_cdf(y / skewness; df, 0, 1) - 0.5), when x >= loc
  where
      k0 = 2 / (1 + skewness**2)
      k1 = 1 / (1 + skewness**2)
      k2 = (2 * skewness**2) / (1 + skewness**2)
      y = (x - loc) / scale
  ```
  
  where `t_cdf(x; df, 0, 1)` is the cdf of the Student's t-distribution with
  `df` degree of freedom, zero mean, and unit scale.
  
  The quantile function (inverse cdf) is,
  
  ```none
  quantile(p; loc, scale, skewness) =
      loc + s0 * t_quantile(x0; df, 0, 1), when p <= 1 / (1 + skewness**2)
      loc + s1 * t_quantile(x1; df, 0, 1), when p > 1 / (1 + skewness**2)
  where
      s0 = scale / skewness
      s1 = scale * skewness
      x0 = (p * (1 + skewness**2)) / 2
      x1 = (p * (1 + skewness**2) - 1 + skewness**2) / (2 * skewness**2)
      y = (x - loc) / scale
  ```
  
  where `t_quantile(x; df, 0, 1)` is the quantile function of the Student's
  t-distribution with `df` degree of freedom, zero mean, and unit scale.
  
  The mean and variance are, respectively,
  
  ```none
  mean(df, loc, scale, skewness) =
      loc + scale * m, when df > 1
      NaN, when df <= 1
  variance(df, loc, scale, skewness) =
      scale**2 * (r * (skewness**2 + 1 / skewness**2 - 1) - m**2), when df > 2
      infinity, when 1 < df <= 2
      NaN, when df <= 1
  where
      r = df / (df - 2)
      m = (2 * sqrt(df) * (skewness - 1 / skewness)) / (
          (df - 1) * Beta(0.5, 0.5 * df))
  ```
  
  The Two-Piece Student's t-distribution is a member of the [location-scale
  family][https://en.wikipedia.org/wiki/Location-scale_family]: it can be
  constructed as,
  
  ```none
  Z ~ StudentT(df=df, loc=0, scale=1)
  W ~ Bernoulli(probs=1 / (1 + skewness**2))
  Y = (1 - W) * |Z| * skewness - W * |Z| / skewness
  X = loc + scale * Y
  ```
  
  #### Examples
  
  Example of initialization of one distribution.
  
  ```python
  import tensorflow_probability as tfp
  tfd = tfp.distributions
  
  # Define a single scalar Two-Piece Student's t-distribution.
  dist = tfd.TwoPieceStudentT(df=6., loc=3., scale=10., skewness=0.75)
  
  # Evaluate the cdf at 1, returning a scalar.
  dist.cdf(1.)
  ```
  
  Example of initialization of a batch of distributions. Arguments are
  broadcast when possible.
  
  ```python
  # Define a batch of three scalar valued Two-Piece Student's t-distribution.
  # They have degree of freedom 6, mean 3, scale 10, but different skewnesses.
  dist = tfd.TwoPieceStudentT(
      df=6., loc=3., scale=10., skewness=[0.75, 1., 1.33])
  
  # Get 2 samples, returning a 2 x 3 tensor.
  value = dist.sample(2)
  
  # Evaluate the pdf of the distributions on the same points, value,
  # returning a 2 x 3 tensor.
  dist.prob(value)
  ```
  
  #### References
  
  [1]: Carmen Fernández and Mark F. J. Steel. On Bayesian modeling of fat tails
       and skewness. _Journal of the American Statistical Association_, 93(441),
       359-371, 1998.
  
  [2]: Robert A. Rigby et al. _Distributions for modeling location, scale, and
       shape: Using GAMLSS in R_. Chapman and Hall/CRC, 2019.
code: def _parameter_properties(cls, dtype, num_classes=None):
      return dict(
          df=parameter_properties.ParameterProperties(
              default_constraining_bijector_fn=(
                  lambda: softplus_bijector.Softplus(
                      low=dtype_util.eps(dtype)
                  )
              )
          ),
          loc=parameter_properties.ParameterProperties(),
          scale=parameter_properties.ParameterProperties(
              default_constraining_bijector_fn=(
                  lambda: softplus_bijector.Softplus(
                      low=dtype_util.eps(dtype)
                  )
              )
          ),
          skewness=parameter_properties.ParameterProperties(
              default_constraining_bijector_fn=(
                  lambda: softplus_bijector.Softplus(
                      low=dtype_util.eps(dtype)
                  )
              )
          ),
      )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import identity
  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.distributions import student_t
  from tensorflow_probability.python.distributions import two_piece_normal
  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 prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.math import special
  from tensorflow_probability.python.math.numeric import log1psquare
label_desc: Use image node_id 2 for calling the TwoPieceStudentT obj's underlying member method code with example usage: obj._parameter_properties(cls, dtype, num_classes) and returns: dict