1 // Copyright (c) Facebook, Inc. and its affiliates. 2 // All rights reserved. 3 // 4 // Copyright 2019 Google LLC 5 // 6 // This source code is licensed under the BSD-style license found in the 7 // LICENSE file in the root directory of this source tree. 8 9 #pragma once 10 11 #include <inttypes.h> 12 13 #include <clog.h> 14 15 #include <xnnpack/operator.h> 16 #include <xnnpack/subgraph.h> 17 18 #ifndef XNN_LOG_LEVEL 19 #error "Undefined XNN_LOG_LEVEL" 20 #endif 21 22 CLOG_DEFINE_LOG_DEBUG(xnn_log_debug, "XNNPACK", XNN_LOG_LEVEL); 23 CLOG_DEFINE_LOG_INFO(xnn_log_info, "XNNPACK", XNN_LOG_LEVEL); 24 CLOG_DEFINE_LOG_WARNING(xnn_log_warning, "XNNPACK", XNN_LOG_LEVEL); 25 CLOG_DEFINE_LOG_ERROR(xnn_log_error, "XNNPACK", XNN_LOG_LEVEL); 26 CLOG_DEFINE_LOG_FATAL(xnn_log_fatal, "XNNPACK", XNN_LOG_LEVEL); 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 #if XNN_LOG_LEVEL == 0 xnn_datatype_to_string(enum xnn_datatype type)33 inline static const char* xnn_datatype_to_string(enum xnn_datatype type) { 34 return "Unknown"; 35 } 36 xnn_node_type_to_string(enum xnn_node_type type)37 inline static const char* xnn_node_type_to_string(enum xnn_node_type type) { 38 return "Unknown"; 39 } 40 xnn_operator_type_to_string(enum xnn_operator_type type)41 inline static const char* xnn_operator_type_to_string(enum xnn_operator_type type) { 42 return "Unknown"; 43 } 44 #else 45 const char* xnn_datatype_to_string(enum xnn_datatype type); 46 const char* xnn_node_type_to_string(enum xnn_node_type type); 47 const char* xnn_operator_type_to_string(enum xnn_operator_type type); 48 #endif 49 50 #ifdef __cplusplus 51 } // extern "C" 52 #endif 53