# tff.analytics.heavy_hitters.iblt.IbltTensorDecoder

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |

Decodes the strings and counts stored in an IBLT data structure.

Inherits From: [`IbltDecoder`](https://www.tensorflow.org/federated/api_docs/python/tff/analytics/heavy_hitters/iblt/IbltDecoder)

    tff.analytics.heavy_hitters.iblt.IbltTensorDecoder(
        iblt: tf.Tensor,
        iblt_values: tf.Tensor,
        value_shape: Sequence[int],
        *args,
        **kwargs
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `iblt` | Tensor representing the IBLT computed by the IbltEncoder |
| `iblt_values` | Tensor representing the IBLT values computed by the IbltEncoder. |
| `value_shape` | Shape of the values tensor. |
| `*args` | See IbltDecoder. |
| `**kwargs` | See IbltDecoder. |

<br />

## Methods

### `decode_string_from_chunks`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    decode_string_from_chunks(
        chunks
    )

Computes string from sequence of ints each encoding 'chunk_length' bytes.

Inverse of `IBLTEncoder.compute_iblt`.

<br />

<br />

<br />

| Args ||
|---|---|
| `chunks` | A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of `num_chunks` integers. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) with the string encoded in the chunks. ||

<br />

### `get_freq_estimates`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    get_freq_estimates() -> tuple[dict[Optional[str], int], dict[Optional[str], np.ndarray]]

Decodes key-value pairs from an IBLT.

Note that this method only works for UTF-8 strings, and when running TF in
Eager mode.

<br />

<br />

<br />

| Returns ||
|---|---|
| A dictionary containing a decoded key with its frequency and tensor_values. ||

<br />

### `get_freq_estimates_tf`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    @tf.function
    get_freq_estimates_tf() -> tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]

Decodes key-value pairs from an IBLT.

<br />

<br />

<br />

| Returns ||
|---|---|
| `(out_strings, out_counts, out_tensor_values, num_not_decoded)` where `out_strings` is a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) containing all the decoded strings, `out_counts` is a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) containing the counts of each string, `out_tensor_values` is a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) (of shape `values_shape`) containing a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of values for each string, and `num_not_decoded` is a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) with the number of items not decoded in the IBLT. <br /> If `self.value_shape is` `()`, then out_tensor_values is also empty (returned as a `tf.constant([])`). ||

<br />