|View source on GitHub|
Says whether the targets are in the top
tf.compat.v2.math.in_top_k( targets, predictions, k, name=None )
This outputs a
batch_size bool array, an entry
true if the
prediction for the target class is finite (not inf, -inf, or nan) and among
k predictions among all predictions for example
i. Note that the
InTopK differs from the
TopK op in its handling of ties; if
multiple classes have the same prediction value and straddle the top-
boundary, all of those classes are considered to be in the top
More formally, let
\(predictions_i\) be the predictions for all classes for example
\(targets_i\) be the target class for example
\(out_i\) be the output for example
Tensor. Must be one of the following types:
batch_sizevector of class ids.
int. Number of top elements to look at for computing precision.
name: A name for the operation (optional).
Tensor of type
bool. Computed Precision at
k as a