mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-09 00:15:07 +00:00
![tonibofarull](/assets/img/avatar_default.png)
Initial integration of WASI-NN based on #1225: - Implement the library core/iwasm/libraries/wasi-nn - Support TensorFlow, CPU, F32 at the first stage - Add cmake variable `-DWAMR_BUILD_WASI_NN` - Add test case based on Docker image and update document Refer to #1573
56 lines
1.6 KiB
C
56 lines
1.6 KiB
C
/*
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
*/
|
|
|
|
#ifndef WASI_NN_LOGGER_H
|
|
#define WASI_NN_LOGGER_H
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#define __FILENAME__ \
|
|
(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
|
|
|
/* Disable a level by removing the define */
|
|
#define ENABLE_ERR_LOG
|
|
#define ENABLE_WARN_LOG
|
|
#define ENABLE_DBG_LOG
|
|
#define ENABLE_INFO_LOG
|
|
|
|
// Definition of the levels
|
|
#ifdef ENABLE_ERR_LOG
|
|
#define NN_ERR_PRINTF(fmt, ...) \
|
|
printf("[%s:%d] " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__); \
|
|
printf("\n"); \
|
|
fflush(stdout)
|
|
#else
|
|
#define NN_ERR_PRINTF(fmt, ...)
|
|
#endif
|
|
#ifdef ENABLE_WARN_LOG
|
|
#define NN_WARN_PRINTF(fmt, ...) \
|
|
printf("[%s:%d] " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__); \
|
|
printf("\n"); \
|
|
fflush(stdout)
|
|
#else
|
|
#define NN_WARN_PRINTF(fmt, ...)
|
|
#endif
|
|
#ifdef ENABLE_DBG_LOG
|
|
#define NN_DBG_PRINTF(fmt, ...) \
|
|
printf("[%s:%d] " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__); \
|
|
printf("\n"); \
|
|
fflush(stdout)
|
|
#else
|
|
#define NN_DBG_PRINTF(fmt, ...)
|
|
#endif
|
|
#ifdef ENABLE_INFO_LOG
|
|
#define NN_INFO_PRINTF(fmt, ...) \
|
|
printf("[%s:%d] " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__); \
|
|
printf("\n"); \
|
|
fflush(stdout)
|
|
#else
|
|
#define NN_INFO_PRINTF(fmt, ...)
|
|
#endif
|
|
|
|
#endif
|