log_scale_util.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_EXPERIMENTAL_MICROFRONTEND_LIB_LOG_SCALE_UTIL_H_
  13. #define TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_LOG_SCALE_UTIL_H_
  14. #include <stdint.h>
  15. #include <stdlib.h>
  16. #include "tensorflow/lite/experimental/microfrontend/lib/log_scale.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. struct LogScaleConfig {
  21. // set to false (0) to disable this module
  22. int enable_log;
  23. // scale results by 2^(scale_shift)
  24. int scale_shift;
  25. };
  26. // Populates the LogScaleConfig with "sane" default values.
  27. void LogScaleFillConfigWithDefaults(struct LogScaleConfig* config);
  28. // Allocates any buffers.
  29. int LogScalePopulateState(const struct LogScaleConfig* config,
  30. struct LogScaleState* state);
  31. #ifdef __cplusplus
  32. } // extern "C"
  33. #endif
  34. #endif // TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_LOG_SCALE_UTIL_H_