1// Copyright 2021 Google LLC
2//
3// This source code is licensed under the BSD-style license found in the
4// LICENSE file in the root directory of this source tree.
5
6#include <math.h>
7#include <stddef.h>
8#include <stdint.h>
9
10#include <xnnpack.h>
11#include <xnnpack/common.h>
12#include <xnnpack/log.h>
13
14
15// This function is defined inline when logging is disabled
16#if XNN_LOG_LEVEL > 0
17const char* xnn_datatype_to_string(enum xnn_datatype type) {
18 switch (type) {
19 case xnn_datatype_invalid:
20 return "Invalid";
21 case xnn_datatype_fp32:
22 return "FP32";
23 case xnn_datatype_fp16:
24 return "FP16";
25 case xnn_datatype_qint8:
26 return "QINT8";
27 case xnn_datatype_quint8:
28 return "QUINT8";
29 case xnn_datatype_qint32:
30 return "QINT32";
31 case xnn_datatype_qcint8:
32 return "QCINT8";
33 case xnn_datatype_qcint32:
34 return "QCINT32";
35 }
36 XNN_UNREACHABLE;
37 return NULL;
38}
39#endif // XNN_LOG_LEVEL > 0
40