# tfc.ops.soft_round

<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/ops/round_ops.py#L46-L75) |

Differentiable approximation to `round`.

#### View aliases


**Main aliases**

[`tfc.soft_round`](https://www.tensorflow.org/api_docs/python/tfc/ops/soft_round)

<br />

    tfc.ops.soft_round(
        x, alpha, eps=0.001
    )

Larger alphas correspond to closer approximations of the round function.
If alpha is close to zero, this function reduces to the identity.

This is described in Sec. 4.1. in the paper
> "Universally Quantized Neural Compression"  
>
> Eirikur Agustsson \& Lucas Theis  
>
> <https://arxiv.org/abs/2006.09952>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor). Inputs to the rounding function. |
| `alpha` | Float or [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor). Controls smoothness of the approximation. |
| `eps` | Float. Threshold below which `soft_round` will return identity. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) ||

<br />