softmax.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Copyright 2021 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_SOFTMAX_H_
  13. #define TENSORFLOW_LITE_MICRO_KERNELS_SOFTMAX_H_
  14. #include "tensorflow/lite/c/builtin_op_data.h"
  15. #include "tensorflow/lite/c/common.h"
  16. #include "tensorflow/lite/kernels/internal/types.h"
  17. namespace tflite {
  18. void* SoftmaxInit(TfLiteContext* context, const char* buffer, size_t length);
  19. TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node);
  20. // This is the most generic TfLiteRegistration. The actual supported types may
  21. // still be target dependent. The only requirement is that every implementation
  22. // (reference or optimized) must define this function.
  23. TfLiteRegistration Register_SOFTMAX();
  24. #if defined(XTENSA)
  25. // Returns a TfLiteRegistration struct for kernel variant that only supports
  26. // int8 input and int16 output.
  27. TfLiteRegistration Register_SOFTMAX_INT8_INT16();
  28. #else
  29. inline TfLiteRegistration Register_SOFTMAX_INT8_INT16() {
  30. return Register_SOFTMAX();
  31. }
  32. #endif
  33. } // namespace tflite
  34. #endif // TENSORFLOW_LITE_MICRO_KERNELS_SOFTMAX_H_