Move kTfLiteAbort to micro_context.h (#2072) BUG=http://b/149795762
diff --git a/tensorflow/lite/micro/kernels/circular_buffer.cc b/tensorflow/lite/micro/kernels/circular_buffer.cc index 0bed5cb..3e90104 100644 --- a/tensorflow/lite/micro/kernels/circular_buffer.cc +++ b/tensorflow/lite/micro/kernels/circular_buffer.cc
@@ -99,8 +99,7 @@ if (--data->cycles_until_run != 0) { // Signal the interpreter to end current run if the delay before op invoke // has not been reached. - // TODO(b/149795762): Add kTfLiteAbort to TfLiteStatus enum. - return static_cast<TfLiteStatus>(kTfLiteAbort); + return kTfLiteAbort; } data->cycles_until_run = data->cycles_max;
diff --git a/tensorflow/lite/micro/kernels/circular_buffer.h b/tensorflow/lite/micro/kernels/circular_buffer.h index 51adf74..c0a55b8 100644 --- a/tensorflow/lite/micro/kernels/circular_buffer.h +++ b/tensorflow/lite/micro/kernels/circular_buffer.h
@@ -30,9 +30,6 @@ // Elements in the vectors are ordered alphabetically by parameter name. extern const int kCircularBufferCyclesMaxIndex; // 'cycles_max' -// TODO(b/149795762): Add this to TfLiteStatus enum. -extern const TfLiteStatus kTfLiteAbort; - // These fields control the stride period of a strided streaming model. This op // returns kTfLiteAbort until cycles_until_run-- is zero. At this time, // cycles_until_run is reset to cycles_max.
diff --git a/tensorflow/lite/micro/kernels/circular_buffer_common.cc b/tensorflow/lite/micro/kernels/circular_buffer_common.cc index 81db6e6..bf45c06 100644 --- a/tensorflow/lite/micro/kernels/circular_buffer_common.cc +++ b/tensorflow/lite/micro/kernels/circular_buffer_common.cc
@@ -35,9 +35,6 @@ // Elements in the vectors are ordered alphabetically by parameter name. const int kCircularBufferCyclesMaxIndex = 0; // 'cycles_max' -// TODO(b/149795762): Add this to TfLiteStatus enum. -const TfLiteStatus kTfLiteAbort = static_cast<TfLiteStatus>(-9); - TfLiteStatus CircularBufferPrepare(TfLiteContext* context, TfLiteNode* node) { MicroContext* micro_context = GetMicroContext(context);
diff --git a/tensorflow/lite/micro/kernels/circular_buffer_test.cc b/tensorflow/lite/micro/kernels/circular_buffer_test.cc index faf2794..8fde7c5 100644 --- a/tensorflow/lite/micro/kernels/circular_buffer_test.cc +++ b/tensorflow/lite/micro/kernels/circular_buffer_test.cc
@@ -27,9 +27,6 @@ constexpr int kRunPeriod = 2; -// TODO(b/149795762): Add this to TfLiteStatus enum. -const TfLiteStatus kTfLiteAbort = static_cast<TfLiteStatus>(-9); - } // namespace } // namespace testing } // namespace tflite @@ -102,7 +99,7 @@ if (i % tflite::testing::kRunPeriod == tflite::testing::kRunPeriod - 1) { TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, status); } else { - TF_LITE_MICRO_EXPECT_EQ(tflite::testing::kTfLiteAbort, status); + TF_LITE_MICRO_EXPECT_EQ(tflite::kTfLiteAbort, status); } } }
diff --git a/tensorflow/lite/micro/micro_context.h b/tensorflow/lite/micro/micro_context.h index 63b4b7d..73df9e6 100644 --- a/tensorflow/lite/micro/micro_context.h +++ b/tensorflow/lite/micro/micro_context.h
@@ -21,6 +21,9 @@ #include "tensorflow/lite/micro/micro_graph.h" namespace tflite { +// TODO(b/149795762): kTfLiteAbort cannot be part of the tflite TfLiteStatus. +const TfLiteStatus kTfLiteAbort = static_cast<TfLiteStatus>(15); + // MicroContext is eventually going to become the API between TFLM and the // kernels, replacing all the functions in TfLiteContext. The end state is code // kernels to have code like: