micro_utils.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. ==============================================================================*/
  12. #ifndef TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_
  13. #define TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_
  14. namespace tflite {
  15. namespace ops {
  16. namespace micro {
  17. // Same as gtl::Greater but defined here to reduce dependencies and
  18. // binary size for micro environment.
  19. struct Greater {
  20. template <typename T>
  21. bool operator()(const T& x, const T& y) const {
  22. return x > y;
  23. }
  24. };
  25. struct Less {
  26. template <typename T>
  27. bool operator()(const T& x, const T& y) const {
  28. return x < y;
  29. }
  30. };
  31. } // namespace micro
  32. } // namespace ops
  33. } // namespace tflite
  34. #endif // TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_