Fix error reporter macro to allow passing a reference to error reporter.
PiperOrigin-RevId: 306892030 Change-Id: I6ece6b02df56b593318724c318d20beb13d04e79
This commit is contained in:
parent
3cc01a59a6
commit
cafdb61a56
@ -48,9 +48,9 @@ class ErrorReporter {
|
||||
// reduce binary size, define TF_LITE_STRIP_ERROR_STRINGS when compiling and
|
||||
// every call will be stubbed out, taking no memory.
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
#define TF_LITE_REPORT_ERROR(reporter, ...) \
|
||||
do { \
|
||||
reporter->Report(__VA_ARGS__); \
|
||||
#define TF_LITE_REPORT_ERROR(reporter, ...) \
|
||||
do { \
|
||||
static_cast<tflite::ErrorReporter*>(reporter)->Report(__VA_ARGS__); \
|
||||
} while (false)
|
||||
#else // TF_LITE_STRIP_ERROR_STRINGS
|
||||
#define TF_LITE_REPORT_ERROR(reporter, ...)
|
||||
|
@ -103,8 +103,7 @@ TfLiteStatus ValidateConvGoldens(TfLiteTensor* tensors, int tensors_size,
|
||||
} // namespace tflite
|
||||
|
||||
int main() {
|
||||
tflite::MicroErrorReporter micro_reporter;
|
||||
tflite::ErrorReporter* reporter = µ_reporter;
|
||||
tflite::MicroErrorReporter reporter;
|
||||
const int input_shape[] = {4, 1, 1, 1, 32};
|
||||
const int filter_shape[] = {4, 32, 1, 1, 32};
|
||||
const int bias_shape[] = {1, 32};
|
||||
@ -231,9 +230,9 @@ int main() {
|
||||
const int num_tensors = sizeof(tensors) / sizeof(TfLiteTensor);
|
||||
TfLiteStatus status = tflite::testing::ValidateConvGoldens(
|
||||
tensors, num_tensors, &conv_params, kQuantizationTolerance,
|
||||
output_dims_count, golden_quantized, reporter);
|
||||
output_dims_count, golden_quantized, &reporter);
|
||||
if (status != kTfLiteOk) {
|
||||
TF_LITE_REPORT_ERROR(reporter, "Model invoke failed\n");
|
||||
TF_LITE_REPORT_ERROR(&reporter, "Model invoke failed\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -116,8 +116,7 @@ TfLiteStatus ValidateDepthwiseConvGoldens(TfLiteTensor* tensors,
|
||||
} // namespace tflite
|
||||
|
||||
int main() {
|
||||
tflite::MicroErrorReporter micro_reporter;
|
||||
tflite::ErrorReporter* reporter = µ_reporter;
|
||||
tflite::MicroErrorReporter reporter;
|
||||
const int input_elements = 32 * 4;
|
||||
const int filter_elements = 32 * 4;
|
||||
const int bias_elements = 32;
|
||||
@ -242,9 +241,9 @@ int main() {
|
||||
constexpr int kQuantizationTolerance = 1;
|
||||
TfLiteStatus status = tflite::testing::ValidateDepthwiseConvGoldens(
|
||||
tensors, kTensorsSize, kTfLiteActNone, kQuantizationTolerance,
|
||||
output_elements, golden_quantized, reporter);
|
||||
output_elements, golden_quantized, &reporter);
|
||||
if (status != kTfLiteOk) {
|
||||
TF_LITE_REPORT_ERROR(reporter, "Model invoke failed\n");
|
||||
TF_LITE_REPORT_ERROR(&reporter, "Model invoke failed\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user