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
@ -50,7 +50,7 @@ class ErrorReporter {
|
|||||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||||
#define TF_LITE_REPORT_ERROR(reporter, ...) \
|
#define TF_LITE_REPORT_ERROR(reporter, ...) \
|
||||||
do { \
|
do { \
|
||||||
reporter->Report(__VA_ARGS__); \
|
static_cast<tflite::ErrorReporter*>(reporter)->Report(__VA_ARGS__); \
|
||||||
} while (false)
|
} while (false)
|
||||||
#else // TF_LITE_STRIP_ERROR_STRINGS
|
#else // TF_LITE_STRIP_ERROR_STRINGS
|
||||||
#define TF_LITE_REPORT_ERROR(reporter, ...)
|
#define TF_LITE_REPORT_ERROR(reporter, ...)
|
||||||
|
|||||||
@ -103,8 +103,7 @@ TfLiteStatus ValidateConvGoldens(TfLiteTensor* tensors, int tensors_size,
|
|||||||
} // namespace tflite
|
} // namespace tflite
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
tflite::MicroErrorReporter micro_reporter;
|
tflite::MicroErrorReporter reporter;
|
||||||
tflite::ErrorReporter* reporter = µ_reporter;
|
|
||||||
const int input_shape[] = {4, 1, 1, 1, 32};
|
const int input_shape[] = {4, 1, 1, 1, 32};
|
||||||
const int filter_shape[] = {4, 32, 1, 1, 32};
|
const int filter_shape[] = {4, 32, 1, 1, 32};
|
||||||
const int bias_shape[] = {1, 32};
|
const int bias_shape[] = {1, 32};
|
||||||
@ -231,9 +230,9 @@ int main() {
|
|||||||
const int num_tensors = sizeof(tensors) / sizeof(TfLiteTensor);
|
const int num_tensors = sizeof(tensors) / sizeof(TfLiteTensor);
|
||||||
TfLiteStatus status = tflite::testing::ValidateConvGoldens(
|
TfLiteStatus status = tflite::testing::ValidateConvGoldens(
|
||||||
tensors, num_tensors, &conv_params, kQuantizationTolerance,
|
tensors, num_tensors, &conv_params, kQuantizationTolerance,
|
||||||
output_dims_count, golden_quantized, reporter);
|
output_dims_count, golden_quantized, &reporter);
|
||||||
if (status != kTfLiteOk) {
|
if (status != kTfLiteOk) {
|
||||||
TF_LITE_REPORT_ERROR(reporter, "Model invoke failed\n");
|
TF_LITE_REPORT_ERROR(&reporter, "Model invoke failed\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,8 +116,7 @@ TfLiteStatus ValidateDepthwiseConvGoldens(TfLiteTensor* tensors,
|
|||||||
} // namespace tflite
|
} // namespace tflite
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
tflite::MicroErrorReporter micro_reporter;
|
tflite::MicroErrorReporter reporter;
|
||||||
tflite::ErrorReporter* reporter = µ_reporter;
|
|
||||||
const int input_elements = 32 * 4;
|
const int input_elements = 32 * 4;
|
||||||
const int filter_elements = 32 * 4;
|
const int filter_elements = 32 * 4;
|
||||||
const int bias_elements = 32;
|
const int bias_elements = 32;
|
||||||
@ -242,9 +241,9 @@ int main() {
|
|||||||
constexpr int kQuantizationTolerance = 1;
|
constexpr int kQuantizationTolerance = 1;
|
||||||
TfLiteStatus status = tflite::testing::ValidateDepthwiseConvGoldens(
|
TfLiteStatus status = tflite::testing::ValidateDepthwiseConvGoldens(
|
||||||
tensors, kTensorsSize, kTfLiteActNone, kQuantizationTolerance,
|
tensors, kTensorsSize, kTfLiteActNone, kQuantizationTolerance,
|
||||||
output_elements, golden_quantized, reporter);
|
output_elements, golden_quantized, &reporter);
|
||||||
if (status != kTfLiteOk) {
|
if (status != kTfLiteOk) {
|
||||||
TF_LITE_REPORT_ERROR(reporter, "Model invoke failed\n");
|
TF_LITE_REPORT_ERROR(&reporter, "Model invoke failed\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user