# tfc.ops.run_length_encode

<br />

Encodes `data` using run-length coding.

#### View aliases


**Main aliases**

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

<br />

    tfc.ops.run_length_encode(
        data,
        run_length_code,
        magnitude_code,
        use_run_length_for_non_zeros,
        name=None
    )

This op implements a superset of RunLengthGammaEncode, which is equivalent to
calling RunLengthEncode with run_length_code = -1, magnitude_code = -1, and
use_run_length_for_non_zeros = false.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `data` | A `Tensor` of type `int32`. An int32 tensor of values to be encoded. |
| `run_length_code` | An `int`. If \>= 0, use Rice code with this parameter to encode run lengths, else use Elias gamma code. |
| `magnitude_code` | An `int`. If \>= 0, use Rice code with this parameter to encode magnitudes, else use Elias gamma code. |
| `use_run_length_for_non_zeros` | A `bool`. If true, alternate between coding run lengths of zeros and non-zeros. If false, only encode run lengths of zeros, and encode non-zeros one by one. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Tensor` of type `string`. An encoded scalar string. ||

<br />