# tfc.distributions.upper_tail

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/distributions/helpers.py#L186-L219) |

Approximates upper tail quantile for range coding.

#### View aliases


**Main aliases**

[`tfc.upper_tail`](https://www.tensorflow.org/api_docs/python/tfc/distributions/upper_tail)

<br />

    tfc.distributions.upper_tail(
        distribution, tail_mass
    )

For range coding of random variables, the distribution tails need special
handling, because range coding can only handle alphabets with a finite
number of symbols. This method returns a cut-off location for the upper
tail, such that approximately `tail_mass` probability mass is contained in
the tails (together). The tails are then handled by using the 'overflow'
functionality of the range coder implementation (using an Elias gamma code).

<br />

<br />

<br />

| ## Args ||
|---|---|
| `distribution` | A [`tfp.distributions.Distribution`](https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/Distribution) object. |
| `tail_mass` | Float between 0 and 1. Desired probability mass for the tails. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) broadcastable to shape `self.batch_shape` containing the approximate upper tail quantiles for each scalar distribution. ||

<br />