generator.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. // An utility library to generate pure C header for builtin ops definition.
  13. #ifndef TENSORFLOW_LITE_SCHEMA_BUILTIN_OPS_HEADER_GENERATOR_H_
  14. #define TENSORFLOW_LITE_SCHEMA_BUILTIN_OPS_HEADER_GENERATOR_H_
  15. #include <iostream>
  16. #include <string>
  17. namespace tflite {
  18. namespace builtin_ops_header {
  19. // Check if the input enum name (from the Flatbuffer definition) is valid.
  20. bool IsValidInputEnumName(const std::string& name);
  21. // Convert the enum name from Flatbuffer convention to C enum name convention.
  22. // E.g. `L2_POOL_2D` becomes `kTfLiteBuiltinL2Pool2d`.
  23. std::string ConstantizeVariableName(const std::string& name);
  24. // The function generates a pure C header for builtin ops definition, and write
  25. // it to the output stream.
  26. bool GenerateHeader(std::ostream& os);
  27. } // namespace builtin_ops_header
  28. } // namespace tflite
  29. #endif // TENSORFLOW_LITE_SCHEMA_BUILTIN_OPS_HEADER_GENERATOR_H_