1 // Copyright 2020 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/common.h> 11 #include <xnnpack/log.h> 12 #include <xnnpack/node-type.h> 13 14 15 // This function is defined inline when logging is disabled 16 #if XNN_LOG_LEVEL > 0 xnn_node_type_to_string(enum xnn_node_type type)17const char* xnn_node_type_to_string(enum xnn_node_type type) { 18 switch (type) { 19 case xnn_node_type_invalid: 20 return "Invalid"; 21 case xnn_node_type_abs: 22 return "Abs"; 23 case xnn_node_type_add2: 24 return "Add2"; 25 case xnn_node_type_argmax_pooling_2d: 26 return "ArgMax Pooling 2D"; 27 case xnn_node_type_average_pooling_2d: 28 return "Average Pooling 2D"; 29 case xnn_node_type_bankers_rounding: 30 return "Bankers Rounding"; 31 case xnn_node_type_ceiling: 32 return "Ceiling"; 33 case xnn_node_type_clamp: 34 return "Clamp"; 35 case xnn_node_type_concatenate2: 36 return "Concatenate2"; 37 case xnn_node_type_concatenate3: 38 return "Concatenate3"; 39 case xnn_node_type_concatenate4: 40 return "Concatenate4"; 41 case xnn_node_type_convert: 42 return "Convert"; 43 case xnn_node_type_convolution_2d: 44 return "Convolution 2D"; 45 case xnn_node_type_deconvolution_2d: 46 return "Deconvolution 2D"; 47 case xnn_node_type_depth_to_space: 48 return "Depth To Space"; 49 case xnn_node_type_depthwise_convolution_2d: 50 return "Depthwise Convolution 2D"; 51 case xnn_node_type_divide: 52 return "Divide"; 53 case xnn_node_type_elu: 54 return "ELU"; 55 case xnn_node_type_even_split2: 56 return "Even Split2"; 57 case xnn_node_type_even_split3: 58 return "Even Split3"; 59 case xnn_node_type_even_split4: 60 return "Even Split4"; 61 case xnn_node_type_floor: 62 return "Floor"; 63 case xnn_node_type_fully_connected: 64 return "Fully Connected"; 65 case xnn_node_type_global_average_pooling_1d: 66 return "Global Average Pooling 1D"; 67 case xnn_node_type_global_average_pooling_2d: 68 return "Global Average Pooling 2D"; 69 case xnn_node_type_hardswish: 70 return "HardSwish"; 71 case xnn_node_type_leaky_relu: 72 return "Leaky ReLU"; 73 case xnn_node_type_max_pooling_2d: 74 return "Max Pooling 2D"; 75 case xnn_node_type_maximum2: 76 return "Maximum2"; 77 case xnn_node_type_minimum2: 78 return "Minimum2"; 79 case xnn_node_type_multiply2: 80 return "Multiply2"; 81 case xnn_node_type_negate: 82 return "Negate"; 83 case xnn_node_type_prelu: 84 return "PReLU"; 85 case xnn_node_type_sigmoid: 86 return "Sigmoid"; 87 case xnn_node_type_softmax: 88 return "Softmax"; 89 case xnn_node_type_square: 90 return "Square"; 91 case xnn_node_type_square_root: 92 return "Square Root"; 93 case xnn_node_type_squared_difference: 94 return "Squared Difference"; 95 case xnn_node_type_static_constant_pad: 96 return "Static Constant Pad"; 97 case xnn_node_type_static_reshape: 98 return "Static Reshape"; 99 case xnn_node_type_static_resize_bilinear_2d: 100 return "Static Resize Bilinear 2D"; 101 case xnn_node_type_static_transpose: 102 return "Static Transpose"; 103 case xnn_node_type_subtract: 104 return "Subtract"; 105 case xnn_node_type_unpooling_2d: 106 return "Unpooling 2D"; 107 } 108 XNN_UNREACHABLE; 109 return NULL; 110 } 111 #endif // XNN_LOG_LEVEL > 0 112