1 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef TENSORFLOW_LITE_EXAMPLES_LABEL_IMAGE_GET_TOP_N_H_ 17 #define TENSORFLOW_LITE_EXAMPLES_LABEL_IMAGE_GET_TOP_N_H_ 18 19 #include "tensorflow/lite/examples/label_image/get_top_n_impl.h" 20 21 namespace tflite { 22 namespace label_image { 23 24 template <class T> 25 void get_top_n(T* prediction, int prediction_size, size_t num_results, 26 float threshold, std::vector<std::pair<float, int>>* top_results, 27 TfLiteType input_type); 28 29 // explicit instantiation so that we can use them otherwhere 30 template void get_top_n<float>(float*, int, size_t, float, 31 std::vector<std::pair<float, int>>*, TfLiteType); 32 template void get_top_n<int8_t>(int8_t*, int, size_t, float, 33 std::vector<std::pair<float, int>>*, 34 TfLiteType); 35 template void get_top_n<uint8_t>(uint8_t*, int, size_t, float, 36 std::vector<std::pair<float, int>>*, 37 TfLiteType); 38 39 } // namespace label_image 40 } // namespace tflite 41 42 #endif // TENSORFLOW_LITE_EXAMPLES_LABEL_IMAGE_GET_TOP_N_H_ 43