tff.analytics.heavy_hitters.iblt.IbltTensorDecoder
Stay organized with collections
Save and categorize content based on your preferences.
Decodes the strings and counts stored in an IBLT data structure.
Inherits From: IbltDecoder
tff.analytics.heavy_hitters.iblt.IbltTensorDecoder(
iblt: tf.Tensor,
iblt_values: tf.Tensor,
value_shape: Sequence[int],
*args,
**kwargs
)
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.
|
Methods
decode_string_from_chunks
View source
decode_string_from_chunks(
chunks
)
Computes string from sequence of ints each encoding 'chunk_length' bytes.
Inverse of IBLTEncoder.compute_iblt
.
Args |
chunks
|
A tf.Tensor of num_chunks integers.
|
Returns |
A tf.Tensor with the string encoded in the chunks.
|
get_freq_estimates
View source
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.
Returns |
A dictionary containing a decoded key with its frequency and
tensor_values.
|
get_freq_estimates_tf
View source
@tf.function
get_freq_estimates_tf() -> tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]
Decodes key-value pairs from an IBLT.
Returns |
(out_strings, out_counts, out_tensor_values, num_not_decoded) where
out_strings is a tf.Tensor containing all the decoded strings,
out_counts is a tf.Tensor containing the counts of each string,
out_tensor_values is a tf.Tensor (of shape values_shape ) containing
a tf.Tensor of values for each string, and num_not_decoded is a
tf.Tensor with the number of items not decoded in the IBLT.
If self.value_shape is () , then out_tensor_values is also empty
(returned as a tf.constant([]) ).
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.analytics.heavy_hitters.iblt.IbltTensorDecoder\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [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) |\n\nDecodes the strings and counts stored in an IBLT data structure.\n\nInherits From: [`IbltDecoder`](../../../../tff/analytics/heavy_hitters/iblt/IbltDecoder) \n\n tff.analytics.heavy_hitters.iblt.IbltTensorDecoder(\n iblt: tf.Tensor,\n iblt_values: tf.Tensor,\n value_shape: Sequence[int],\n *args,\n **kwargs\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|------------------------------------------------------------------|\n| `iblt` | Tensor representing the IBLT computed by the IbltEncoder |\n| `iblt_values` | Tensor representing the IBLT values computed by the IbltEncoder. |\n| `value_shape` | Shape of the values tensor. |\n| `*args` | See IbltDecoder. |\n| `**kwargs` | See IbltDecoder. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `decode_string_from_chunks`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n decode_string_from_chunks(\n chunks\n )\n\nComputes string from sequence of ints each encoding 'chunk_length' bytes.\n\nInverse of `IBLTEncoder.compute_iblt`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------|-------------------------------------------------------------------------------------------------|\n| `chunks` | A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of `num_chunks` integers. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) with the string encoded in the chunks. ||\n\n\u003cbr /\u003e\n\n### `get_freq_estimates`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n get_freq_estimates() -\u003e tuple[dict[Optional[str], int], dict[Optional[str], np.ndarray]]\n\nDecodes key-value pairs from an IBLT.\n\nNote that this method only works for UTF-8 strings, and when running TF in\nEager mode.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A dictionary containing a decoded key with its frequency and tensor_values. ||\n\n\u003cbr /\u003e\n\n### `get_freq_estimates_tf`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n @tf.function\n get_freq_estimates_tf() -\u003e tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]\n\nDecodes key-value pairs from an IBLT.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| `(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. \u003cbr /\u003e If `self.value_shape is` `()`, then out_tensor_values is also empty (returned as a `tf.constant([])`). ||\n\n\u003cbr /\u003e"]]