tff.analytics.heavy_hitters.iblt.IbltTensorEncoder
Stay organized with collections
Save and categorize content based on your preferences.
Encodes the strings into an IBLT data structure.
Inherits From: IbltEncoder
tff.analytics.heavy_hitters.iblt.IbltTensorEncoder(
value_shape: Sequence[int], *args, **kwargs
)
Args |
value_shape
|
Shape of the values.
|
*args
|
See IbltEncoder.
|
**kwargs
|
See IbltEncoder.
|
Methods
compute_chunks
View source
compute_chunks(
input_strings
)
Returns Tensor containing integer chunks for input strings.
Args |
input_strings
|
A tensor of strings.
|
Returns |
A 2D tensor with rows consisting of integer chunks corresponding to the
string indexed by the row and a trimmed input_strings that can fit in
the IBLT.
|
compute_iblt
View source
@tf.function
compute_iblt(
input_strings: tf.Tensor, input_values: tf.Tensor
) -> tuple[tf.Tensor, tf.Tensor]
Returns Tensor containing the values of the IBLT data structure.
Args |
input_strings
|
A 1D tensor of strings.
|
input_values
|
A tensor of shape (num_input_strings, value_shape)
containing values for each string.
|
Returns |
A tuple of tensors where the first one is of shape
[repetitions, table_size, num_chunks+2] whose value at index (r, h, c)
corresponds to chunk c of the keys if c < num_chunks , to the counts if
c == num_chunks , and to the checks if c == num_chunks + 1 . The second
one is of shape [repetitions, table_size, product(value_shape)] and
contains the tensor values at each key.
|
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.IbltTensorEncoder\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\nEncodes the strings into an IBLT data structure.\n\nInherits From: [`IbltEncoder`](../../../../tff/analytics/heavy_hitters/iblt/IbltEncoder) \n\n tff.analytics.heavy_hitters.iblt.IbltTensorEncoder(\n value_shape: Sequence[int], *args, **kwargs\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|----------------------|\n| `value_shape` | Shape of the values. |\n| `*args` | See IbltEncoder. |\n| `**kwargs` | See IbltEncoder. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `compute_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 compute_chunks(\n input_strings\n )\n\nReturns Tensor containing integer chunks for input strings.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----------------|----------------------|\n| `input_strings` | A tensor of strings. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A 2D tensor with rows consisting of integer chunks corresponding to the string indexed by the row and a trimmed `input_strings` that can fit in the IBLT. ||\n\n\u003cbr /\u003e\n\n### `compute_iblt`\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 compute_iblt(\n input_strings: tf.Tensor, input_values: tf.Tensor\n ) -\u003e tuple[tf.Tensor, tf.Tensor]\n\nReturns Tensor containing the values of the IBLT data structure.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----------------|-----------------------------------------------------------------------------------------|\n| `input_strings` | A 1D tensor of strings. |\n| `input_values` | A tensor of shape `(num_input_strings, value_shape)` containing values for each string. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A tuple of tensors where the first one is of shape `[repetitions, table_size, num_chunks+2]` whose value at index `(r, h, c)` corresponds to chunk `c` of the keys if `c \u003c num_chunks`, to the counts if `c == num_chunks`, and to the checks if `c == num_chunks + 1`. The second one is of shape `[repetitions, table_size, product(value_shape)]` and contains the tensor values at each key. ||\n\n\u003cbr /\u003e"]]