tf.nn.top_ k(input, k, name=None)
This function returns the maximum number of K input rows and the index of their location
Input: a tensor. The data type must be one of the following: float32, float64, int32, Int64, uint8, int16, int8. The data dimension is batch_ Multiply size by X categories
k: an integer must be & gt= 1。 In each row, find the largest K values
Name: give this operation a name<
output: a tuple tensor, and the data element is (values, indexes), as follows:
values: a tensor, and the data type is the same as input. The data dimension is batch_ Size multiplied by K maximum
indicators: a tensor whose data type is int32. The index position of each maximum value in input
tf.nn.in_ top_ k(predictions, targets, k, name=None)
It is to compare whether predictions and targets are the same, return true if they are the same, and return false if they are different. Next, tf.cast (correct, TF. Floatxx) can be used to calculate the accuracy
predictions: the prediction result, and the prediction matrix size is the number of samples × Two dimensional matrix of the number of labeled label classes
targets: the actual tag size is the number of samples
k: whether the first k largest numbers of the prediction results of each sample contain the tags in the targets prediction is generally taken as 1, that is, the index of the maximum probability of prediction is taken to compare with the tags
Name: name
Similar Posts:
- Keras.utils.to in keras_ Categorical method
- Tensorflowcenter {typeerror} non hashable type: “numpy. Ndarray”
- Weighted cross entropy loss function: tf.nn.weighted_cross_entropy_with_logits
- Python TypeError: softmax() got an unexpected keyword argument ‘axis’
- Note 32: yolov3: an incremental improvement
- [Solved] tf.summary Error: tags and values not the same shape
- Pytorch: How to Use pack_padded_sequence & pad_packed_sequence
- Error reporting on data type and matrix dimension of eigen
- LinAlgError: Last 2 dimensions of the array must be square
- [Solved] RuntimeError: one_hot is only applicable to index tensor