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