Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
micro_error_reporter.cc
00001 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 00002 00003 Licensed under the Apache License, Version 2.0 (the "License"); 00004 you may not use this file except in compliance with the License. 00005 You may obtain a copy of the License at 00006 00007 http://www.apache.org/licenses/LICENSE-2.0 00008 00009 Unless required by applicable law or agreed to in writing, software 00010 distributed under the License is distributed on an "AS IS" BASIS, 00011 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 See the License for the specific language governing permissions and 00013 limitations under the License. 00014 ==============================================================================*/ 00015 00016 #include "tensorflow/lite/experimental/micro/micro_error_reporter.h" 00017 00018 namespace tflite { 00019 namespace { 00020 void DebugLogPrintf(const char* format, va_list args) { 00021 const int output_cache_size = 64; 00022 char output_cache[output_cache_size + 1]; 00023 int output_cache_index = 0; 00024 const char* current = format; 00025 while (*current != 0) { 00026 if (*current == '%') { 00027 const char next = *(current + 1); 00028 if ((next == 'd') || (next == 's') || (next == 'f')) { 00029 current += 1; 00030 if (output_cache_index > 0) { 00031 output_cache[output_cache_index] = 0; 00032 DebugLog(output_cache); 00033 output_cache_index = 0; 00034 } 00035 if (next == 'd') { 00036 DebugLogInt32(va_arg(args, int)); 00037 } else if (next == 's') { 00038 DebugLog(va_arg(args, char*)); 00039 } else if (next == 'f') { 00040 DebugLogFloat(va_arg(args, double)); 00041 } 00042 } 00043 } else { 00044 output_cache[output_cache_index] = *current; 00045 output_cache_index += 1; 00046 } 00047 if (output_cache_index >= output_cache_size) { 00048 output_cache[output_cache_index] = 0; 00049 DebugLog(output_cache); 00050 output_cache_index = 0; 00051 } 00052 current += 1; 00053 } 00054 if (output_cache_index > 0) { 00055 output_cache[output_cache_index] = 0; 00056 DebugLog(output_cache); 00057 output_cache_index = 0; 00058 } 00059 DebugLog("\r\n"); 00060 } 00061 } // namespace 00062 00063 int MicroErrorReporter::Report(const char* format, va_list args) { 00064 DebugLogPrintf(format, args); 00065 return 0; 00066 } 00067 00068 } // namespace tflite
Generated on Wed Jul 13 2022 16:03:35 by
1.7.2