#include <nn_ops.h>
Returns min/max k values and their indices of the input operand in an approximate manner.
See https://arxiv.org/abs/2206.14286 for the algorithm details. This op is only optimized on TPU currently.
Args:
Optional attributes (see Attrs):
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.k.Returns:
Output values: The min/max k values along the reduction_dimension of the input operand. The dimension are the same as the input operand except for the reduction_dimension: when aggregate_to_topk is true, the reduction dimension is k; otherwise, it is greater equals to k where the size is implementation-defined.Output indices: The indices of values along the reduction_dimension of the input operand. | Constructors and Destructors | |
|---|---|
ApproxTopK(const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 k) | |
ApproxTopK(const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 k, const ApproxTopK::Attrs & attrs) |
| Public attributes | |
|---|---|
indices | |
operation | |
values | |
| Public static functions | |
|---|---|
AggregateToTopk(bool x) | |
IsMaxK(bool x) | |
RecallTarget(float x) | |
ReductionDimension(int64 x) | |
ReductionInputSizeOverride(int64 x) | |
| Structs | |
|---|---|
| tensorflow::ops::ApproxTopK::Attrs | Optional attribute setters for ApproxTopK. |
::tensorflow::Output indices
Operation operation
::tensorflow::Output values
ApproxTopK( const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 k )
ApproxTopK( const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 k, const ApproxTopK::Attrs & attrs )
Attrs AggregateToTopk( bool x )
Attrs IsMaxK( bool x )
Attrs RecallTarget( float x )
Attrs ReductionDimension( int64 x )
Attrs ReductionInputSizeOverride( int64 x )
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/approx-top-k