Skip to content

Commit

Permalink
Remove TFLM specific code from lite/kernels/op_macros.h
Browse files Browse the repository at this point in the history
With TFLM moving to its own repository, we should no longer have a dependency
from TfLite to TFLM.

tensorflow/tflite-micro#275 adds a TFLM-specific
implementation of op_macros.h in the TFLM tree and we can now remove all the
TFLM code from the tensorflow tree.

PiperOrigin-RevId: 384787132
Change-Id: I4d9babfa45413dd41309f30f11f8f732aec9b6fa
  • Loading branch information
advaitjain authored and tensorflower-gardener committed Jul 14, 2021
1 parent 6f7fd1b commit 8333b14
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 132 deletions.
1 change: 0 additions & 1 deletion tensorflow/lite/kernels/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ cc_library(
],
compatible_with = get_compatible_with_portable(),
copts = tflite_copts(),
deps = ["//tensorflow/lite/micro:debug_log"],
)

cc_library(
Expand Down
38 changes: 5 additions & 33 deletions tensorflow/lite/kernels/op_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,9 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_KERNELS_OP_MACROS_H_
#define TENSORFLOW_LITE_KERNELS_OP_MACROS_H_

// If we're on a platform without standard IO functions, fall back to a
// non-portable function.
#ifdef TF_LITE_MCU_DEBUG_LOG

#include "tensorflow/lite/micro/debug_log.h"

#define DEBUG_LOG(x) \
do { \
DebugLog(x); \
} while (0)

inline void InfiniteLoop() {
DEBUG_LOG("HALTED\n");
while (1) {
}
}

#define TFLITE_ABORT InfiniteLoop();

#else // TF_LITE_MCU_DEBUG_LOG

#include <cstdio>
#include <cstdlib>

#define DEBUG_LOG(x) \
do { \
fprintf(stderr, "%s", (x)); \
} while (0)

// Report Error for unsupported type by op 'op_name' and returns kTfLiteError.
#define TF_LITE_UNSUPPORTED_TYPE(context, type, op_name) \
Expand All @@ -55,19 +30,16 @@ inline void InfiniteLoop() {

#define TFLITE_ABORT abort()

#endif // TF_LITE_MCU_DEBUG_LOG

#if defined(NDEBUG) || defined(ARDUINO)
#if defined(NDEBUG)
#define TFLITE_ASSERT_FALSE (static_cast<void>(0))
#else
#define TFLITE_ASSERT_FALSE TFLITE_ABORT
#endif

#define TF_LITE_FATAL(msg) \
do { \
DEBUG_LOG(msg); \
DEBUG_LOG("\nFATAL\n"); \
TFLITE_ABORT; \
#define TF_LITE_FATAL(msg) \
do { \
fprintf(stderr, "%s\n", (msg)); \
TFLITE_ABORT; \
} while (0)

#define TF_LITE_ASSERT(x) \
Expand Down
17 changes: 0 additions & 17 deletions tensorflow/lite/micro/BUILD

This file was deleted.

50 changes: 0 additions & 50 deletions tensorflow/lite/micro/debug_log.cc

This file was deleted.

31 changes: 0 additions & 31 deletions tensorflow/lite/micro/debug_log.h

This file was deleted.

0 comments on commit 8333b14

Please sign in to comment.