InTopK
tensorflow C++ API
Says whether the targets are in the top K
predictions.
Summary
This outputs abatch_size
bool array, an entryout[i]
istrue
if the prediction for the target class is among the topk
predictions among all predictions for examplei
. Note that the behavior ofInTopK
differs from theTopK
op in its handling of ties; if multiple classes have the same prediction value and straddle the top-k
boundary, all of those classes are considered to be in the topk
.
More formally, let
\(predictions_i\) be the predictions for all classes for examplei
, \(targets_i\) be the target class for examplei
, \(out_i\) be the output for examplei
,
Arguments:
- scope: A Scope object
- predictions: A
batch_size
xclasses
tensor. - targets: A
batch_size
vector of class ids. - k: Number of top elements to look at for computing precision.
Returns:
InTopK block
Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_nn.cpp
Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
- Input predictions: connect Input node.
- Input targets: connect Input node.
- int64 k: Input k in value ex)1
Return:
- Output output: Output object of InTopK class object.
Result:
- std::vector(Tensor) result_precision : Returned object of executed result by calling session.