Fix 'unused variable' compiler error when building for ARM Cortex M4 in release mode
PiperOrigin-RevId: 323071869 Change-Id: I894b62b4c333838d45e556856f4bfef4f5d98a9c
This commit is contained in:
parent
926c086248
commit
dd9e169370
@ -131,7 +131,7 @@ TfLiteStatus AllocateOutputDimensionsFromInput(TfLiteContext* context,
|
||||
input = input1->dims->size > input2->dims->size ? input1 : input2;
|
||||
TF_LITE_ENSURE(context, output->type == input->type);
|
||||
|
||||
size_t size;
|
||||
size_t size = 0;
|
||||
TfLiteTypeSizeOf(input->type, &size);
|
||||
const int dimensions_count = tflite::GetTensorShape(input).DimensionsCount();
|
||||
for (int i = 0; i < dimensions_count; i++) {
|
||||
|
@ -97,7 +97,9 @@ TfLiteStatus CheckOfflinePlannedOffsets(const Model* model,
|
||||
int version = metadata_buffer[0];
|
||||
int subgraph_idx = metadata_buffer[1];
|
||||
const int nbr_offline_offsets = metadata_buffer[2];
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
int* offline_planner_offsets = (int*)&metadata_buffer[3];
|
||||
#endif
|
||||
|
||||
TF_LITE_REPORT_ERROR(error_reporter, "==== Model metadata info: =====");
|
||||
TF_LITE_REPORT_ERROR(error_reporter,
|
||||
|
@ -68,11 +68,13 @@ void* ContextHelper::GetScratchBuffer(TfLiteContext* ctx, int buffer_idx) {
|
||||
|
||||
void ContextHelper::ReportOpError(struct TfLiteContext* context,
|
||||
const char* format, ...) {
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
ContextHelper* helper = static_cast<ContextHelper*>(context->impl_);
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
TF_LITE_REPORT_ERROR(helper->error_reporter_, format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
|
||||
TfLiteTensor* ContextHelper::GetTensor(const struct TfLiteContext* context,
|
||||
|
@ -117,6 +117,7 @@ const char* AllocTypeName(TfLiteAllocationType type) {
|
||||
// Helper function to print model flatbuffer data. This function is not called
|
||||
// by default. Hence it's not linked in to the final binary code.
|
||||
void PrintModelData(const Model* model, ErrorReporter* error_reporter) {
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
auto* subgraphs = model->subgraphs();
|
||||
const SubGraph* subgraph = (*subgraphs)[0];
|
||||
const flatbuffers::Vector<flatbuffers::Offset<Tensor>>* tensors =
|
||||
@ -139,6 +140,7 @@ void PrintModelData(const Model* model, ErrorReporter* error_reporter) {
|
||||
error_reporter, "Tensor index: %d arena tensor %d size %d ", i,
|
||||
!array_size && !flatbuffer_tensor.is_variable(), tensor_size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Prints a dump of what tensors and what nodes are in the interpreter.
|
||||
|
@ -33,9 +33,10 @@ uint32_t MicroProfiler::BeginEvent(const char* tag, EventType event_type,
|
||||
}
|
||||
|
||||
void MicroProfiler::EndEvent(uint32_t event_handle) {
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
int32_t end_time = GetCurrentTimeTicks();
|
||||
TF_LITE_REPORT_ERROR(reporter_, "%s took %d cycles\n", event_tag_,
|
||||
end_time - start_time_);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace tflite
|
||||
|
@ -104,6 +104,7 @@ void RecordingMicroAllocator::PrintAllocations() const {
|
||||
void RecordingMicroAllocator::PrintRecordedAllocation(
|
||||
RecordedAllocationType allocation_type, const char* allocation_name,
|
||||
const char* allocation_description) const {
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
RecordedAllocation allocation = GetRecordedAllocation(allocation_type);
|
||||
TF_LITE_REPORT_ERROR(
|
||||
error_reporter(),
|
||||
@ -111,6 +112,7 @@ void RecordingMicroAllocator::PrintRecordedAllocation(
|
||||
"(requested %d bytes for %d %s)",
|
||||
allocation_name, allocation.used_bytes, allocation.requested_bytes,
|
||||
allocation.count, allocation_description);
|
||||
#endif
|
||||
}
|
||||
|
||||
TfLiteStatus RecordingMicroAllocator::AllocateNodeAndRegistrations(
|
||||
|
@ -78,11 +78,13 @@ uint8_t* SimpleMemoryAllocator::AllocateFromTail(size_t size,
|
||||
size_t alignment) {
|
||||
uint8_t* const aligned_result = AlignPointerDown(tail_ - size, alignment);
|
||||
if (aligned_result < head_) {
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
const size_t missing_memory = head_ - aligned_result;
|
||||
TF_LITE_REPORT_ERROR(
|
||||
error_reporter_,
|
||||
"Failed to allocate memory. Requested: %u, available %u, missing: %u",
|
||||
size, size - missing_memory, missing_memory);
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
tail_ = aligned_result;
|
||||
|
@ -812,11 +812,13 @@ int TestStrcmp(const char* a, const char* b) {
|
||||
|
||||
// Wrapper to forward kernel errors to the interpreter's error reporter.
|
||||
void ReportOpError(struct TfLiteContext* context, const char* format, ...) {
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
ErrorReporter* error_reporter = static_cast<ErrorReporter*>(context->impl_);
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
TF_LITE_REPORT_ERROR(error_reporter, format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Create a TfLiteIntArray from an array of ints. The first element in the
|
||||
|
Loading…
Reference in New Issue
Block a user