def in_top_k(predictions, targets, k):
"""Returns whether the `targets` are in the top `k` `predictions`
# Arguments
predictions: A tensor of shape `batch_size` x classes and type `float32`.
targets: A tensor of shape batch_size and type `int32` or `int64`.
k: An `int`, number of top elements to consider.
# Returns
A tensor of shape `batch_size` and type `bool`. `output_i` is `True` if
`targets_i` is within top-k values of `predictions_i`
"""
return tf.nn.in_top_k(predictions, targets, k)
# CONVOLUTIONS
tensorflow_backend.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录