Allow passing printf style arguments to the TF_LITE_ENSURE_MSG macro.

PiperOrigin-RevId: 578246535
This commit is contained in:
Quentin Khan
2023-10-31 11:23:49 -07:00
committed by TensorFlower Gardener
parent 5719b62d85
commit e5487031e1

View File

@@ -201,12 +201,12 @@ void TfLiteFloatArrayFree(TfLiteFloatArray* a);
// Check whether value is true, and if not return kTfLiteError from
// the current function (and report the error string msg).
#define TF_LITE_ENSURE_MSG(context, value, msg) \
do { \
if (!(value)) { \
TF_LITE_KERNEL_LOG((context), __FILE__ " " msg); \
return kTfLiteError; \
} \
#define TF_LITE_ENSURE_MSG(context, value, ...) \
do { \
if (!(value)) { \
TF_LITE_KERNEL_LOG((context), __FILE__ " " __VA_ARGS__); \
return kTfLiteError; \
} \
} while (0)
// Check whether the value `a` is true, and if not return kTfLiteError from