circular_buffer.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright 2020 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_CIRCULAR_BUFFER_H_
  13. #define TENSORFLOW_LITE_MICRO_KERNELS_CIRCULAR_BUFFER_H_
  14. #include "tensorflow/lite/c/builtin_op_data.h"
  15. #include "tensorflow/lite/c/common.h"
  16. namespace tflite {
  17. // The CircularBuffer op has one input and one output tensor.
  18. extern const int kCircularBufferInputTensor;
  19. extern const int kCircularBufferOutputTensor;
  20. // Indices into the init flexbuffer's vector.
  21. // The parameter's name is in the comment that follows.
  22. // Elements in the vectors are ordered alphabetically by parameter name.
  23. extern const int kCircularBufferCyclesMaxIndex; // 'cycles_max'
  24. // TODO(b/149795762): Add this to TfLiteStatus enum.
  25. extern const TfLiteStatus kTfLiteAbort;
  26. // These fields control the stride period of a strided streaming model. This op
  27. // returns kTfLiteAbort until cycles_until_run-- is zero. At this time,
  28. // cycles_until_run is reset to cycles_max.
  29. struct OpDataCircularBuffer {
  30. int cycles_until_run;
  31. int cycles_max;
  32. };
  33. TfLiteStatus CircularBufferPrepare(TfLiteContext* context, TfLiteNode* node);
  34. } // namespace tflite
  35. #endif // TENSORFLOW_LITE_MICRO_KERNELS_CIRCULAR_BUFFER_H_