# tff.analytics.count_distinct.build_federated_secure_max_computation

<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) |

Builds a [`tff.Computation`](https://www.tensorflow.org/federated/api_docs/python/tff/Computation) for computing max in a secure fashion.

    tff.analytics.count_distinct.build_federated_secure_max_computation() -> https://www.tensorflow.org/federated/api_docs/python/tff/Computation

Specifically, the returned computation consumes sketches at @CLIENTS and
returns the element-wise max of the inpt sketches @SERVER.

> [!NOTE]
> **Note:** this returned computation assumes the values to be maxed are in the range \[0, HLL_BIT_INDEX_TAIL+1\]. This function works by onehot encoding the values which allows us to sum the values securely and then infer the max based on the non-zero entries of the sum. This approach is feasible because the inputs are small non-negative integers. Generalizations of this function would require communication proportional to (upper_bound - lower_bound).

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tff.Computation`](https://www.tensorflow.org/federated/api_docs/python/tff/Computation) for computing max of client vectors. ||

<br />