# tensorflow::ops::ApproxTopK::Attrs

`#include <nn_ops.h>`

Optional attribute setters for [ApproxTopK](https://www.tensorflow.org/versions/r2.13/api_docs/cc/class/tensorflow/ops/approx-top-k#classtensorflow_1_1ops_1_1_approx_top_k).

## Summary

| ### Public attributes ||
|---|---|
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1a2e12712b3f25d850fa545035febe1395 = true` | `bool` |
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1a786a9dde050fc5167c170a5f27f070b1 = true` | `bool` |
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1a43167ac64091dad1ae850837f9420090 = 0.95f` | `float` |
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1abb2309a16e6565239360c9e81b77ad72 = -1` | `int64` |
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1ae0ecb7914b78269d39ce58be39810407 = -1` | `int64` |

| ### Public functions ||
|---|---|
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1a20a04cd935e0060ecc9541f336a23628(bool x)` | `TF_MUST_USE_RESULT https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs` When true, aggregates approximate results to top-k. |
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1ae8b4c952bb9e1f8f94aec45e4d6a4192(bool x)` | `TF_MUST_USE_RESULT https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs` When true, computes max-k; otherwise computes min-k. |
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1a07b77c933dc0d54d2ea53620bbea8c01(float x)` | `TF_MUST_USE_RESULT https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs` Recall target for the approximation. |
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1aa21c37d0c1a3344a4b7129fcadc67fb2(int64 x)` | `TF_MUST_USE_RESULT https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs` Integer dimension along which to search. |
| `https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs_1a03875e3f7f1ec201e9e8e060d891250b(int64 x)` | `TF_MUST_USE_RESULT https://www.tensorflow.org/versions/r2.13/api_docs/cc/struct/tensorflow/ops/approx-top-k/attrs#structtensorflow_1_1ops_1_1_approx_top_k_1_1_attrs` When set to a positive value, it overrides the size determined by `input[reduction_dim]` for evaluating the recall. |

## Public attributes

### aggregate_to_topk_

```
bool tensorflow::ops::ApproxTopK::Attrs::aggregate_to_topk_ = true
```

### is_max_k_

```
bool tensorflow::ops::ApproxTopK::Attrs::is_max_k_ = true
```

### recall_target_

```
float tensorflow::ops::ApproxTopK::Attrs::recall_target_ = 0.95f
```

### reduction_dimension_

```
int64 tensorflow::ops::ApproxTopK::Attrs::reduction_dimension_ = -1
```

### reduction_input_size_override_

```
int64 tensorflow::ops::ApproxTopK::Attrs::reduction_input_size_override_ = -1
```

## Public functions

### AggregateToTopk

```
TF_MUST_USE_RESULT Attrs tensorflow::ops::ApproxTopK::Attrs::AggregateToTopk(
  bool x
)
```
When true, aggregates approximate results to top-k.

When false, returns the approximate results. The number of the approximate results is implementation defined and is greater equals to the specified `k`.

Defaults to true

### IsMaxK

```
TF_MUST_USE_RESULT Attrs tensorflow::ops::ApproxTopK::Attrs::IsMaxK(
  bool x
)
```
When true, computes max-k; otherwise computes min-k.

Defaults to true

### RecallTarget

```
TF_MUST_USE_RESULT Attrs tensorflow::ops::ApproxTopK::Attrs::RecallTarget(
  float x
)
```
Recall target for the approximation.

[Range](https://www.tensorflow.org/versions/r2.13/api_docs/cc/class/tensorflow/ops/range#classtensorflow_1_1ops_1_1_range) in (0,1\]

Defaults to 0.95

### ReductionDimension

```
TF_MUST_USE_RESULT Attrs tensorflow::ops::ApproxTopK::Attrs::ReductionDimension(
  int64 x
)
```
Integer dimension along which to search.

Default: -1.

Defaults to -1

### ReductionInputSizeOverride

```
TF_MUST_USE_RESULT Attrs tensorflow::ops::ApproxTopK::Attrs::ReductionInputSizeOverride(
  int64 x
)
```
When set to a positive value, it overrides the size determined by `input[reduction_dim]` for evaluating the recall.

This option is useful when the given `input` is only a subset of the overall computation in SPMD or distributed pipelines, where the true input size cannot be deferred by the `input` shape.

Defaults to -1