Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Iterate examples
- Y = map_fn(a, X)
- answer = reduce_sum(Y, axis=0)
- # where X is your supplied tensor.
- # KNN
- xThresholded = tf.clip_by_value(tf.cast(x, tf.int32), 0, 1)
- yThresholded = tf.clip_by_value(tf.cast(y, tf.int32), 0, 1)
- computeL0Dist = tf.count_nonzero(xThresholded - yThresholded, axis[1,2])
- findKClosestTrImages = tf.contrib.framework.argsort(computeL0Dist, direction='ASCENDING')
- findLabelsKClosestTrImages = tf.gather(trLabels, findClosestTrImages[0:paramk])
- findULabels, findIndex, findCounts = tf.unique_with_counts(findLabelsKClosestTrImages)
- findPredictedLabel = tf.gather(findULabels, tf.argmax(findCounts))
- findULabels, findIndex, findCounts = tf.unique_with_counts(top_all_label)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement