├── .clang-format ├── .gitignore ├── .gitmodules ├── .pre-commit-config.yaml ├── CMakeLists.txt ├── Doxyfile ├── Kconfig ├── LICENSE ├── Makefile ├── README.md ├── README_CN.md ├── cmake ├── c906_elf.cmake ├── c906_share.cmake ├── c906_static.cmake ├── c908.cmake ├── c920.cmake ├── c920v2.cmake ├── e907.cmake ├── rules.cmake ├── rvm.cmake ├── rvv.cmake ├── target_build.cmake └── x86_ref.cmake ├── example ├── Makefile ├── c906_conv2d_f32.c └── c906_mobilenetv1_f16.c ├── include ├── backend │ ├── c906 │ │ ├── c906.h │ │ ├── cap.h │ │ └── perf.h │ ├── c908 │ │ └── c908.h │ ├── c920 │ │ ├── c920.h │ │ ├── cap.h │ │ └── perf.h │ ├── c920v2 │ │ ├── c920v2.h │ │ ├── cap.h │ │ └── perf.h │ ├── e907 │ │ └── e907.h │ ├── pnna │ │ ├── pnna.h │ │ └── wrapper.h │ ├── reference │ │ ├── perf.h │ │ └── ref.h │ ├── rvm │ │ └── rvm.h │ ├── rvv │ │ ├── cap.h │ │ ├── perf.h │ │ └── rvv.h │ └── tvmgen │ │ └── shl_tvmgen.h ├── csinn │ ├── csi_nn.h │ ├── csinn_data_structure.h │ └── csinn_runtime.h ├── graph │ ├── shl_gref.h │ └── shl_node.h ├── llm │ ├── shl_llm.h │ └── shl_llm_json.h ├── shl_debug.h ├── shl_memory.h ├── shl_multithread.h ├── shl_profiler.h ├── shl_public │ ├── shl_c906.h │ ├── shl_c920.h │ ├── shl_pnna.h │ ├── shl_ref.h │ └── shl_tvmgen.h └── shl_utils.h ├── module └── json │ ├── .clang-format │ └── json.hpp ├── python ├── setup.py └── shl │ ├── __init__.py │ ├── __main__.py │ └── main.py ├── script ├── download_qemu.sh ├── download_toolchain.sh ├── git-clang-format.sh ├── kconfig │ ├── diffconfig │ ├── guiconfig.py │ ├── hardenconfig.py │ ├── hardened.csv │ ├── kconfig.py │ ├── kconfigfunctions.py │ ├── kconfiglib.py │ ├── lint.py │ └── menuconfig.py └── release_pip.sh ├── source ├── c906_opt │ ├── CMakeLists.txt │ ├── Kconfig │ ├── capability.c │ ├── fp16 │ │ ├── abs.c │ │ ├── add.c │ │ ├── avgpool.c │ │ ├── cache_conv1d.c │ │ ├── cache_matmul.c │ │ ├── clip.c │ │ ├── concat.c │ │ ├── convolution.c │ │ ├── convolution1d.c │ │ ├── convolution_1x1_fp16.c │ │ ├── convolution_3x3_fp16.c │ │ ├── convolution_gemm_fp16.c │ │ ├── depthwise_convolution.c │ │ ├── depthwise_convolution1d.c │ │ ├── depthwise_convolution_3x3_fp16.c │ │ ├── depthwise_convolution_3x3_pack8_fp16.c │ │ ├── depthwise_convolution_fp16.c │ │ ├── div.c │ │ ├── fullyconnected.c │ │ ├── gemm_fp16.c │ │ ├── gemv_fp16.c │ │ ├── global_avgpool.c │ │ ├── global_maxpool.c │ │ ├── leaky_relu.c │ │ ├── lrn.c │ │ ├── matmul.c │ │ ├── maxpool.c │ │ ├── minimum.c │ │ ├── mul.c │ │ ├── pad.c │ │ ├── prelu.c │ │ ├── reduce_sum.c │ │ ├── relu.c │ │ ├── relu1.c │ │ ├── relu6.c │ │ ├── reshape.c │ │ ├── split.c │ │ └── sub.c │ ├── fp32 │ │ ├── abs.c │ │ ├── add.c │ │ ├── avgpool.c │ │ ├── broadcast_to.c │ │ ├── clip.c │ │ ├── concat.c │ │ ├── convolution.c │ │ ├── convolution1d.c │ │ ├── convolution_1x1_fp32.c │ │ ├── convolution_3x3_fp32.c │ │ ├── convolution_sgemm_fp32.c │ │ ├── depthwise_convolution.c │ │ ├── depthwise_convolution_3x3_fp32.c │ │ ├── depthwise_convolution_3x3_pack4_fp32.c │ │ ├── depthwise_convolution_5x5_fp32.c │ │ ├── depthwise_convolution_relu_3x3_fp32.c │ │ ├── depthwise_convolution_relu_3x3_pack4_fp32.c │ │ ├── depthwise_convolution_relu_5x5_fp32.c │ │ ├── div.c │ │ ├── gemm_fp32.c │ │ ├── global_avgpool.c │ │ ├── global_maxpool.c │ │ ├── leaky_relu.c │ │ ├── maxpool.c │ │ ├── minimum.c │ │ ├── mul.c │ │ ├── pad.c │ │ ├── prelu.c │ │ ├── relu.c │ │ ├── relu1.c │ │ ├── relu6.c │ │ ├── split.c │ │ └── sub.c │ ├── hpm.c │ ├── performance.c │ ├── setup.c │ ├── shl_c906_f32_to_i8.S │ ├── shl_c906_f32_to_u8.S │ ├── shl_c906_i8_to_f32.S │ ├── shl_c906_u8_to_f32.S │ └── utils.c ├── c908_opt │ ├── CMakeLists.txt │ ├── Kconfig │ ├── fp16 │ │ ├── avgpool.c │ │ ├── convolution.c │ │ ├── convolution_1x1_fp16.c │ │ ├── convolution_1x1_fp16_pack1ton.c │ │ ├── convolution_1x1_fp16_packn.c │ │ ├── convolution_1x1_fp16_packnto1.c │ │ ├── convolution_3x3_fp16.c │ │ ├── convolution_3x3_fp16_packn.c │ │ ├── convolution_3x3_fp16_packn_1.c │ │ ├── convolution_gemm_fp16.c │ │ ├── convolution_gemm_fp16_pack1ton.c │ │ ├── convolution_gemm_fp16_packn.c │ │ ├── convolution_gemm_fp16_packnto1.c │ │ ├── depthwise_convolution.c │ │ ├── fullyconnected.c │ │ ├── gemm_fp16.c │ │ ├── gemm_fp16_ncxhwx.S │ │ ├── gemm_fp16_packn.c │ │ ├── gemm_fp16_v256.c │ │ └── maxpool.c │ ├── fp32 │ │ ├── avgpool.c │ │ ├── convolution.c │ │ ├── convolution_1x1_fp32.c │ │ ├── convolution_1x1_fp32_pack1ton.c │ │ ├── convolution_1x1_fp32_packn.c │ │ ├── convolution_1x1_fp32_packnto1.c │ │ ├── convolution_3x3_fp32.c │ │ ├── convolution_3x3_fp32_packn.c │ │ ├── convolution_3x3_fp32_packn_1.c │ │ ├── convolution_gemm_fp32.c │ │ ├── convolution_gemm_fp32_pack1ton.c │ │ ├── convolution_gemm_fp32_packn.c │ │ ├── convolution_gemm_fp32_packnto1.c │ │ ├── depthwise_convolution.c │ │ ├── fullyconnected.c │ │ ├── gemm_fp32.c │ │ ├── gemm_fp32_ncxhwx.S │ │ ├── gemm_fp32_packn.c │ │ ├── gemm_fp32_v256.c │ │ └── maxpool.c │ ├── int4 │ │ ├── convolution.c │ │ ├── depthwise_convolution.c │ │ ├── fullyconnected.c │ │ └── gemm_int4_dot_ncxhwx.S │ ├── int8 │ │ ├── avgpool.c │ │ ├── convolution.c │ │ ├── convolution_1x1_int8.c │ │ ├── convolution_1x1_int8_pack1ton.c │ │ ├── convolution_1x1_int8_packn.c │ │ ├── convolution_1x1_int8_packnto1.c │ │ ├── convolution_3x3_int8.c │ │ ├── convolution_3x3_int8_packn.c │ │ ├── convolution_3x3_int8_packn_1.c │ │ ├── convolution_gemm_int8.c │ │ ├── convolution_gemm_int8_pack1ton.c │ │ ├── convolution_gemm_int8_packn.c │ │ ├── convolution_gemm_int8_packnto1.c │ │ ├── depthwise_convolution.c │ │ ├── fullyconnected.c │ │ ├── gemm_int16_ncxhwx.S │ │ ├── gemm_int16_packn.c │ │ ├── gemm_int8_dot.c │ │ ├── gemm_int8_dot_ncxhwx.S │ │ ├── gemm_int8_dot_packn.c │ │ ├── gemm_int8_dot_v256.c │ │ ├── gemm_int8_ncxhwx.S │ │ ├── gemm_int8_packn.c │ │ └── maxpool.c │ ├── reorder.c │ ├── setup.c │ ├── shl_c908_f32_to_i8.S │ ├── shl_c908_f32_to_u8.S │ └── utils.c ├── c920_opt │ ├── CMakeLists.txt │ ├── Kconfig │ ├── capability.c │ ├── fp16 │ │ ├── convolution.c │ │ ├── convolution_1x1_fp16_packn.c │ │ ├── convolution_3x3_fp16_packn.c │ │ ├── convolution_gemm_fp16_packn.c │ │ ├── fullyconnected.c │ │ ├── gemm_a0nb1n_fp16.c │ │ ├── gemm_a0nb1r_fp16.c │ │ ├── gemm_fp16_a0b1.c │ │ ├── gemm_fp16_block.c │ │ ├── gemm_fp16_packn.c │ │ ├── gemm_fp16_rearrange.c │ │ └── matmul_fp16.c │ ├── fp32 │ │ ├── convolution.c │ │ ├── convolution_1x1_fp32_packn.c │ │ ├── convolution_3x3_fp32_packn.c │ │ ├── convolution_gemm_fp32_packn.c │ │ ├── fullyconnected.c │ │ ├── gemm_a0nb1n_fp32.c │ │ ├── gemm_a0nb1r_fp32.c │ │ ├── gemm_fp32_a0b1.c │ │ ├── gemm_fp32_block.c │ │ ├── gemm_fp32_packn.c │ │ └── matmul_fp32.c │ ├── performance.c │ ├── reorder.c │ ├── setup.c │ ├── shl_c920_f32_to_i8.S │ ├── shl_c920_f32_to_u8.S │ ├── shl_c920_i8_to_f32.S │ ├── shl_c920_u8_to_f32.S │ ├── utils.c │ ├── yolov5.c │ └── yolox.c ├── c920v2_opt │ ├── CMakeLists.txt │ ├── Kconfig │ ├── capability.c │ ├── fp16 │ │ ├── convolution.c │ │ ├── convolution_1x1_fp16_pack1ton.c │ │ ├── convolution_1x1_fp16_packn.c │ │ ├── convolution_1x1_fp16_packnto1.c │ │ ├── convolution_gemm_fp16_pack1ton.c │ │ ├── convolution_gemm_fp16_packn.c │ │ ├── convolution_gemm_fp16_packnto1.c │ │ ├── gemm_fp16_ncxhwx.S │ │ └── gemm_fp16_packn.c │ ├── fp32 │ │ ├── convolution.c │ │ ├── convolution_1x1_fp32_pack1ton.c │ │ ├── convolution_1x1_fp32_packn.c │ │ ├── convolution_1x1_fp32_packnto1.c │ │ ├── convolution_gemm_fp32_pack1ton.c │ │ ├── convolution_gemm_fp32_packn.c │ │ ├── convolution_gemm_fp32_packnto1.c │ │ ├── gemm_fp32_ncxhwx.S │ │ └── gemm_fp32_packn.c │ ├── int8 │ │ ├── convolution.c │ │ ├── convolution_1x1_int8_pack1ton.c │ │ ├── convolution_1x1_int8_packn.c │ │ ├── convolution_1x1_int8_packnto1.c │ │ ├── gemm_int8_dot_ncxhwx.S │ │ ├── gemm_int8_dot_packn.c │ │ ├── gemm_int8_ncxhwx.S │ │ └── gemm_int8_packn.c │ ├── performance.c │ ├── setup.c │ └── utils.c ├── e907_opt │ ├── CMakeLists.txt │ ├── Kconfig │ ├── concat.c │ ├── convolution.c │ ├── fullyconnected.c │ ├── fullyconnected_int8.c │ ├── mul.c │ ├── relu.c │ ├── setup.c │ ├── softmax.c │ ├── sum.c │ └── utils.c ├── graph_ref │ ├── CMakeLists.txt │ ├── Kconfig │ ├── abs.c │ ├── acos.c │ ├── acosh.c │ ├── add.c │ ├── all.c │ ├── and.c │ ├── any.c │ ├── arange.c │ ├── argmax.c │ ├── argmin.c │ ├── asin.c │ ├── asinh.c │ ├── atan.c │ ├── atanh.c │ ├── avgpool.c │ ├── avgpool3d.c │ ├── batch_to_space.c │ ├── batch_to_space_nd.c │ ├── bn.c │ ├── broadcast_to.c │ ├── cache_conv1d.c │ ├── cache_matmul.c │ ├── cast.c │ ├── ceil.c │ ├── clip.c │ ├── col2im.c │ ├── concat.c │ ├── convolution.c │ ├── convolution1d.c │ ├── convolution3d.c │ ├── cos.c │ ├── cosh.c │ ├── crop.c │ ├── cumprod.c │ ├── cumsum.c │ ├── data_convert.c │ ├── deconvolution.c │ ├── deconvolution3d.c │ ├── depth_to_space.c │ ├── div.c │ ├── elu.c │ ├── embedding.c │ ├── equal.c │ ├── erf.c │ ├── exp.c │ ├── expand_dims.c │ ├── expm1.c │ ├── flatten.c │ ├── floor.c │ ├── floor_divide.c │ ├── floor_mod.c │ ├── fsmn.c │ ├── fullyconnected.c │ ├── gather.c │ ├── gather_nd.c │ ├── global_averagepool.c │ ├── global_maxpool.c │ ├── greater.c │ ├── greater_equal.c │ ├── hard_sigmoid.c │ ├── im2col.c │ ├── instance_norm.c │ ├── isnan.c │ ├── l2_normalization.c │ ├── l2pool.c │ ├── layer_norm.c │ ├── leaky_relu.c │ ├── less.c │ ├── less_equal.c │ ├── llm_pos.c │ ├── log.c │ ├── log1p.c │ ├── log_softmax.c │ ├── logical_and.c │ ├── logical_not.c │ ├── logical_or.c │ ├── logical_xor.c │ ├── lrn.c │ ├── matmul.c │ ├── max.c │ ├── maximum.c │ ├── maxpool.c │ ├── maxpool2d_locat.c │ ├── maxpool3d.c │ ├── mean.c │ ├── min.c │ ├── minimum.c │ ├── mod.c │ ├── mul.c │ ├── ndarray_size.c │ ├── negative.c │ ├── non_max_suppression.c │ ├── not.c │ ├── not_equal.c │ ├── one_hot.c │ ├── or.c │ ├── pad.c │ ├── power.c │ ├── prelu.c │ ├── prod.c │ ├── proposal.c │ ├── psroipooling.c │ ├── reduce_logsumexp.c │ ├── reduce_max.c │ ├── reduce_mean.c │ ├── reduce_min.c │ ├── reduce_prod.c │ ├── reduce_sum.c │ ├── relu.c │ ├── relu1.c │ ├── relu6.c │ ├── relun.c │ ├── reorg.c │ ├── reshape.c │ ├── resize.c │ ├── reverse.c │ ├── rms_norm.c │ ├── roialign.c │ ├── roipool.c │ ├── rope.c │ ├── round.c │ ├── rsqrt.c │ ├── scaled_dot_product_attention.c │ ├── scatter.c │ ├── segment_max.c │ ├── segment_mean.c │ ├── segment_min.c │ ├── segment_prod.c │ ├── segment_sum.c │ ├── select.c │ ├── sequence_mask.c │ ├── setup.c │ ├── shape.c │ ├── shuffle_channel.c │ ├── sigmoid.c │ ├── sign.c │ ├── silu.c │ ├── sin.c │ ├── sinh.c │ ├── slice.c │ ├── softmax.c │ ├── softplus.c │ ├── softrelu.c │ ├── softsign.c │ ├── space_to_batch.c │ ├── space_to_batch_nd.c │ ├── space_to_depth.c │ ├── split.c │ ├── sqrt.c │ ├── square.c │ ├── squeeze.c │ ├── stack.c │ ├── strided_slice.c │ ├── sub.c │ ├── subgraph.c │ ├── sum.c │ ├── tan.c │ ├── tanh.c │ ├── threshold_relu.c │ ├── tile.c │ ├── topk.c │ ├── transpose.c │ ├── trunc.c │ ├── unpooling.c │ ├── unstack.c │ ├── utils.c │ ├── where.c │ ├── where_softmax.c │ ├── xor.c │ └── yuv_rgb_scale.c ├── llm │ ├── llama2.c │ ├── llama2_quantize.c │ ├── llm.c │ └── llm_json.cpp ├── nn2 │ ├── abs.c │ ├── acos.c │ ├── acosh.c │ ├── add.c │ ├── all.c │ ├── and.c │ ├── any.c │ ├── arange.c │ ├── argmax.c │ ├── argmin.c │ ├── asin.c │ ├── asinh.c │ ├── atan.c │ ├── atanh.c │ ├── averagepool.c │ ├── averagepool3d.c │ ├── batch_normalization.c │ ├── batch_to_space.c │ ├── batch_to_space_nd.c │ ├── broadcast_to.c │ ├── cache_conv1d.c │ ├── cache_matmul.c │ ├── cast.c │ ├── ceil.c │ ├── clip.c │ ├── col2im.c │ ├── concat.c │ ├── convolution.c │ ├── convolution1d.c │ ├── convolution3d.c │ ├── convolution_relu.c │ ├── convolution_relu6.c │ ├── cos.c │ ├── cosh.c │ ├── crop.c │ ├── cumprod.c │ ├── cumsum.c │ ├── data_convert.c │ ├── deconvolution.c │ ├── deconvolution3d.c │ ├── depth_to_space.c │ ├── depthwise_conv2d.c │ ├── depthwise_conv2d_relu.c │ ├── div.c │ ├── elu.c │ ├── embedding.c │ ├── equal.c │ ├── erf.c │ ├── exp.c │ ├── expand_dims.c │ ├── expm1.c │ ├── flatten.c │ ├── floor.c │ ├── floor_divide.c │ ├── floor_mod.c │ ├── format.c │ ├── fsmn.c │ ├── fullyconnected.c │ ├── gather.c │ ├── gather_nd.c │ ├── global_averagepool.c │ ├── global_maxpool.c │ ├── greater.c │ ├── greater_equal.c │ ├── group_conv2d.c │ ├── hard_sigmoid.c │ ├── im2col.c │ ├── isnan.c │ ├── l2_normalization.c │ ├── l2pool.c │ ├── layer_norm.c │ ├── leaky_relu.c │ ├── less.c │ ├── less_equal.c │ ├── llm_pos.c │ ├── log.c │ ├── log1p.c │ ├── log_softmax.c │ ├── logical_and.c │ ├── logical_not.c │ ├── logical_or.c │ ├── logical_xor.c │ ├── lrn.c │ ├── matmul.c │ ├── max.c │ ├── maximum.c │ ├── maxpool.c │ ├── maxpool2d_locat.c │ ├── maxpool3d.c │ ├── mean.c │ ├── min.c │ ├── minimum.c │ ├── mod.c │ ├── mul.c │ ├── ndarray_size.c │ ├── negative.c │ ├── node.c │ ├── non_max_suppression.c │ ├── not.c │ ├── not_equal.c │ ├── one_hot.c │ ├── or.c │ ├── pad.c │ ├── power.c │ ├── prelu.c │ ├── prod.c │ ├── proposal.c │ ├── psroipooling.c │ ├── reduce_logsumexp.c │ ├── reduce_max.c │ ├── reduce_mean.c │ ├── reduce_min.c │ ├── reduce_prod.c │ ├── reduce_sum.c │ ├── relu.c │ ├── relu1.c │ ├── relu6.c │ ├── relun.c │ ├── reorg.c │ ├── reshape.c │ ├── resize.c │ ├── reverse.c │ ├── rms_norm.c │ ├── roialign.c │ ├── roipool.c │ ├── rope.c │ ├── round.c │ ├── rsqrt.c │ ├── scaled_dot_product_attention.c │ ├── scatter.c │ ├── segment_max.c │ ├── segment_mean.c │ ├── segment_min.c │ ├── segment_prod.c │ ├── segment_sum.c │ ├── select.c │ ├── sequence_mask.c │ ├── setup.c │ ├── shape.c │ ├── shuffle_channel.c │ ├── sigmoid.c │ ├── sign.c │ ├── silu.c │ ├── sin.c │ ├── sinh.c │ ├── slice.c │ ├── softmax.c │ ├── softplus.c │ ├── softrelu.c │ ├── softsign.c │ ├── space_to_batch.c │ ├── space_to_batch_nd.c │ ├── space_to_depth.c │ ├── split.c │ ├── sqrt.c │ ├── square.c │ ├── squeeze.c │ ├── stack.c │ ├── strided_slice.c │ ├── sub.c │ ├── sum.c │ ├── tan.c │ ├── tanh.c │ ├── threshold_relu.c │ ├── tile.c │ ├── topk.c │ ├── transpose.c │ ├── trunc.c │ ├── unpooling.c │ ├── unstack.c │ ├── utils.c │ ├── where.c │ ├── where_softmax.c │ ├── xor.c │ └── yuv_rgb_scale.c ├── reference │ ├── CMakeLists.txt │ ├── Kconfig │ ├── abs.c │ ├── acos.c │ ├── acosh.c │ ├── add.c │ ├── and.c │ ├── arange.c │ ├── argmax.c │ ├── argmin.c │ ├── asin.c │ ├── asinh.c │ ├── atan.c │ ├── atanh.c │ ├── averagepool.c │ ├── averagepool3d.c │ ├── batch_normalization.c │ ├── batch_to_space.c │ ├── broadcast_to.c │ ├── cache_conv1d.c │ ├── cache_matmul.c │ ├── cast.c │ ├── ceil.c │ ├── clip.c │ ├── col2im.c │ ├── concat.c │ ├── conv_avx.h │ ├── convolution.c │ ├── convolution1d.c │ ├── convolution3d.c │ ├── convolution_channel.c │ ├── convolution_relu.c │ ├── convolution_relu6.c │ ├── cos.c │ ├── cosh.c │ ├── cumprod.c │ ├── cumsum.c │ ├── data_convert.c │ ├── deconvolution.c │ ├── deconvolution3d.c │ ├── depth_to_space.c │ ├── div.c │ ├── elu.c │ ├── embedding.c │ ├── equal.c │ ├── erf.c │ ├── exp.c │ ├── expand_dims.c │ ├── expm1.c │ ├── flatten.c │ ├── floor.c │ ├── floor_divide.c │ ├── floor_mod.c │ ├── fsmn.c │ ├── fullyconnected.c │ ├── gather.c │ ├── gather_nd.c │ ├── global_averagepool.c │ ├── global_maxpool.c │ ├── greater.c │ ├── greater_equal.c │ ├── hard_sigmoid.c │ ├── im2col.c │ ├── instance_norm.c │ ├── isnan.c │ ├── l2_normalization.c │ ├── l2pool.c │ ├── layer_norm.c │ ├── leaky_relu.c │ ├── less.c │ ├── less_equal.c │ ├── llm_pos.c │ ├── log.c │ ├── log1p.c │ ├── log_softmax.c │ ├── logical_and.c │ ├── logical_not.c │ ├── logical_or.c │ ├── logical_xor.c │ ├── lrn.c │ ├── matmul.c │ ├── max.c │ ├── maximum.c │ ├── maxpool.c │ ├── maxpool2d_locat.c │ ├── maxpool3d.c │ ├── mean.c │ ├── min.c │ ├── minimum.c │ ├── mod.c │ ├── mul.c │ ├── ndarray_size.c │ ├── negative.c │ ├── non_max_suppression.c │ ├── not.c │ ├── not_equal.c │ ├── one_hot.c │ ├── or.c │ ├── pad.c │ ├── performance.c │ ├── power.c │ ├── prelu.c │ ├── prod.c │ ├── proposal.c │ ├── psroipooling.c │ ├── reduce_logsumexp.c │ ├── reduce_max.c │ ├── reduce_mean.c │ ├── reduce_min.c │ ├── reduce_prod.c │ ├── reduce_sum.c │ ├── relu.c │ ├── relu1.c │ ├── relu6.c │ ├── relun.c │ ├── reshape.c │ ├── resize.c │ ├── reverse.c │ ├── rms_norm.c │ ├── roialign.c │ ├── roipool.c │ ├── rope.c │ ├── round.c │ ├── rsqrt.c │ ├── scaled_dot_product_attention.c │ ├── scatter.c │ ├── segment_max.c │ ├── segment_mean.c │ ├── segment_min.c │ ├── segment_prod.c │ ├── segment_sum.c │ ├── select.c │ ├── setup.c │ ├── shape.c │ ├── shuffle_channel.c │ ├── sigmoid.c │ ├── sign.c │ ├── silu.c │ ├── sin.c │ ├── sinh.c │ ├── slice.c │ ├── softmax.c │ ├── softplus.c │ ├── softrelu.c │ ├── softsign.c │ ├── space_to_batch.c │ ├── space_to_depth.c │ ├── split.c │ ├── sqrt.c │ ├── square.c │ ├── squeeze.c │ ├── stack.c │ ├── strided_slice.c │ ├── sub.c │ ├── sum.c │ ├── tan.c │ ├── tanh.c │ ├── threshold_relu.c │ ├── tile.c │ ├── topk.c │ ├── transpose.c │ ├── trunc.c │ ├── unpooling.c │ ├── unstack.c │ ├── utils.c │ ├── where.c │ ├── where_softmax.c │ ├── xor.c │ └── yuv_rgb_scale.c ├── thead_matrix │ ├── avgpool.c │ ├── convolution.c │ ├── convolution_1x1_fp16_matrix.c │ ├── convolution_1x1_int8_matrix.c │ ├── convolution_3x3_fp16_matrix.c │ ├── convolution_gemm_fp16_matrix.c │ ├── convolution_gemm_int8_matrix.c │ ├── depthwise_convolution.c │ ├── fullyconnected.c │ ├── fullyconnected_fp16.c │ ├── fullyconnected_int8.c │ ├── gemm_fp16_intrinsic.c │ ├── gemm_fp16_matrix.c │ ├── gemm_fp16_matrix_intrinsic.c │ ├── gemm_fp16_nhwc_matrix.S │ ├── gemm_int8_intrinsic.c │ ├── gemm_int8_matrix.c │ ├── gemm_int8_nhwc_matrix.S │ ├── gemm_int8_to_int32_nhwc_matrix.S │ ├── matmul.c │ ├── matmul_fp16.c │ ├── matmul_int8.c │ ├── maxpool.c │ ├── setup.c │ └── utils.c ├── thead_rvv │ ├── CMakeLists.txt │ ├── Kconfig │ ├── binary_broadcast.c │ ├── capability.c │ ├── data_convert.c │ ├── fp16 │ │ ├── add.c │ │ ├── avgpool.c │ │ ├── avgpool_2x2_fp16.c │ │ ├── avgpool_2x2_fp16_packn.c │ │ ├── avgpool_3x3_fp16.c │ │ ├── avgpool_3x3_fp16_packn.c │ │ ├── avgpool_fp16_nhwc.c │ │ ├── avgpool_fp16_packn.c │ │ ├── clip.c │ │ ├── concat.c │ │ ├── convolution.c │ │ ├── convolution1d.c │ │ ├── convolution1d_gemm_fp16.c │ │ ├── convolution_1x1_fp16.c │ │ ├── convolution_1x1_fp16_pack1ton.c │ │ ├── convolution_1x1_fp16_packn.c │ │ ├── convolution_1x1_fp16_packnto1.c │ │ ├── convolution_3x3_fp16_packn.c │ │ ├── convolution_direct_fp16.c │ │ ├── convolution_gemm_fp16.c │ │ ├── convolution_gemm_fp16_pack1ton.c │ │ ├── convolution_gemm_fp16_packn.c │ │ ├── convolution_gemm_fp16_packnto1.c │ │ ├── deconvolution.c │ │ ├── deconvolution_gemm_fp16.c │ │ ├── depthwise_convolution.c │ │ ├── depthwise_convolution_3x3_fp16.c │ │ ├── depthwise_convolution_3x3_fp16_packn.c │ │ ├── depthwise_convolution_fp16_nhwc.c │ │ ├── depthwise_convolution_fp16_packn.c │ │ ├── div.c │ │ ├── erf.c │ │ ├── expand_dims.c │ │ ├── fullyconnected.c │ │ ├── fullyconnected_fp16.c │ │ ├── gather.c │ │ ├── gemm_fp16.c │ │ ├── gemm_fp16_a0b1.c │ │ ├── gemm_fp16_block.c │ │ ├── gemm_fp16_packn.c │ │ ├── global_avgpool.c │ │ ├── global_avgpool_nhwc.c │ │ ├── global_avgpool_packn.c │ │ ├── global_maxpool.c │ │ ├── global_maxpool_nhwc.c │ │ ├── global_maxpool_packn.c │ │ ├── layer_norm.c │ │ ├── leaky_relu.c │ │ ├── llm_pos.c │ │ ├── matmul.c │ │ ├── maxpool.c │ │ ├── maxpool_2x2_fp16.c │ │ ├── maxpool_2x2_fp16_packn.c │ │ ├── maxpool_3x3_fp16.c │ │ ├── maxpool_3x3_fp16_packn.c │ │ ├── maxpool_fp16_nhwc.c │ │ ├── maxpool_fp16_packn.c │ │ ├── mul.c │ │ ├── pad.c │ │ ├── prelu.c │ │ ├── relu.c │ │ ├── relu6.c │ │ ├── reshape.c │ │ ├── rms_norm.c │ │ ├── rope.c │ │ ├── rvv_mathfun_fp16.h │ │ ├── scaled_dot_product_attention.c │ │ ├── sigmoid.c │ │ ├── silu.c │ │ ├── softmax.c │ │ ├── split.c │ │ ├── strided_slice.c │ │ ├── sub.c │ │ └── transpose.c │ ├── fp32 │ │ ├── add.c │ │ ├── avgpool.c │ │ ├── avgpool_2x2_fp32.c │ │ ├── avgpool_2x2_fp32_packn.c │ │ ├── avgpool_3x3_fp32.c │ │ ├── avgpool_3x3_fp32_packn.c │ │ ├── avgpool_fp32_nhwc.c │ │ ├── avgpool_fp32_packn.c │ │ ├── clip.c │ │ ├── concat.c │ │ ├── convolution.c │ │ ├── convolution1d.c │ │ ├── convolution1d_gemm_fp32.c │ │ ├── convolution_1x1_fp32.c │ │ ├── convolution_1x1_fp32_pack1ton.c │ │ ├── convolution_1x1_fp32_packn.c │ │ ├── convolution_1x1_fp32_packnto1.c │ │ ├── convolution_3x3_fp32_packn.c │ │ ├── convolution_gemm_fp32.c │ │ ├── convolution_gemm_fp32_pack1ton.c │ │ ├── convolution_gemm_fp32_packn.c │ │ ├── convolution_gemm_fp32_packnto1.c │ │ ├── deconvolution.c │ │ ├── deconvolution_gemm_fp32.c │ │ ├── depthwise_convolution.c │ │ ├── depthwise_convolution_3x3_fp32.c │ │ ├── depthwise_convolution_3x3_fp32_packn.c │ │ ├── depthwise_convolution_fp32_nhwc.c │ │ ├── depthwise_convolution_fp32_packn.c │ │ ├── div.c │ │ ├── erf.c │ │ ├── expand_dims.c │ │ ├── fullyconnected.c │ │ ├── fullyconnected_fp32.c │ │ ├── gather.c │ │ ├── gemm_fp32.c │ │ ├── gemm_fp32_a0b1.c │ │ ├── gemm_fp32_block.c │ │ ├── gemm_fp32_packn.c │ │ ├── global_avgpool.c │ │ ├── global_avgpool_nhwc.c │ │ ├── global_avgpool_packn.c │ │ ├── global_maxpool.c │ │ ├── global_maxpool_nhwc.c │ │ ├── global_maxpool_packn.c │ │ ├── layer_norm.c │ │ ├── leaky_relu.c │ │ ├── matmul.c │ │ ├── maxpool.c │ │ ├── maxpool_2x2_fp32.c │ │ ├── maxpool_2x2_fp32_packn.c │ │ ├── maxpool_3x3_fp32.c │ │ ├── maxpool_3x3_fp32_packn.c │ │ ├── maxpool_fp32_nhwc.c │ │ ├── maxpool_fp32_packn.c │ │ ├── mul.c │ │ ├── pad.c │ │ ├── prelu.c │ │ ├── relu.c │ │ ├── relu6.c │ │ ├── reshape.c │ │ ├── rms_norm.c │ │ ├── rope.c │ │ ├── rvv_mathfun_fp32.h │ │ ├── scaled_dot_product_attention.c │ │ ├── sigmoid.c │ │ ├── silu.c │ │ ├── softmax.c │ │ ├── split.c │ │ ├── sub.c │ │ └── transpose.c │ ├── int32 │ │ └── embedding.c │ ├── int4 │ │ ├── convolution.c │ │ ├── convolution_1x1_int4.c │ │ ├── convolution_1x1_int4_packn.c │ │ ├── convolution_gemm_int4.c │ │ ├── convolution_gemm_int4_packn.c │ │ ├── depthwise_convolution.c │ │ ├── depthwise_convolution_3x3_int4.c │ │ ├── fullyconnected_int4.c │ │ ├── gemm_int4_dot.c │ │ └── gemm_int4_dot_packn.c │ ├── int8 │ │ ├── add.c │ │ ├── avgpool.c │ │ ├── avgpool_2x2_int8_packn.c │ │ ├── avgpool_3x3_int8_packn.c │ │ ├── avgpool_int8_nhwc.c │ │ ├── avgpool_int8_packn.c │ │ ├── clip.c │ │ ├── concat.c │ │ ├── convolution.c │ │ ├── convolution1d.c │ │ ├── convolution1d_1_int8.c │ │ ├── convolution_1x1_int8.c │ │ ├── convolution_1x1_int8_pack1ton.c │ │ ├── convolution_1x1_int8_packn.c │ │ ├── convolution_1x1_int8_packnto1.c │ │ ├── convolution_3x3_int8_packn.c │ │ ├── convolution_gemm_int8.c │ │ ├── convolution_gemm_int8_pack1ton.c │ │ ├── convolution_gemm_int8_packn.c │ │ ├── convolution_gemm_int8_packnto1.c │ │ ├── depthwise_convolution.c │ │ ├── depthwise_convolution1d_int8.c │ │ ├── depthwise_convolution_3x3_int8.c │ │ ├── depthwise_convolution_3x3_int8_packn.c │ │ ├── depthwise_convolution_int8_nhwc.c │ │ ├── depthwise_convolution_int8_packn.c │ │ ├── div.c │ │ ├── erf.c │ │ ├── fullyconnected.c │ │ ├── fullyconnected_int8.c │ │ ├── gather.c │ │ ├── gemm_int8.c │ │ ├── gemm_int8_4xn.c │ │ ├── gemm_int8_a0b1.c │ │ ├── gemm_int8_dot.c │ │ ├── gemm_int8_dot_packn.c │ │ ├── gemm_int8_packn.c │ │ ├── global_avgpool_nhwc.c │ │ ├── global_avgpool_packn.c │ │ ├── global_maxpool_nhwc.c │ │ ├── global_maxpool_packn.c │ │ ├── layer_norm.c │ │ ├── leaky_relu.c │ │ ├── matmul.c │ │ ├── matmul_int8.c │ │ ├── matmul_int8_dot.c │ │ ├── maxpool.c │ │ ├── maxpool_2x2_int8.c │ │ ├── maxpool_2x2_int8_packn.c │ │ ├── maxpool_3x3_int8.c │ │ ├── maxpool_3x3_int8_packn.c │ │ ├── maxpool_int8_nhwc.c │ │ ├── maxpool_int8_packn.c │ │ ├── mul.c │ │ ├── pad.c │ │ ├── prelu.c │ │ ├── reduce_sum.c │ │ ├── relu.c │ │ ├── relu6.c │ │ ├── reshape.c │ │ ├── rms_norm.c │ │ ├── sigmoid.c │ │ ├── silu.c │ │ ├── softmax.c │ │ ├── split.c │ │ ├── sub.c │ │ └── transpose.c │ ├── performance.c │ ├── reorder.c │ ├── setup.c │ └── utils.c ├── tvm_gen │ ├── setup.c │ └── utils.c └── utils │ ├── atat_malloc.c │ ├── debug.c │ ├── export.c │ ├── export_json_wrapper.cpp │ ├── export_json_wrapper.h │ ├── memory.c │ ├── multithread.c │ └── shl_profiler.c ├── tests ├── Makefile ├── autotest │ ├── conftest.py │ ├── interface_test.py │ └── pytest.ini ├── ci_trigger_test.sh ├── llm │ ├── Makefile │ ├── c920_llama2_quantize.c │ ├── convert │ │ ├── gguf-py │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── gguf │ │ │ │ ├── __init__.py │ │ │ │ ├── gguf.py │ │ │ │ └── py.typed │ │ │ ├── pyproject.toml │ │ │ └── tests │ │ │ │ └── test_gguf.py │ │ └── shl-convert.py │ ├── llama2.c │ ├── llama2_quantize.c │ └── model-f16.c ├── onnx_ref │ ├── onnx_utlis.py │ └── ref.py ├── profiler │ ├── Makefile │ └── test_trace.c ├── python_ref │ ├── abs.py │ ├── acos.py │ ├── acosh.py │ ├── add.py │ ├── add_graph.py │ ├── and.py │ ├── arange.py │ ├── argmax.py │ ├── argmax_stride.py │ ├── argmin_stride.py │ ├── asin.py │ ├── asinh.py │ ├── atan.py │ ├── atanh.py │ ├── averagepool3d.py │ ├── averagepool_nchw.py │ ├── averagepool_nhwc.py │ ├── averagepool_vlen.py │ ├── batch_norm.py │ ├── batch_norm_nchw.py │ ├── batch_to_space.py │ ├── batch_to_space_nd.py │ ├── batch_to_space_nd_nchw.py │ ├── broadcast_to.py │ ├── caffe │ │ ├── psroipooling │ │ │ ├── psroipooling.py │ │ │ └── test.py │ │ ├── roipooling │ │ │ ├── roipooling.py │ │ │ └── test.py │ │ └── train.lmdb │ │ │ ├── data.mdb │ │ │ └── lock.mdb │ ├── ceil.py │ ├── clip.py │ ├── concat.py │ ├── convolution1d.py │ ├── convolution1d_ncw.py │ ├── convolution1d_vlen.py │ ├── convolution3d.py │ ├── convolution_nchw.py │ ├── convolution_nhwc.py │ ├── convolution_relu.py │ ├── convolution_relu6.py │ ├── convolution_relu6_nchw.py │ ├── convolution_relu_nchw.py │ ├── convolution_vlen.py │ ├── cos.py │ ├── cosh.py │ ├── crop.py │ ├── cumprod.py │ ├── cumsum.py │ ├── deconvolution.py │ ├── deconvolution3d.py │ ├── deconvolution_nchw.py │ ├── deconvolution_vlen.py │ ├── depth_to_space.py │ ├── depthwise_convolution1d_ncw.py │ ├── depthwise_convolution_nchw.py │ ├── depthwise_convolution_nchw_pack4.py │ ├── depthwise_convolution_nhwc.py │ ├── depthwise_convolution_relu.py │ ├── depthwise_convolution_relu6.py │ ├── depthwise_convolution_relu6_nchw.py │ ├── depthwise_convolution_relu_nchw.py │ ├── depthwise_convolution_vlen.py │ ├── depthwise_deconvolution.py │ ├── depthwise_deconvolution_nchw.py │ ├── dequantize.py │ ├── div.py │ ├── element_wise_op.py │ ├── elu.py │ ├── equal.py │ ├── erf.py │ ├── exp.py │ ├── expand_dims.py │ ├── expm1.py │ ├── flatten.py │ ├── floor.py │ ├── floor_div.py │ ├── floor_mod.py │ ├── fullyconnected.py │ ├── fullyconnected_relu.py │ ├── gather.py │ ├── gather_nd.py │ ├── global_avgpool_nchw.py │ ├── global_avgpool_nhwc.py │ ├── global_avgpool_vlen.py │ ├── global_maxpool_nchw.py │ ├── global_maxpool_nhwc.py │ ├── global_maxpool_vlen.py │ ├── greater.py │ ├── greater_equal.py │ ├── group_convolution.py │ ├── group_convolution_nchw.py │ ├── group_convolution_relu.py │ ├── group_convolution_relu6.py │ ├── group_convolution_relu6_nchw.py │ ├── group_convolution_relu_nchw.py │ ├── group_convolution_vlen.py │ ├── hard_sigmoid.py │ ├── im2col.py │ ├── instance_norm.py │ ├── is_nan.py │ ├── l2_norm.py │ ├── l2_norm_anole.py │ ├── l2_norm_graph.py │ ├── l2_pool.py │ ├── l2_pool_nchw.py │ ├── layer_norm.py │ ├── leaky_relu.py │ ├── less.py │ ├── less_equal.py │ ├── log.py │ ├── log1p.py │ ├── log_softmax.py │ ├── logical_and.py │ ├── logical_not.py │ ├── logical_or.py │ ├── logical_xor.py │ ├── lrn.py │ ├── lrn_caffe.py │ ├── matmul.py │ ├── matmul_vlen.py │ ├── max_graph.py │ ├── max_pool_with_argmax.py │ ├── max_stride.py │ ├── max_unpool.py │ ├── maximum.py │ ├── maxpool3d.py │ ├── maxpool_nchw.py │ ├── maxpool_nhwc.py │ ├── maxpool_vlen.py │ ├── mean_graph.py │ ├── mean_stride.py │ ├── min_graph.py │ ├── min_stride.py │ ├── minimum.py │ ├── mod.py │ ├── mul.py │ ├── ndarray_size.py │ ├── negative.py │ ├── non_max_suppression.py │ ├── not.py │ ├── not_equal.py │ ├── or.py │ ├── pad.py │ ├── pad_nchw.py │ ├── pow.py │ ├── prelu.py │ ├── prelu_nhwc.py │ ├── prod_graph.py │ ├── prod_stride.py │ ├── psroipool_caffe.py │ ├── reduce_logsumexp.py │ ├── reduce_max.py │ ├── reduce_mean.py │ ├── reduce_min.py │ ├── reduce_prod.py │ ├── reduce_sum.py │ ├── relu.py │ ├── relu1.py │ ├── relu6.py │ ├── relu_fp16.py │ ├── relun.py │ ├── reorg.py │ ├── reshape.py │ ├── resize_bilinear.py │ ├── resize_bilinear_nchw.py │ ├── resize_nearestneighbor.py │ ├── resize_nearestneighbor_nchw.py │ ├── reverse.py │ ├── rms_norm.py │ ├── roialign.py │ ├── roipool_caffe.py │ ├── round.py │ ├── rsqrt.py │ ├── segment_max.py │ ├── segment_mean.py │ ├── segment_min.py │ ├── segment_prod.py │ ├── segment_sum.py │ ├── select.py │ ├── shuffle_channel.py │ ├── shuffle_channel_nchw.py │ ├── sigmoid.py │ ├── sign.py │ ├── silu.py │ ├── sin.py │ ├── sinh.py │ ├── slice.py │ ├── softmax.py │ ├── softplus.py │ ├── softrelu.py │ ├── softsign.py │ ├── space_to_batch.py │ ├── space_to_batch_nd.py │ ├── space_to_batch_nd_nchw.py │ ├── space_to_depth.py │ ├── split.py │ ├── sqrt.py │ ├── square.py │ ├── squeeze.py │ ├── stack.py │ ├── strided_slice.py │ ├── sub.py │ ├── sum_graph.py │ ├── sum_stride.py │ ├── tan.py │ ├── tanh.py │ ├── threshold_relu.py │ ├── tile.py │ ├── topk.py │ ├── transpose.py │ ├── transpose_vlen.py │ ├── trunc.py │ ├── unsorted_segment_max.py │ ├── unsorted_segment_mean.py │ ├── unsorted_segment_min.py │ ├── unsorted_segment_prod.py │ ├── unsorted_segment_sum.py │ ├── unstack.py │ ├── where.py │ ├── where_softmax.py │ ├── xor.py │ └── yuv_rgb_scale.py ├── unit_test │ ├── Makefile.rvv │ ├── add.c │ ├── avgpool.c │ ├── concat.c │ ├── conv2d_1x1s1_gemm.c │ ├── conv2d_im2col_gemm.c │ ├── conv2d_winograd.c │ ├── dwconv2d.c │ ├── fullyconnected.c │ ├── gemm.c │ ├── leaky_relu.c │ ├── maxpool.c │ ├── mul.c │ ├── pad.c │ ├── relu.c │ └── valid_data │ │ ├── activation.dat │ │ ├── avgpool.dat │ │ ├── basic_math.dat │ │ ├── concat.dat │ │ ├── conv2d.dat │ │ ├── dwconv2d.dat │ │ ├── fullyconnected.dat │ │ ├── gemm.dat │ │ ├── maxpool.dat │ │ └── pad.dat ├── utils │ ├── test_utils.c │ └── test_utils.h ├── valid_run.sh ├── validation │ ├── Makefile.c906 │ ├── Makefile.ref │ ├── Makefile.ref_x86 │ ├── abs_f32.c │ ├── abs_i8.c │ ├── abs_u8.c │ ├── acos_f32.c │ ├── acos_i8.c │ ├── acos_u8.c │ ├── acosh_f32.c │ ├── acosh_i8.c │ ├── acosh_u8.c │ ├── add_f32.c │ ├── add_i8.c │ ├── add_u8.c │ ├── and_u32.c │ ├── arange_f32.c │ ├── arange_i8.c │ ├── arange_u8.c │ ├── argmax_stride_f32.c │ ├── argmax_stride_u8.c │ ├── argmin_stride_f32.c │ ├── argmin_stride_u8.c │ ├── asin_f32.c │ ├── asin_i8.c │ ├── asin_u8.c │ ├── asinh_f32.c │ ├── asinh_i8.c │ ├── asinh_u8.c │ ├── atan_f32.c │ ├── atan_i8.c │ ├── atan_u8.c │ ├── atanh_f32.c │ ├── atanh_i8.c │ ├── atanh_u8.c │ ├── averagepool3d_f32.c │ ├── averagepool3d_i8.c │ ├── averagepool3d_u8.c │ ├── averagepool_f32.c │ ├── averagepool_i8.c │ ├── averagepool_nchw_f32.c │ ├── averagepool_nchw_i8.c │ ├── averagepool_nchw_u8.c │ ├── averagepool_u8.c │ ├── batch_norm_f32.c │ ├── batch_norm_i8.c │ ├── batch_norm_u8.c │ ├── batch_to_space_f32.c │ ├── batch_to_space_i8.c │ ├── batch_to_space_u8.c │ ├── broadcast_to_f32.c │ ├── broadcast_to_i8.c │ ├── broadcast_to_u8.c │ ├── ceil_f32.c │ ├── ceil_i8.c │ ├── ceil_u8.c │ ├── clip_f32.c │ ├── clip_i8.c │ ├── clip_u8.c │ ├── concat_f32.c │ ├── concat_i8.c │ ├── concat_u8.c │ ├── convolution3d_f32.c │ ├── convolution3d_i8.c │ ├── convolution3d_u8.c │ ├── convolution_channel_nchw_i8.c │ ├── convolution_channel_nchw_u8.c │ ├── convolution_f32.c │ ├── convolution_i8.c │ ├── convolution_nchw_f32.c │ ├── convolution_nchw_i8.c │ ├── convolution_nchw_u8.c │ ├── convolution_relu6_i8.c │ ├── convolution_relu6_nchw_i8.c │ ├── convolution_relu6_nchw_u8.c │ ├── convolution_relu6_u8.c │ ├── convolution_relu_i8.c │ ├── convolution_relu_nchw_i8.c │ ├── convolution_relu_nchw_u8.c │ ├── convolution_relu_u8.c │ ├── convolution_u8.c │ ├── cos_f32.c │ ├── cos_i8.c │ ├── cos_u8.c │ ├── cosh_f32.c │ ├── cosh_i8.c │ ├── cosh_u8.c │ ├── cumprod_f32.c │ ├── cumprod_i8.c │ ├── cumprod_u8.c │ ├── cumsum_f32.c │ ├── cumsum_i8.c │ ├── cumsum_u8.c │ ├── deconvolution3d_f32.c │ ├── deconvolution3d_u8.c │ ├── deconvolution_f32.c │ ├── deconvolution_i8.c │ ├── deconvolution_nchw_f32.c │ ├── deconvolution_nchw_i8.c │ ├── deconvolution_nchw_u8.c │ ├── deconvolution_u8.c │ ├── depth_to_space_f32.c │ ├── depth_to_space_i8.c │ ├── depth_to_space_u8.c │ ├── depthwise_convolution_f32.c │ ├── depthwise_convolution_i8.c │ ├── depthwise_convolution_nchw_f32.c │ ├── depthwise_convolution_nchw_i8.c │ ├── depthwise_convolution_nchw_u8.c │ ├── depthwise_convolution_relu6_i8.c │ ├── depthwise_convolution_relu6_nchw_i8.c │ ├── depthwise_convolution_relu6_nchw_u8.c │ ├── depthwise_convolution_relu6_u8.c │ ├── depthwise_convolution_relu_i8.c │ ├── depthwise_convolution_relu_nchw_i8.c │ ├── depthwise_convolution_relu_nchw_u8.c │ ├── depthwise_convolution_relu_u8.c │ ├── depthwise_convolution_u8.c │ ├── depthwise_deconvolution_f32.c │ ├── depthwise_deconvolution_i8.c │ ├── depthwise_deconvolution_nchw_f32.c │ ├── depthwise_deconvolution_nchw_u8.c │ ├── depthwise_deconvolution_u8.c │ ├── div_f32.c │ ├── div_i8.c │ ├── div_u8.c │ ├── elu_f32.c │ ├── elu_i8.c │ ├── elu_u8.c │ ├── equal_f32.c │ ├── equal_i8.c │ ├── equal_u8.c │ ├── erf_f32.c │ ├── erf_i8.c │ ├── erf_u8.c │ ├── exp_f32.c │ ├── exp_i8.c │ ├── exp_u8.c │ ├── expand_dims_f32.c │ ├── expand_dims_i8.c │ ├── expand_dims_u8.c │ ├── expm1_f32.c │ ├── expm1_i8.c │ ├── expm1_u8.c │ ├── flatten_f32.c │ ├── flatten_i8.c │ ├── flatten_u8.c │ ├── floor_div_f32.c │ ├── floor_div_i8.c │ ├── floor_div_u8.c │ ├── floor_f32.c │ ├── floor_i8.c │ ├── floor_mod_f32.c │ ├── floor_mod_i8.c │ ├── floor_mod_u8.c │ ├── floor_u8.c │ ├── fullyconnected_f32.c │ ├── fullyconnected_i8.c │ ├── fullyconnected_u8.c │ ├── gather_f32.c │ ├── gather_i8.c │ ├── gather_nd_f32.c │ ├── gather_nd_i8.c │ ├── gather_nd_u8.c │ ├── gather_u8.c │ ├── global_avgpool_i8.c │ ├── global_avgpool_nchw_i8.c │ ├── global_avgpool_nchw_u8.c │ ├── global_avgpool_u8.c │ ├── global_maxpool_i8.c │ ├── global_maxpool_nchw_i8.c │ ├── global_maxpool_nchw_u8.c │ ├── global_maxpool_u8.c │ ├── greater_equal_f32.c │ ├── greater_equal_i8.c │ ├── greater_equal_u8.c │ ├── greater_f32.c │ ├── greater_i8.c │ ├── greater_u8.c │ ├── group_convolution_f32.c │ ├── group_convolution_i8.c │ ├── group_convolution_nchw_f32.c │ ├── group_convolution_nchw_i8.c │ ├── group_convolution_nchw_u8.c │ ├── group_convolution_relu6_i8.c │ ├── group_convolution_relu6_nchw_i8.c │ ├── group_convolution_relu6_nchw_u8.c │ ├── group_convolution_relu6_u8.c │ ├── group_convolution_relu_i8.c │ ├── group_convolution_relu_nchw_i8.c │ ├── group_convolution_relu_nchw_u8.c │ ├── group_convolution_relu_u8.c │ ├── group_convolution_u8.c │ ├── hard_sigmoid_f32.c │ ├── hard_sigmoid_i8.c │ ├── hard_sigmoid_u8.c │ ├── im2col_f32.c │ ├── im2col_i8.c │ ├── im2col_u8.c │ ├── is_nan_f32.c │ ├── l2_norm_f32.c │ ├── l2_norm_i8.c │ ├── l2_norm_u8.c │ ├── leaky_relu_f32.c │ ├── leaky_relu_i8.c │ ├── leaky_relu_u8.c │ ├── less_equal_f32.c │ ├── less_equal_i8.c │ ├── less_equal_u8.c │ ├── less_f32.c │ ├── less_i8.c │ ├── less_u8.c │ ├── log1p_f32.c │ ├── log1p_i8.c │ ├── log1p_u8.c │ ├── log_f32.c │ ├── log_i8.c │ ├── log_softmax_f32.c │ ├── log_softmax_i8.c │ ├── log_softmax_u8.c │ ├── log_u8.c │ ├── logical_and_f32.c │ ├── logical_and_i8.c │ ├── logical_and_u8.c │ ├── logical_not_f32.c │ ├── logical_not_i8.c │ ├── logical_not_u8.c │ ├── logical_or_f32.c │ ├── logical_or_i8.c │ ├── logical_or_u8.c │ ├── logical_xor_f32.c │ ├── logical_xor_i8.c │ ├── logical_xor_u8.c │ ├── lrn_f32.c │ ├── lrn_i8.c │ ├── lrn_u8.c │ ├── matmul_f32.c │ ├── matmul_i8.c │ ├── matmul_u8.c │ ├── max_stride_f32.c │ ├── max_stride_u8.c │ ├── maximum_f32.c │ ├── maximum_i8.c │ ├── maximum_u8.c │ ├── maxpool3d_f32.c │ ├── maxpool3d_i8.c │ ├── maxpool3d_u8.c │ ├── maxpool_f32.c │ ├── maxpool_nchw_f32.c │ ├── maxpool_u8.c │ ├── mean_stride_f32.c │ ├── mean_stride_u8.c │ ├── min_stride_f32.c │ ├── min_stride_u8.c │ ├── minimum_f32.c │ ├── minimum_i8.c │ ├── minimum_u8.c │ ├── mod_f32.c │ ├── mod_i8.c │ ├── mod_u8.c │ ├── mul_f32.c │ ├── mul_i8.c │ ├── mul_u8.c │ ├── ndarray_size_f32.c │ ├── ndarray_size_i8.c │ ├── ndarray_size_u8.c │ ├── negative_f32.c │ ├── negative_i8.c │ ├── negative_u8.c │ ├── non_max_suppression_f32.c │ ├── not_equal_f32.c │ ├── not_equal_i8.c │ ├── not_equal_u8.c │ ├── not_f32.c │ ├── not_u32.c │ ├── or_u32.c │ ├── pad_f32.c │ ├── pad_nchw_f32.c │ ├── pad_nchw_u8.c │ ├── pad_u8.c │ ├── pow_f32.c │ ├── pow_i8.c │ ├── pow_u8.c │ ├── prelu_f32.c │ ├── prelu_i8.c │ ├── prelu_nhwc_f32.c │ ├── prelu_nhwc_i8.c │ ├── prelu_nhwc_u8.c │ ├── prelu_u8.c │ ├── prod_stride_f32.c │ ├── prod_stride_u8.c │ ├── psroipooling_f32.c │ ├── psroipooling_u8.c │ ├── reduce_logsumexp_f32.c │ ├── reduce_logsumexp_i8.c │ ├── reduce_logsumexp_u8.c │ ├── reduce_max_f32.c │ ├── reduce_max_i8.c │ ├── reduce_max_u8.c │ ├── reduce_mean_f32.c │ ├── reduce_mean_i8.c │ ├── reduce_mean_u8.c │ ├── reduce_min_f32.c │ ├── reduce_min_i8.c │ ├── reduce_min_u8.c │ ├── reduce_prod_f32.c │ ├── reduce_prod_i8.c │ ├── reduce_prod_u8.c │ ├── reduce_sum_f32.c │ ├── reduce_sum_i8.c │ ├── reduce_sum_u8.c │ ├── relu1_f32.c │ ├── relu1_i8.c │ ├── relu1_u8.c │ ├── relu6_f32.c │ ├── relu6_i8.c │ ├── relu6_u8.c │ ├── relu_f32.c │ ├── relu_i8.c │ ├── relu_u8.c │ ├── relun_f32.c │ ├── relun_i8.c │ ├── relun_u8.c │ ├── reshape_f32.c │ ├── resize_bilinear_f32.c │ ├── resize_bilinear_i8.c │ ├── resize_bilinear_u8.c │ ├── resize_nearestneighbor_f32.c │ ├── resize_nearestneighbor_i8.c │ ├── resize_nearestneighbor_nchw_f32.c │ ├── resize_nearestneighbor_nchw_i8.c │ ├── resize_nearestneighbor_nchw_u8.c │ ├── resize_nearestneighbor_u8.c │ ├── reverse_f32.c │ ├── reverse_i8.c │ ├── reverse_u8.c │ ├── riscv_xt9xx │ │ └── relu_fp16.c │ ├── roialign_f32.c │ ├── roipooling_f32.c │ ├── roipooling_u8.c │ ├── round_f32.c │ ├── round_i8.c │ ├── round_u8.c │ ├── rsqrt_f32.c │ ├── rsqrt_i8.c │ ├── rsqrt_u8.c │ ├── segment_max_f32.c │ ├── segment_max_i8.c │ ├── segment_max_u8.c │ ├── segment_mean_f32.c │ ├── segment_mean_i8.c │ ├── segment_mean_u8.c │ ├── segment_min_f32.c │ ├── segment_min_i8.c │ ├── segment_min_u8.c │ ├── segment_prod_f32.c │ ├── segment_prod_i8.c │ ├── segment_prod_u8.c │ ├── segment_sum_f32.c │ ├── segment_sum_i8.c │ ├── segment_sum_u8.c │ ├── select_f32.c │ ├── select_i8.c │ ├── select_u8.c │ ├── shuffle_channel_f32.c │ ├── shuffle_channel_i8.c │ ├── shuffle_channel_nchw_f32.c │ ├── shuffle_channel_nchw_i8.c │ ├── shuffle_channel_nchw_u8.c │ ├── shuffle_channel_u8.c │ ├── sigmoid_f32.c │ ├── sigmoid_i8.c │ ├── sigmoid_u8.c │ ├── sign_f32.c │ ├── sin_f32.c │ ├── sin_i8.c │ ├── sin_u8.c │ ├── sinh_f32.c │ ├── sinh_i8.c │ ├── sinh_u8.c │ ├── slice_f32.c │ ├── slice_i8.c │ ├── slice_u8.c │ ├── softmax_f32.c │ ├── softmax_i8.c │ ├── softmax_u8.c │ ├── softplus_f32.c │ ├── softplus_i8.c │ ├── softplus_u8.c │ ├── softrelu_f32.c │ ├── softrelu_i8.c │ ├── softrelu_u8.c │ ├── softsign_f32.c │ ├── softsign_i8.c │ ├── softsign_u8.c │ ├── space_to_batch_f32.c │ ├── space_to_batch_i8.c │ ├── space_to_batch_u8.c │ ├── space_to_depth_f32.c │ ├── space_to_depth_i8.c │ ├── space_to_depth_u8.c │ ├── split_f32.c │ ├── sqrt_f32.c │ ├── sqrt_i8.c │ ├── sqrt_u8.c │ ├── square_f32.c │ ├── squeeze_f32.c │ ├── squeeze_i8.c │ ├── squeeze_u8.c │ ├── stack_f32.c │ ├── stack_i8.c │ ├── stack_u8.c │ ├── strided_slice_f32.c │ ├── strided_slice_i8.c │ ├── strided_slice_u8.c │ ├── sub_f32.c │ ├── sub_i8.c │ ├── sub_u8.c │ ├── sum_stride_f32.c │ ├── sum_stride_u8.c │ ├── tan_f32.c │ ├── tan_i8.c │ ├── tan_u8.c │ ├── tanh_f32.c │ ├── tanh_i8.c │ ├── tanh_u8.c │ ├── threshold_relu_f32.c │ ├── threshold_relu_i8.c │ ├── threshold_relu_u8.c │ ├── tile_f32.c │ ├── tile_i8.c │ ├── tile_u8.c │ ├── topk_f32.c │ ├── topk_i8.c │ ├── topk_u8.c │ ├── transpose_f32.c │ ├── transpose_i8.c │ ├── transpose_u8.c │ ├── trunc_f32.c │ ├── trunc_i8.c │ ├── trunc_u8.c │ ├── unsorted_segment_max_f32.c │ ├── unsorted_segment_max_i8.c │ ├── unsorted_segment_max_u8.c │ ├── unsorted_segment_mean_f32.c │ ├── unsorted_segment_mean_i8.c │ ├── unsorted_segment_mean_u8.c │ ├── unsorted_segment_min_f32.c │ ├── unsorted_segment_min_i8.c │ ├── unsorted_segment_min_u8.c │ ├── unsorted_segment_prod_f32.c │ ├── unsorted_segment_prod_i8.c │ ├── unsorted_segment_prod_u8.c │ ├── unsorted_segment_sum_f32.c │ ├── unsorted_segment_sum_i8.c │ ├── unsorted_segment_sum_u8.c │ ├── unstack_f32.c │ ├── unstack_i8.c │ ├── unstack_u8.c │ ├── xor_u32.c │ ├── yuv_rgb_scale_f32.c │ ├── yuv_rgb_scale_i8.c │ └── yuv_rgb_scale_u8.c ├── validation_graph │ ├── Makefile.pnna │ ├── add.c │ ├── argmax.c │ ├── avgpool.c │ ├── batch_normalization.c │ ├── batch_to_space_nd.c │ ├── c906 │ │ ├── Makefile │ │ ├── add.c │ │ ├── avgpool.c │ │ ├── concat.c │ │ ├── convolution.c │ │ ├── deconvolution.c │ │ ├── depth_to_space.c │ │ ├── depthwise_convolution.c │ │ ├── div.c │ │ ├── flatten.c │ │ ├── fullyconnected.c │ │ ├── gen_test_data.sh │ │ ├── global_avgpool.c │ │ ├── global_maxpool.c │ │ ├── group_convolution.c │ │ ├── leaky_relu.c │ │ ├── maximum.c │ │ ├── maxpool.c │ │ ├── minimum.c │ │ ├── pad.c │ │ ├── relu.c │ │ ├── relu1.c │ │ ├── relu6.c │ │ ├── reshape.c │ │ ├── resize_bilinear.c │ │ ├── resize_nearest_neighbor.c │ │ ├── run_test_x86.sh │ │ ├── sigmoid.c │ │ ├── space_to_depth.c │ │ ├── split.c │ │ ├── squeeze.c │ │ ├── sub.c │ │ ├── tanh.c │ │ └── transpose.c │ ├── concat.c │ ├── convolution.c │ ├── crop.c │ ├── deconvolution.c │ ├── depth_to_space.c │ ├── depthwise_convolution.c │ ├── div.c │ ├── flatten.c │ ├── fullyconnected.c │ ├── global_avgpool.c │ ├── global_maxpool.c │ ├── group_convolution.c │ ├── hlight │ │ ├── Makefile │ │ ├── run.sh │ │ └── test_subgraph.c │ ├── l2_normalization.c │ ├── leaky_relu.c │ ├── lrn.c │ ├── maximum.c │ ├── maxpool.c │ ├── mean.c │ ├── minimum.c │ ├── mul.c │ ├── negative.c │ ├── pad.c │ ├── prelu.c │ ├── relu.c │ ├── relu1.c │ ├── relu6.c │ ├── reshape.c │ ├── resize_bilinear.c │ ├── resize_nearest_neighbor.c │ ├── sigmoid.c │ ├── softmax.c │ ├── space_to_batch_nd.c │ ├── space_to_depth.c │ ├── split.c │ ├── squeeze.c │ ├── strided_slice.c │ ├── sub.c │ ├── tanh.c │ ├── th1520 │ │ ├── Makefile │ │ ├── add.c │ │ ├── argmax.c │ │ ├── avgpool.c │ │ ├── batch_normalization.c │ │ ├── batch_to_space_nd.c │ │ ├── concat.c │ │ ├── convolution.c │ │ ├── crop.c │ │ ├── deconvolution.c │ │ ├── depth_to_space.c │ │ ├── depthwise_convolution.c │ │ ├── div.c │ │ ├── flatten.c │ │ ├── fullyconnected.c │ │ ├── gen_test_data.sh │ │ ├── global_avgpool.c │ │ ├── global_maxpool.c │ │ ├── group_convolution.c │ │ ├── l2_normalization.c │ │ ├── leaky_relu.c │ │ ├── lrn.c │ │ ├── maximum.c │ │ ├── maxpool.c │ │ ├── mean.c │ │ ├── minimum.c │ │ ├── mul.c │ │ ├── negative.c │ │ ├── pad.c │ │ ├── prelu.c │ │ ├── relu.c │ │ ├── relu1.c │ │ ├── relu6.c │ │ ├── reshape.c │ │ ├── resize_bilinear.c │ │ ├── resize_nearest_neighbor.c │ │ ├── run_test_x86.sh │ │ ├── sigmoid.c │ │ ├── softmax.c │ │ ├── space_to_batch_nd.c │ │ ├── space_to_depth.c │ │ ├── split.c │ │ ├── squeeze.c │ │ ├── strided_slice.c │ │ ├── sub.c │ │ ├── tanh.c │ │ └── transpose.c │ ├── transpose.c │ └── tvmgen │ │ ├── Makefile │ │ ├── callback.c │ │ ├── reg.c │ │ └── run.sh ├── validation_layer │ ├── .gdbinit │ ├── Makefile.c906 │ ├── Makefile.c908 │ ├── Makefile.c920 │ ├── Makefile.c920v2 │ ├── Makefile.rvm │ ├── Makefile.rvv │ ├── Makefile.rvv_nodot │ ├── abs.cpp │ ├── acos.c │ ├── acosh.c │ ├── add.cpp │ ├── and.c │ ├── arange.c │ ├── argmax.c │ ├── argmin.c │ ├── asin.c │ ├── asinh.c │ ├── atan.c │ ├── atanh.c │ ├── averagepool.cpp │ ├── averagepool3d.c │ ├── averagepool_nhwc.cpp │ ├── batch_norm.c │ ├── batch_to_space.c │ ├── broadcast_to.c │ ├── broadcast_to.cpp │ ├── ceil.c │ ├── clip.cpp │ ├── concat.cpp │ ├── convolution.cpp │ ├── convolution1d.cpp │ ├── convolution3d.c │ ├── convolution_nhwc.cpp │ ├── convolution_relu.c │ ├── convolution_relu6.c │ ├── cos.c │ ├── cosh.c │ ├── cumprod.c │ ├── cumsum.c │ ├── deconvolution.c │ ├── deconvolution.cpp │ ├── deconvolution3d.c │ ├── depth_to_space.c │ ├── depthwise_convolution.cpp │ ├── depthwise_convolution1d.cpp │ ├── depthwise_convolution_nhwc.cpp │ ├── depthwise_convolution_relu.c │ ├── depthwise_convolution_relu6.c │ ├── depthwise_deconvolution.c │ ├── div.c │ ├── div.cpp │ ├── elu.c │ ├── equal.c │ ├── erf.c │ ├── erf.cpp │ ├── exp.c │ ├── expand_dims.c │ ├── expm1.c │ ├── flatten.c │ ├── floor.c │ ├── floor_div.c │ ├── floor_mod.c │ ├── fullyconnected.cpp │ ├── gather.c │ ├── gather.cpp │ ├── gather_nd.c │ ├── global_avgpool.cpp │ ├── global_avgpool_nhwc.cpp │ ├── global_maxpool.cpp │ ├── global_maxpool_nhwc.cpp │ ├── greater.c │ ├── greater_equal.c │ ├── group_convolution.cpp │ ├── group_convolution_relu.c │ ├── group_convolution_relu6.c │ ├── hard_sigmoid.c │ ├── im2col.c │ ├── l2_norm.c │ ├── layer │ │ ├── common.c │ │ └── common.h │ ├── layer_norm.cpp │ ├── leaky_relu.cpp │ ├── less.c │ ├── less_equal.c │ ├── log.c │ ├── log1p.c │ ├── log_softmax.c │ ├── logical_and.c │ ├── logical_not.c │ ├── logical_or.c │ ├── logical_xor.c │ ├── lrn.c │ ├── lrn.cpp │ ├── matmul.c │ ├── matmul.cpp │ ├── max_stride.c │ ├── maximum.c │ ├── maxpool.cpp │ ├── maxpool3d.c │ ├── maxpool_nhwc.cpp │ ├── mean_stride.c │ ├── mean_stride.cpp │ ├── min_stride.c │ ├── minimum.c │ ├── minimum.cpp │ ├── mod.c │ ├── mul.cpp │ ├── negative.c │ ├── non_max_suppression.c │ ├── not.c │ ├── not_equal.c │ ├── pad.cpp │ ├── power.c │ ├── power.cpp │ ├── prelu.c │ ├── prelu.cpp │ ├── prod_stride.c │ ├── psroipooling.c │ ├── reduce_logsumexp.c │ ├── reduce_max.c │ ├── reduce_mean.c │ ├── reduce_min.c │ ├── reduce_prod.c │ ├── reduce_sum.c │ ├── reduce_sum.cpp │ ├── relu.cpp │ ├── relu1.c │ ├── relu1.cpp │ ├── relu6.cpp │ ├── relun.c │ ├── reshape.c │ ├── reshape.cpp │ ├── resize_bilinear.c │ ├── resize_nearestneighbor.c │ ├── reverse.c │ ├── rms_norm.cpp │ ├── roialign.c │ ├── roipooling.c │ ├── round.c │ ├── rsqrt.c │ ├── segment_max.c │ ├── segment_mean.c │ ├── segment_min.c │ ├── segment_prod.c │ ├── segment_sum.c │ ├── select.c │ ├── shuffle_channel.c │ ├── sigmoid.cpp │ ├── sign.c │ ├── silu.cpp │ ├── sin.c │ ├── sinh.c │ ├── slice.c │ ├── softmax.cpp │ ├── softplus.c │ ├── softrelu.c │ ├── softsign.c │ ├── space_to_batch.c │ ├── space_to_depth.c │ ├── split.c │ ├── split.cpp │ ├── sqrt.c │ ├── sqrt.cpp │ ├── square.c │ ├── squeeze.c │ ├── stack.c │ ├── strided_slice.c │ ├── strided_slice.cpp │ ├── sub.c │ ├── sub.cpp │ ├── sum_stride.cpp │ ├── tan.c │ ├── tanh.c │ ├── testutil.h │ ├── threshold_relu.c │ ├── tile.c │ ├── topk.c │ ├── transpose.c │ ├── transpose.cpp │ ├── trunc.c │ ├── unsorted_segment_max.c │ ├── unsorted_segment_mean.c │ ├── unsorted_segment_min.c │ ├── unsorted_segment_prod.c │ ├── unsorted_segment_sum.c │ ├── unstack.c │ ├── where.cpp │ ├── where_softmax.cpp │ ├── xor.c │ └── yuv_rgb_scale.c └── validation_ref │ ├── deconv2d.py │ ├── instance_norm.py │ └── utils.py └── version /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | 3 | BraceWrapping: 4 | AfterClass: false 5 | AfterControlStatement: false 6 | AfterEnum: false 7 | AfterFunction: true 8 | AfterNamespace: true 9 | AfterObjCDeclaration: false 10 | AfterStruct: false 11 | AfterUnion: false 12 | BeforeCatch: false 13 | BeforeElse: false 14 | IndentBraces: false 15 | 16 | BreakBeforeBraces: Custom 17 | ColumnLimit: 100 18 | DisableFormat: false 19 | IndentWidth: 4 20 | TabWidth: 4 21 | UseTab: Never 22 | 23 | SpacesInAngles: false 24 | SpacesInContainerLiterals: false 25 | SpacesInCStyleCastParentheses: false 26 | SpacesInParentheses: false 27 | SpacesInSquareBrackets: false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio Code 2 | .vscode 3 | 4 | # default install dir 5 | install_nn2 6 | 7 | # tests 8 | tests/python_ref/*.bin 9 | tests/**/*.o 10 | tests/**/*.elf 11 | 12 | # example 13 | example/*.o 14 | example/*.elf 15 | 16 | # default build dir 17 | openvx_build 18 | e907_build 19 | rvv_build 20 | rvm_build 21 | c906_static_build 22 | c906_so_build 23 | c906_elf_build 24 | c908_build 25 | c920_build 26 | th1520_build 27 | pnna_build 28 | android_build 29 | pnna_x86_build 30 | x86_ref_build 31 | c920_build_so/ 32 | x86_ref_build_so/ 33 | c920v2_build/ 34 | 35 | # config files 36 | script/kconfig/__pycache__/ 37 | .config 38 | .config.old 39 | config.cmake 40 | mconf_config.h 41 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "module/dlpack"] 2 | path = module/dlpack 3 | url = https://github.com/dmlc/dlpack.git 4 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | fail_fast: false 2 | repos: 3 | - repo: https://github.com/pocc/pre-commit-hooks 4 | rev: master 5 | hooks: 6 | - id: clang-format 7 | args: [--style=file] 8 | -------------------------------------------------------------------------------- /cmake/target_build.cmake: -------------------------------------------------------------------------------- 1 | if(CONFIG_SHL_BUILD_STATIC) 2 | add_library(${SHL_LIB_TARGET} STATIC ${SHL_BUILD_SRC_LST}) 3 | else() 4 | add_library(${SHL_LIB_TARGET} SHARED ${SHL_BUILD_SRC_LST}) 5 | endif() 6 | SET_TARGET_PROPERTIES(${SHL_LIB_TARGET} PROPERTIES OUTPUT_NAME ${SHL_LIB_NAME}) 7 | SET_TARGET_PROPERTIES(${SHL_LIB_TARGET} PROPERTIES VERSION ${SHL_VERSION}) 8 | SET_TARGET_PROPERTIES(${SHL_LIB_TARGET} PROPERTIES SOVERSION ${SHL_MAJOR_VERSION}) 9 | target_compile_options(${SHL_LIB_TARGET} PRIVATE ${SHL_BUILD_C_FLAGS}) 10 | install(TARGETS ${SHL_LIB_TARGET} DESTINATION lib) 11 | if(CONFIG_SHL_BUILD_STATIC) 12 | install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lib${SHL_LIB_NAME}.a ${a_symlink_target})") 13 | else() 14 | install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lib${SHL_LIB_NAME}.so ${so_symlink_target})") 15 | endif() 16 | -------------------------------------------------------------------------------- /example/Makefile: -------------------------------------------------------------------------------- 1 | 2 | c906_m1_f16: 3 | riscv64-unknown-linux-gnu-gcc c906_mobilenetv1_f16.c -o c906_mobilenetv1_f16.elf -I../include ../install_nn2/lib/libshl_c906.a -lm -static 4 | 5 | clean: 6 | rm -rf *.elf 7 | -------------------------------------------------------------------------------- /include/backend/c920v2/cap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef INCLUDE_SHL_C920V2_CAP_H_ 20 | #define INCLUDE_SHL_C920V2_CAP_H_ 21 | 22 | #include "csi_nn.h" 23 | #include "shl_utils.h" 24 | 25 | int shl_c920v2_conv2d_cap(struct csinn_tensor *input, struct csinn_tensor *output, 26 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 27 | struct csinn_conv2d_params *params); 28 | 29 | #endif // INCLUDE_SHL_C920V2_CAP_H_ 30 | -------------------------------------------------------------------------------- /include/backend/c920v2/perf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef INCLUDE_SHL_C920V2_PERF_H_ 20 | #define INCLUDE_SHL_C920V2_PERF_H_ 21 | 22 | #include "csi_nn.h" 23 | #include "shl_utils.h" 24 | 25 | int shl_c920v2_conv2d_perf(struct csinn_tensor *input, struct csinn_tensor *output, 26 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 27 | struct csinn_conv2d_params *params, struct csinn_perf_info *perf_info); 28 | 29 | #endif // INCLUDE_SHL_C920V2_PERF_H_ 30 | -------------------------------------------------------------------------------- /include/llm/shl_llm_json.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #ifndef INCLUDE_SHL_LLM_JSON_H_ 19 | #define INCLUDE_SHL_LLM_JSON_H_ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include "llm/shl_llm.h" 26 | 27 | struct shl_llm_model *shl_llm_load_json(char *dir_path); 28 | int shl_llm_save_json(char *dir_path, struct shl_llm_model *model); 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif // INCLUDE_SHL_LLM_JSON_H_ 34 | -------------------------------------------------------------------------------- /include/shl_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #ifndef INCLUDE_SHL_MEMORY_H_ 19 | #define INCLUDE_SHL_MEMORY_H_ 20 | 21 | #include 22 | #include 23 | 24 | void shl_mem_print_map(); 25 | void *shl_mem_alloc(int64_t size); 26 | void *shl_mem_alloc_aligned(int64_t size, int aligned_bytes); 27 | void *shl_mem_calloc(size_t nmemb, size_t size); 28 | void *shl_mem_realloc(void *ptr, size_t size, size_t orig_size); 29 | void shl_mem_free(void *ptr); 30 | 31 | #endif // INCLUDE_SHL_MEMORY_H_ 32 | -------------------------------------------------------------------------------- /include/shl_multithread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #ifndef INCLUDE_SHL_MULTITHREAD_H_ 19 | #define INCLUDE_SHL_MULTITHREAD_H_ 20 | 21 | #if (!defined SHL_BUILD_RTOS) 22 | #include 23 | #endif 24 | #include "csinn/csi_nn.h" 25 | 26 | void shl_multithread_set_threads(int threads); 27 | 28 | int shl_multithread_is_enable(); 29 | 30 | #endif // INCLUDE_SHL_MULTITHREAD_H_ 31 | -------------------------------------------------------------------------------- /include/shl_public/shl_pnna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef INCLUDE_SHL_PNNA_H_ 20 | #define INCLUDE_SHL_PNNA_H_ 21 | #include "../csinn/csi_nn.h" 22 | #include "../shl_utils.h" 23 | 24 | int shl_pnna_set_input_strides(struct csinn_session *sess, int input_byte_size, int input_fix_h, 25 | int input_fix_w); 26 | 27 | #endif // INCLUDE_SHL_PNNA_H_ 28 | -------------------------------------------------------------------------------- /include/shl_public/shl_tvmgen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef INCLUDE_PUBLIC_SHL_TVMGEN_H_ 20 | #define INCLUDE_PUBLIC_SHL_TVMGEN_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "shl_utils.h" 28 | 29 | struct shl_tvmgen_name_func { 30 | char *name; 31 | int (*ptr)(); 32 | enum csinn_optimize_method_enum opt_method; 33 | }; 34 | 35 | int shl_tvmgen_map_reg(struct shl_tvmgen_name_func *map, int size); 36 | 37 | #endif // INCLUDE_PUBLIC_SHL_TVMGEN_H_ 38 | -------------------------------------------------------------------------------- /module/json/.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | SortIncludes: false 3 | -------------------------------------------------------------------------------- /python/shl/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /python/shl/__main__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | """ 18 | HHB - HHB command-line interface 19 | """ 20 | 21 | from .main import main, parse_opt 22 | 23 | if __name__ == "__main__": 24 | opt = parse_opt() 25 | main(opt) 26 | -------------------------------------------------------------------------------- /script/download_qemu.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ROOT_PATH=$PWD 4 | QEMU_LINK=https://github.com/T-head-Semi/csi-nn2/releases/download/v1.12/xuantie-qemu-x86_64-Ubuntu-18.04-20220402-0353.tar.gz 5 | TAR_FILE=$ROOT_PATH/tools/Xuantie-Qemu-x86_64-Ubuntu-18.04.tar.gz 6 | 7 | # create dir 8 | QEMU_PATH=tools/qemu 9 | mkdir -p $QEMU_PATH 10 | 11 | # download XuanTie-QEMU 12 | if [ ! -f "$TAR_FILE" ]; then 13 | wget -O $TAR_FILE $QEMU_LINK 14 | fi 15 | 16 | # unzip file 17 | if [ -f "$TAR_FILE" ]; then 18 | if [ ! -d $ROOT_PATH/$QEMU_PATH/bin ]; then 19 | tar -zxvf $TAR_FILE -C $ROOT_PATH/$QEMU_PATH --strip-components 1 20 | echo "remove $TAR_FILE" 21 | fi 22 | rm -f $TAR_FILE 23 | fi 24 | 25 | if [ -d "$ROOT_PATH/$QEMU_PATH/bin" ]; then 26 | echo "remove usless file" 27 | ls $ROOT_PATH/$QEMU_PATH/bin |grep -v qemu-riscv64 |xargs -i rm -rf $ROOT_PATH/$QEMU_PATH/bin/{} 28 | ls $ROOT_PATH/$QEMU_PATH |grep -v bin |xargs -i rm -rf $ROOT_PATH/$QEMU_PATH/{} 29 | fi 30 | 31 | 32 | echo "Download toolchain in $ROOT_PATH/tools/" 33 | echo "Set env variable: 34 | export PATH=$ROOT_PATH/$QEMU_PATH/bin:$ \bPATH" 35 | -------------------------------------------------------------------------------- /script/download_toolchain.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ROOT_PATH=$PWD 4 | GCC_LINK=https://github.com/T-head-Semi/csi-nn2/releases/download/v1.12.1/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.4.0-20220428.tar.gz 5 | TAR_FILE=$ROOT_PATH/tools/Xuantie-900-gcc-linux-toolchain.tar.gz 6 | 7 | # create dir 8 | GCC_PATH=tools/gcc-toolchain 9 | mkdir -p $GCC_PATH 10 | 11 | # download XuanTie-GNU-toolchain 12 | if [ ! -f "$TAR_FILE" ]; then 13 | wget -O $TAR_FILE $GCC_LINK 14 | fi 15 | 16 | # unzip file 17 | if [ -f "$TAR_FILE" ]; then 18 | if [ ! -d $ROOT_PATH/$GCC_PATH/bin ]; then 19 | tar -zxvf $TAR_FILE -C $ROOT_PATH/$GCC_PATH --strip-components 1 20 | fi 21 | rm -rf $TAR_FILE 22 | fi 23 | 24 | echo "Download toolchain in $ROOT_PATH/tools/" 25 | echo "Set env variable: 26 | export PATH=$ROOT_PATH/$GCC_PATH/bin:$ \bPATH" 27 | -------------------------------------------------------------------------------- /script/release_pip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | 19 | make nn2_ref_x86 20 | make nn2_th1520 21 | make nn2_c906 22 | make nn2_c908 23 | make nn2_c920 24 | make nn2_rvm 25 | 26 | cd python 27 | cp ../install_nn2 shl -r 28 | python3 setup.py bdist_wheel 29 | -------------------------------------------------------------------------------- /source/c906_opt/fp16/reshape.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c906/c906.h" 20 | 21 | int shl_c906_reshape_fp16(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reshape_params *params) 23 | { 24 | float *input_data = input->data; 25 | float *output_data = output->data; 26 | int size = csinn_tensor_byte_size(input); 27 | if (input_data != output_data) { 28 | shl_c906_memcpy(output_data, input_data, size); 29 | } 30 | return CSINN_TRUE; 31 | } 32 | -------------------------------------------------------------------------------- /source/c906_opt/fp32/depthwise_convolution_relu_3x3_fp32.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #define DWCONV3X3S1 shl_c906_dwconv3x3s1_fuse_relu 20 | #define DWCONV3X3S2 shl_c906_dwconv3x3s2_fuse_relu 21 | 22 | #define FUSE_CONV_RELU 23 | 24 | #include "./depthwise_convolution_3x3_fp32.c" 25 | -------------------------------------------------------------------------------- /source/c906_opt/fp32/depthwise_convolution_relu_3x3_pack4_fp32.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #define DWCONV3X3S1_PACK4 shl_c906_dwconv3x3s1_pack4_fuse_relu 20 | #define DWCONV3X3S2_PACK4 shl_c906_dwconv3x3s2_pack4_fuse_relu 21 | 22 | #define FUSE_CONV_RELU 23 | 24 | #include "./depthwise_convolution_3x3_pack4_fp32.c" 25 | -------------------------------------------------------------------------------- /source/c906_opt/fp32/depthwise_convolution_relu_5x5_fp32.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #define DWCONV5X5S1 shl_c906_dwconv5x5s1_fuse_relu 20 | #define DWCONV5X5S2 shl_c906_dwconv5x5s2_fuse_relu 21 | 22 | #define FUSE_CONV_RELU 23 | 24 | #include "./depthwise_convolution_5x5_fp32.c" 25 | -------------------------------------------------------------------------------- /source/c906_opt/shl_c906_i8_to_f32.S: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************************************************** 3 | 4 | void shl_c906_i8_to_f32(const int8_t *input, 5 | float *output, 6 | int32_t offset, 7 | float *scale, 8 | uint32_t length) 9 | 10 | Algorithm works as follows: 11 | (1) 12 | 13 | register definition: 14 | a0: input addr 15 | a1: output addr 16 | a2: offset 17 | a3: scale point 18 | a4: element length 19 | 20 | *************************************************************************************************/ 21 | #define SHL_C906_8_TO_F32 shl_c906_i8_to_f32 22 | #define SHL_C906_8_TO_F32_SIGNED 23 | 24 | .file "shl_c906_i8_to_f32.S" 25 | .section .text.SHL_C906_8_TO_F32, "ax", @progbits 26 | .align 5 27 | .global SHL_C906_8_TO_F32 28 | .type SHL_C906_8_TO_F32, @function 29 | 30 | #include "./shl_c906_u8_to_f32.S" 31 | 32 | #undef SHL_C906_8_TO_F32_SIGNED 33 | -------------------------------------------------------------------------------- /source/c908_opt/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c908/c908.h" 20 | 21 | bool shl_c908_get_binary_model_op_init(struct csinn_session *sess) 22 | { 23 | struct shl_c908_option *option = shl_c908_get_graph_option(sess); 24 | if (option && option->base.binary_model_op_init) { 25 | return true; 26 | } else { 27 | return false; 28 | } 29 | } 30 | 31 | void shl_c908_set_binary_model_op_init(struct csinn_session *sess, bool value) 32 | { 33 | struct shl_c908_option *option = shl_c908_get_graph_option(sess); 34 | option->base.binary_model_op_init = value; 35 | } 36 | -------------------------------------------------------------------------------- /source/c920_opt/fp16/convolution_1x1_fp16_packn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920/c920.h" 20 | 21 | int shl_c920_conv1x1s1_gemm_packn_fp16(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 23 | struct csinn_conv2d_params *params) 24 | { 25 | return shl_rvv_common_conv1x1_gemm_packn_fp16(input, output, kernel, bias, params, 26 | shl_rvv_reorder_input_z8_packn_fp16, 27 | shl_c920_ncxhwx_gemm_8xpack2n_fp16); 28 | } 29 | -------------------------------------------------------------------------------- /source/c920_opt/fp16/convolution_gemm_fp16_packn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920/c920.h" 20 | 21 | int shl_c920_conv_im2col_gemm_packn_fp16(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 23 | struct csinn_conv2d_params *params) 24 | { 25 | return shl_rvv_common_conv_gemm_packn_fp16(input, output, kernel, bias, params, 26 | shl_rvv_reorder_input_z8_packn_fp16, 27 | shl_c920_ncxhwx_gemm_8xpack2n_fp16); 28 | } 29 | -------------------------------------------------------------------------------- /source/c920_opt/fp32/convolution_1x1_fp32_packn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920/c920.h" 20 | 21 | int shl_c920_conv1x1s1_gemm_packn_fp32(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 23 | struct csinn_conv2d_params *params) 24 | { 25 | return shl_rvv_common_conv1x1_gemm_packn_fp32(input, output, kernel, bias, params, 26 | shl_rvv_reorder_input_z8_packn_fp32, 27 | shl_c920_ncxhwx_gemm_8xpack2n_fp32); 28 | } 29 | -------------------------------------------------------------------------------- /source/c920_opt/fp32/convolution_gemm_fp32_packn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920/c920.h" 20 | 21 | int shl_c920_conv_im2col_gemm_packn_fp32(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 23 | struct csinn_conv2d_params *params) 24 | { 25 | return shl_rvv_common_conv_gemm_packn_fp32(input, output, kernel, bias, params, 26 | shl_rvv_reorder_input_z8_packn_fp32, 27 | shl_c920_ncxhwx_gemm_8xpack2n_fp32); 28 | } 29 | -------------------------------------------------------------------------------- /source/c920v2_opt/Kconfig: -------------------------------------------------------------------------------- 1 | 2 | menu "C920V2 optimization" 3 | 4 | config C920V2_SOURCE 5 | bool "SHL C920V2 optimization code" 6 | default y 7 | help 8 | Select SHL build C920V2 optimization 9 | 10 | config C920V2_CONVOLUTION_FP32 11 | depends on C920V2_SOURCE 12 | bool "Layer convolution fp32" 13 | default y 14 | help 15 | Select SHL build v extension optimized convolution 16 | 17 | config C920V2_CONVOLUTION_FP16 18 | depends on C920V2_SOURCE 19 | bool "Layer convolution fp16" 20 | default y 21 | help 22 | Select SHL build v extension optimized convolution 23 | 24 | config C920V2_CONVOLUTION_INT8 25 | depends on C920V2_SOURCE 26 | bool "Layer convolution int8" 27 | default y 28 | help 29 | Select SHL build v extension optimized convolution 30 | 31 | config C920V2_GEMM_FP32 32 | depends on C920V2_SOURCE 33 | bool "Layer GEMM fp32" 34 | default y 35 | help 36 | Select SHL build v extension optimized gemm 37 | 38 | config C920V2_GEMM_FP16 39 | depends on C920V2_SOURCE 40 | bool "Layer GEMM fp16" 41 | default y 42 | help 43 | Select SHL build v extension optimized gemm 44 | 45 | config C920V2_GEMM_INT8 46 | depends on C920V2_SOURCE 47 | bool "Layer GEMM fp16" 48 | default y 49 | help 50 | Select SHL build v extension optimized gemm 51 | 52 | endmenu 53 | -------------------------------------------------------------------------------- /source/c920v2_opt/fp16/convolution_1x1_fp16_packn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920v2/c920v2.h" 20 | 21 | int shl_c920v2_conv1x1s1_gemm_packn_fp16(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 23 | struct csinn_conv2d_params *params) 24 | { 25 | return shl_rvv_common_conv1x1_gemm_packn_fp16(input, output, kernel, bias, params, 26 | shl_rvv_reorder_input_z12_packn_fp16, 27 | shl_c920v2_ncxhwx_gemm_12xpack2n_fp16); 28 | } 29 | -------------------------------------------------------------------------------- /source/c920v2_opt/fp16/convolution_gemm_fp16_packn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920v2/c920v2.h" 20 | 21 | int shl_c920v2_conv_im2col_gemm_packn_fp16(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 23 | struct csinn_conv2d_params *params) 24 | { 25 | return shl_rvv_common_conv_gemm_packn_fp16(input, output, kernel, bias, params, 26 | shl_rvv_reorder_input_z12_packn_fp16, 27 | shl_c920v2_ncxhwx_gemm_12xpack2n_fp16); 28 | } 29 | -------------------------------------------------------------------------------- /source/c920v2_opt/fp16/gemm_fp16_ncxhwx.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | .file "gemm_fp16_ncxhwx.S" 20 | 21 | #include "../../c908_opt/fp16/gemm_fp16_ncxhwx.S" 22 | -------------------------------------------------------------------------------- /source/c920v2_opt/fp32/convolution_1x1_fp32_packn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920v2/c920v2.h" 20 | 21 | int shl_c920v2_conv1x1s1_gemm_packn_fp32(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 23 | struct csinn_conv2d_params *params) 24 | { 25 | return shl_rvv_common_conv1x1_gemm_packn_fp32(input, output, kernel, bias, params, 26 | shl_rvv_reorder_input_z12_packn_fp32, 27 | shl_c920v2_ncxhwx_gemm_12xpack2n_fp32); 28 | } 29 | -------------------------------------------------------------------------------- /source/c920v2_opt/fp32/convolution_gemm_fp32_packn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920v2/c920v2.h" 20 | 21 | int shl_c920v2_conv_im2col_gemm_packn_fp32(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_tensor *bias, 23 | struct csinn_conv2d_params *params) 24 | { 25 | return shl_rvv_common_conv_gemm_packn_fp32(input, output, kernel, bias, params, 26 | shl_rvv_reorder_input_z12_packn_fp32, 27 | shl_c920v2_ncxhwx_gemm_12xpack2n_fp32); 28 | } 29 | -------------------------------------------------------------------------------- /source/c920v2_opt/fp32/gemm_fp32_ncxhwx.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | .file "gemm_fp32_ncxhwx.S" 20 | 21 | #include "../../c908_opt/fp32/gemm_fp32_ncxhwx.S" 22 | -------------------------------------------------------------------------------- /source/c920v2_opt/int8/gemm_int8_dot_ncxhwx.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | .file "gemm_int8_dot_ncxhwx.S" 20 | 21 | #include "../../c908_opt/int8/gemm_int8_dot_ncxhwx.S" 22 | -------------------------------------------------------------------------------- /source/c920v2_opt/int8/gemm_int8_ncxhwx.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | .file "gemm_int8_ncxhwx.S" 20 | 21 | #include "../../c908_opt/int8/gemm_int8_ncxhwx.S" 22 | -------------------------------------------------------------------------------- /source/c920v2_opt/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "c920v2/c920v2.h" 20 | 21 | bool shl_c920v2_get_binary_model_op_init(struct csinn_session *sess) 22 | { 23 | struct shl_c920v2_option *option = shl_c920v2_get_graph_option(sess); 24 | if (option && option->base.binary_model_op_init) { 25 | return true; 26 | } else { 27 | return false; 28 | } 29 | } 30 | 31 | void shl_c920v2_set_binary_model_op_init(struct csinn_session *sess, bool value) 32 | { 33 | struct shl_c920v2_option *option = shl_c920v2_get_graph_option(sess); 34 | option->base.binary_model_op_init = value; 35 | } 36 | -------------------------------------------------------------------------------- /source/e907_opt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | if(CONFIG_E907_OPT_SOURCE) 3 | list(APPEND E907_SRCS_MOD source/e907_opt/setup.c) 4 | list(APPEND E907_SRCS_MOD source/e907_opt/utils.c) 5 | endif() 6 | 7 | if(CONFIG_E907_OPT_CONVOLUTION) 8 | list(APPEND E907_SRCS_MOD source/e907_opt/convolution.c) 9 | endif() 10 | 11 | if(CONFIG_E907_OPT_CONCAT) 12 | list(APPEND E907_SRCS_MOD source/e907_opt/concat.c) 13 | endif() 14 | 15 | if(CONFIG_E907_OPT_RELU) 16 | list(APPEND E907_SRCS_MOD source/e907_opt/relu.c) 17 | endif() 18 | 19 | if(CONFIG_E907_OPT_FC) 20 | list(APPEND E907_SRCS_MOD source/e907_opt/fullyconnected.c) 21 | list(APPEND E907_SRCS_MOD source/e907_opt/fullyconnected_int8.c) 22 | endif() 23 | 24 | if(CONFIG_E907_OPT_MUL) 25 | list(APPEND E907_SRCS_MOD source/e907_opt/mul.c) 26 | endif() 27 | 28 | if(CONFIG_E907_OPT_SUM) 29 | list(APPEND E907_SRCS_MOD source/e907_opt/sum.c) 30 | endif() 31 | 32 | if(CONFIG_E907_OPT_SOFTMAX) 33 | list(APPEND E907_SRCS_MOD source/e907_opt/softmax.c) 34 | endif() 35 | -------------------------------------------------------------------------------- /source/e907_opt/Kconfig: -------------------------------------------------------------------------------- 1 | 2 | menu "E907 Optimization" 3 | 4 | config E907_OPT_SOURCE 5 | depends on BUILD_RISCV_ELF_E907 6 | bool "SHL Optimization for E907" 7 | default y 8 | help 9 | Select SHL build E907 Optimization 10 | 11 | config E907_OPT_CONVOLUTION 12 | depends on E907_OPT_SOURCE 13 | bool "Layer conv2d" 14 | default y 15 | help 16 | Select SHL build e907 opt conv2d 17 | 18 | config E907_OPT_CONCAT 19 | depends on E907_OPT_SOURCE 20 | bool "Layer concat" 21 | default y 22 | help 23 | Select SHL build e907 opt concat 24 | 25 | config E907_OPT_RELU 26 | depends on E907_OPT_SOURCE 27 | bool "Layer relu" 28 | default y 29 | help 30 | Select SHL build e907 opt relu 31 | 32 | config E907_OPT_FC 33 | depends on E907_OPT_SOURCE 34 | bool "Layer fc" 35 | default y 36 | help 37 | Select SHL build e907 opt fc 38 | 39 | config E907_OPT_MUL 40 | depends on E907_OPT_SOURCE 41 | bool "Layer mul" 42 | default y 43 | help 44 | Select SHL build e907 opt mul 45 | 46 | config E907_OPT_SUM 47 | depends on E907_OPT_SOURCE 48 | bool "Layer sum" 49 | default y 50 | help 51 | Select SHL build e907 opt sum 52 | 53 | config E907_OPT_SOFTMAX 54 | depends on E907_OPT_SOURCE 55 | bool "Layer softmax" 56 | default y 57 | help 58 | Select SHL build e907 opt softmax 59 | 60 | endmenu 61 | -------------------------------------------------------------------------------- /source/graph_ref/abs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_abs(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ABS, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_abs_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/acos.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_acos(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ACOS, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_acos_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/acosh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_acosh(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ACOSH, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_acosh_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/add.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_add(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_ADD, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_add_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/all.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_all(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_debug_error("shl_gref_all unsupport\n"); 25 | return CSINN_FALSE; 26 | } 27 | 28 | int shl_gref_all_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | shl_debug_error("shl_gref_all_infer_shape unsupport\n"); 32 | return CSINN_FALSE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/and.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_and(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_AND, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_and_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/any.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_any(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ANY, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_any_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | shl_debug_error("shl_gref_any_infer_shape unsupport\n"); 32 | return CSINN_FALSE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/arange.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_arange(struct csinn_tensor *output, struct csinn_arange_params *params) 22 | { 23 | shl_debug_error("shl_gref_arange unsupport\n"); 24 | return CSINN_FALSE; 25 | } 26 | 27 | int shl_gref_arange_infer_shape(struct csinn_tensor *output, struct csinn_arange_params *params) 28 | { 29 | shl_debug_error("shl_gref_arange_infer_shape unsupport\n"); 30 | return CSINN_FALSE; 31 | } 32 | -------------------------------------------------------------------------------- /source/graph_ref/argmax.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_argmax(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ARGMAX, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_argmax_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_stride_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/argmin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_argmin(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ARGMIN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_argmin_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_stride_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/asin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_asin(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ASIN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_asin_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/asinh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_asinh(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ASINH, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_asinh_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/atan.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_atan(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ATAN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_atan_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/atanh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_atanh(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ATANH, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_atanh_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/avgpool.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_avgpool2d(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_pool_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_AVGPOOL2D, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_avgpool2d_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_pool_params *params) 30 | { 31 | return shl_gref_pooling2d_infer_shape(input, output, params); 32 | } -------------------------------------------------------------------------------- /source/graph_ref/cast.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_cast(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_cast_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_CAST, params); 25 | return CSINN_TRUE; 26 | } 27 | -------------------------------------------------------------------------------- /source/graph_ref/ceil.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_ceil(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_CEIL, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_ceil_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/clip.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_clip(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_CLIP, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_clip_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/col2im.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_col2im(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_tensor *kernel, struct csinn_col2im_params *params) 23 | { 24 | shl_debug_error("shl_gref_col2im unsupport\n"); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_col2im_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_tensor *kernel, struct csinn_col2im_params *params) 30 | { 31 | shl_debug_error("shl_gref_col2im_infer_shape unsupport\n"); 32 | return CSINN_TRUE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/cos.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_cos(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_COS, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_cos_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/cosh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_cosh(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_COSH, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_cosh_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/crop.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_crop(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_crop_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_CROP, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_crop_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_crop_params *params) 30 | { 31 | shl_debug_error("shl_gref_crop_infer_shape unsupport\n"); 32 | return CSINN_FALSE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/cumprod.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_cumprod(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_cumprod_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_CUMPROD, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_cumprod_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_cumprod_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/cumsum.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_cumsum(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_cumsum_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_CUMSUM, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_cumsum_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_cumsum_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/data_convert.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_data_convert(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_DATA_CONVERT, params); 25 | return CSINN_TRUE; 26 | } 27 | -------------------------------------------------------------------------------- /source/graph_ref/div.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_div(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_DIV, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_div_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/elu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_elu(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ELU, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_elu_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_relu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/equal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_equal(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_EQUANL, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_equal_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/erf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_erf(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ERF, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_erf_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/exp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_exp(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_EXP, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_exp_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/expm1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_expm1(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_EXPM1, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_expm1_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/floor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_floor(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_FLOOR, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_floor_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/floor_mod.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_floor_mod(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_FLOOR_MOD, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_floor_mod_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/global_averagepool.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_global_avgpool2d(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_pool_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_GLOBAL_AVGPOOL2D, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_global_avgpool2d_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_pool_params *params) 30 | { 31 | return shl_gref_global_pooling2d_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/global_maxpool.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_global_maxpool2d(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_pool_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_GLOBAL_MAXPOOL2D, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_global_maxpool2d_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_pool_params *params) 30 | { 31 | return shl_gref_global_pooling2d_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/greater.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_greater(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_GREATHER, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_greater_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/hard_sigmoid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_hard_sigmoid(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_sigmoid_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_HARD_SIGMOID, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_hard_sigmoid_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_sigmoid_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/isnan.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_isnan_bool(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ISNAN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_isnan_bool_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/l2_normalization.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_l2_normalization(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_l2n_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_L2N, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_l2_normalization_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_l2n_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/l2pool.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_l2pool(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_pool_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_L2POOL2D, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_l2pool_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_pool_params *params) 30 | { 31 | return shl_gref_pooling2d_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/leaky_relu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_leaky_relu(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_LEAKY_RELU, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_leaky_relu_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_relu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/less.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_less(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_LESS, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_less_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/less_equal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_less_equal(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_LESS_EQUAL, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_less_equal_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/log.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_log(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_LOG, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_log_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/log1p.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_log1p(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_LOG1P, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_log1p_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/log_softmax.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_log_softmax(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_softmax_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_LOG_SOFTMAX, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_log_softmax_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_softmax_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/logical_and.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_logical_and(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_LOGICAL_AND, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_logical_and_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/logical_not.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_logical_not(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_LOGICAL_NOT, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_logical_not_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/logical_or.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_logical_or(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_LOGICAL_OR, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_logical_or_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/logical_xor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_logical_xor(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_LOGICAL_XOR, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_logical_xor_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/lrn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_lrn(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_lrn_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_LRN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_lrn_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_lrn_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/max.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_max(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_MAX, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_max_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_stride_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/maximum.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_maximum(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_MAXIMUM, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_maximum_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/maxpool.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_maxpool2d(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_pool_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_MAXPOOL2D, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_maxpool2d_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_pool_params *params) 30 | { 31 | return shl_gref_pooling2d_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/maxpool2d_locat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_maxpool2d_locat(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_pool_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_MAXPOOL2D_LOCAT, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_maxpool2d_locat_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_pool_params *params) 30 | { 31 | return shl_gref_pooling2d_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/maxpool3d.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_maxpool3d(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_pool_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_MAXPOOL3D, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_maxpool3d_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_pool_params *params) 30 | { 31 | return shl_gref_pooling3d_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/mean.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_mean(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_MEAN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_mean_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_stride_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/min.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_min(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_MIN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_min_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_stride_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/minimum.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_minimum(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_MINIMUM, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_minimum_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/mod.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_mod(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_MOD, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_mod_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/mul.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_mul(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_MUL, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_mul_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/ndarray_size.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_ndarray_size(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_ndarray_size_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_NDARRAY_SIZE, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_ndarray_size_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_ndarray_size_params *params) 30 | { 31 | output->dim_count = 1; 32 | output->dim[0] = 1; 33 | return CSINN_TRUE; 34 | } 35 | -------------------------------------------------------------------------------- /source/graph_ref/negative.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_negative(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_NEGATIVE, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_negative_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/not.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_not(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_NOT, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_not_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/not_equal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_not_equal(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_NOT_EQUAL, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_not_equal_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/or.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_or(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_OR, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_or_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/power.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_power(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_POWER, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_power_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/prelu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_prelu(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_prelu_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_PRELU, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_prelu_infer_shape(struct csinn_tensor *input, struct csinn_tensor *alpha, 29 | struct csinn_tensor *output, struct csinn_prelu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/prod.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_prod(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_PROD, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_prod_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_stride_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/reduce_logsumexp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_reduce_logsumexp(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_REDUCE_LOGSUMEXP, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_reduce_logsumexp_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_reduce_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/reduce_max.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_reduce_max(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_REDUCE_MAX, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_reduce_max_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_reduce_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/reduce_mean.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_reduce_mean(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_REDUCE_MEAN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_reduce_mean_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_reduce_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/reduce_min.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_reduce_min(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_REDUCE_MIN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_reduce_min_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_reduce_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/reduce_prod.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_reduce_prod(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_REDUCE_PROD, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_reduce_prod_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_reduce_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/reduce_sum.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_reduce_sum(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_REDUCE_SUM, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_reduce_sum_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_reduce_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/relu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_relu(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_RELU, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_relu_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_relu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/relu1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_relu1(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_RELU1, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_relu1_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_relu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/relu6.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_relu6(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_RELU6, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_relu6_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_relu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/relun.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_relun(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_RELUN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_relun_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_relu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/reorg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_reorg(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reorg_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_REORG, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_reorg_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reorg_params *params) 30 | { 31 | shl_debug_error("shl_gref_reorg_infer_shape unsupport\n"); 32 | return CSINN_FALSE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/resize.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_resize(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_resize_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_RESIZE, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_resize_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_resize_params *params) 30 | { 31 | shl_debug_error("shl_gref_all_infer_shape unsupport\n"); 32 | return CSINN_FALSE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/reverse.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_reverse(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reverse_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_REVERSE, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_reverse_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reverse_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/roipool.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_roipool(struct csinn_tensor *data, struct csinn_tensor *rois, 22 | struct csinn_tensor *output, struct csinn_roi_pool_params *params) 23 | { 24 | shl_debug_error("shl_gref_roipool unsupport\n"); 25 | return CSINN_FALSE; 26 | } 27 | 28 | int shl_gref_roipool_infer_shape(struct csinn_tensor *data, struct csinn_tensor *rois, 29 | struct csinn_tensor *output, struct csinn_roi_pool_params *params) 30 | { 31 | shl_debug_error("shl_gref_roipool_infer_shape unsupport\n"); 32 | return CSINN_FALSE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/rope.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_rope(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_rope_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ROPE, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_rope_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_rope_params *params) 30 | { 31 | shl_gref_siso_infer_shape(input, output, params); 32 | SHL_DEBUG_CALL(shl_rope_debug_info(input, output, params, __func__)); 33 | return CSINN_TRUE; 34 | } 35 | -------------------------------------------------------------------------------- /source/graph_ref/round.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_round(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_ROUND, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_round_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/rsqrt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_rsqrt(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_RSQRT, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_rsqrt_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/shuffle_channel.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_shuffle_channel(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_shuffle_channel_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SHUFFLE_CHANNEL, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_shuffle_channel_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_shuffle_channel_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/sigmoid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_sigmoid(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_sigmoid_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SIGMOID, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_sigmoid_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_sigmoid_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_sign(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SIGN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_sign_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/silu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_silu(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_sigmoid_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SILU, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_silu_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_sigmoid_params *params) 30 | { 31 | shl_gref_siso_infer_shape(input, output, params); 32 | SHL_DEBUG_CALL(shl_silu_debug_info(input, output, params, __func__)); 33 | return CSINN_TRUE; 34 | } 35 | -------------------------------------------------------------------------------- /source/graph_ref/sin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_sin(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SIN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_sin_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/sinh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_sinh(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SINH, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_sinh_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/softmax.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_softmax(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_softmax_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SOFTMAX, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_softmax_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_softmax_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/softplus.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_softplus(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SOFTPLUS, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_softplus_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/softrelu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_softrelu(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SOFTRELU, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_softrelu_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_relu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/softsign.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_softsign(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SOFTSIGN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_softsign_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/sqrt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_sqrt(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SQRT, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_sqrt_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/square.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_square(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SQUARE, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_square_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_stack(struct csinn_tensor **input, struct csinn_tensor *output, 22 | struct csinn_stack_params *params) 23 | { 24 | shl_debug_error("shl_gref_stack unsupport\n"); 25 | return CSINN_FALSE; 26 | } 27 | 28 | int shl_gref_stack_infer_shape(struct csinn_tensor **input, struct csinn_tensor *output, 29 | struct csinn_stack_params *params) 30 | { 31 | shl_debug_error("shl_gref_stack_infer_shape unsupport\n"); 32 | return CSINN_FALSE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/sub.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_sub(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_SUB, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_sub_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/sum.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_sum(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_reduce_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_SUM, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_sum_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_reduce_params *params) 30 | { 31 | return shl_gref_stride_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/tan.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_tan(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_TAN, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_tan_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/tanh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_tanh(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_TANH, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_tanh_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/threshold_relu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_threshold_relu(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_THRESHOLD_RELU, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_threshold_relu_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_relu_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/trunc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_trunc(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_TRUNC, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_trunc_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/unstack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_unstack(struct csinn_tensor *input, struct csinn_tensor **output, 22 | struct csinn_unstack_params *params) 23 | { 24 | shl_debug_error("shl_gref_unstack unsupport\n"); 25 | return CSINN_FALSE; 26 | } 27 | 28 | int shl_gref_unstack_infer_shape(struct csinn_tensor *input, struct csinn_tensor **output, 29 | struct csinn_unstack_params *params) 30 | { 31 | shl_debug_error("shl_gref_unstack_infer_shape unsupport\n"); 32 | return CSINN_FALSE; 33 | } 34 | -------------------------------------------------------------------------------- /source/graph_ref/xor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_xor(struct csinn_tensor *input0, struct csinn_tensor *input1, 22 | struct csinn_tensor *output, struct csinn_diso_params *params) 23 | { 24 | shl_gref_diso_op(input0, input1, output, CSINN_OP_XOR, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_xor_infer_shape(struct csinn_tensor *input0, struct csinn_tensor *input1, 29 | struct csinn_tensor *output, struct csinn_diso_params *params) 30 | { 31 | return shl_gref_diso_infer_shape(input0, input1, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/graph_ref/yuv_rgb_scale.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_gref.h" 20 | 21 | int shl_gref_yuv_rgb_scale(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | shl_gref_siso_op(input, output, CSINN_OP_YUV_RGB_SCALE, params); 25 | return CSINN_TRUE; 26 | } 27 | 28 | int shl_gref_yuv_rgb_scale_infer_shape(struct csinn_tensor *input, struct csinn_tensor *output, 29 | struct csinn_siso_params *params) 30 | { 31 | return shl_gref_siso_infer_shape(input, output, params); 32 | } 33 | -------------------------------------------------------------------------------- /source/reference/broadcast_to.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "reference/ref.h" 20 | 21 | int shl_ref_broadcast_to_f32(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_broadcast_to_params *params) 23 | { 24 | return shl_ref_broadcast_to_shape_f32(input, output, params->shape, params->shape_count); 25 | } 26 | 27 | int shl_ref_broadcast_to_quant(struct csinn_tensor *input, struct csinn_tensor *output, 28 | struct csinn_broadcast_to_params *params) 29 | { 30 | return shl_ref_broadcast_to_shape_quant(input, output, params->shape, params->shape_count); 31 | } 32 | -------------------------------------------------------------------------------- /source/reference/isnan.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "reference/ref.h" 20 | 21 | int shl_ref_isnan_bool_f32(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | float *input_data = input->data; 25 | bool *output_data = output->data; 26 | int size = 1; 27 | for (int i = 0; i < input->dim_count; i++) { 28 | size = size * input->dim[i]; 29 | } 30 | 31 | for (int i = 0; i < size; i++) { 32 | output_data[i] = isnan(input_data[i]); 33 | } 34 | return CSINN_TRUE; 35 | } 36 | -------------------------------------------------------------------------------- /source/thead_rvv/int8/erf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "rvv/rvv.h" 20 | 21 | int shl_rvv_erf_int8(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_siso_params *params) 23 | { 24 | return shl_rvv_siso_callback_dtype_only(input, output, params, shl_rvv_erf_fp32); 25 | } 26 | -------------------------------------------------------------------------------- /source/thead_rvv/int8/relu6.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "rvv/rvv.h" 20 | 21 | int shl_rvv_relu6_int8(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_relu_params *params) 23 | { 24 | return shl_rvv_siso_callback_dtype_only(input, output, params, shl_rvv_relu6_fp32); 25 | } 26 | -------------------------------------------------------------------------------- /source/thead_rvv/int8/sigmoid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "rvv/rvv.h" 20 | 21 | int shl_rvv_sigmoid_int8(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_sigmoid_params *params) 23 | { 24 | return shl_rvv_siso_callback_dtype_only(input, output, params, shl_rvv_sigmoid_fp32); 25 | } 26 | -------------------------------------------------------------------------------- /source/thead_rvv/int8/silu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "rvv/rvv.h" 20 | 21 | int shl_rvv_silu_int8(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_sigmoid_params *params) 23 | { 24 | return shl_rvv_siso_callback_dtype_only(input, output, params, shl_rvv_silu_fp32); 25 | } 26 | -------------------------------------------------------------------------------- /source/thead_rvv/int8/softmax.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "rvv/rvv.h" 20 | 21 | int shl_rvv_softmax_int8(struct csinn_tensor *input, struct csinn_tensor *output, 22 | struct csinn_softmax_params *params) 23 | { 24 | return shl_rvv_siso_callback_base(input, output, params, shl_rvv_softmax_fp32); 25 | } 26 | -------------------------------------------------------------------------------- /source/utils/export.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifdef SHL_EXPORT_MODEL 20 | 21 | #include "csi_nn.h" 22 | #include "export_json_wrapper.h" 23 | 24 | int shl_export_model_json(struct csinn_session *sess, char *path) 25 | { 26 | int ret = shl_export_json_internal(sess, path); 27 | return ret; 28 | } 29 | 30 | #endif -------------------------------------------------------------------------------- /source/utils/export_json_wrapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef INCLUDE_EXPORT_JSON_WRAPPER_H_ 20 | #define INCLUDE_EXPORT_JSON_WRAPPER_H_ 21 | 22 | #ifdef SHL_EXPORT_MODEL 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | int shl_export_json_internal(struct csinn_session* sess, char* path); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | 36 | #endif // INCLUDE_EXPORT_JSON_WRAPPER_H_ -------------------------------------------------------------------------------- /source/utils/multithread.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "shl_debug.h" 20 | #include "shl_multithread.h" 21 | 22 | int shl_thread_num = 1; 23 | 24 | void shl_multithread_set_threads(int threads) 25 | { 26 | #ifdef _OPENMP 27 | shl_thread_num = threads; 28 | omp_set_num_threads(threads); 29 | #else 30 | shl_debug_warning("OPENMP is not defined!\n"); 31 | #endif 32 | } 33 | 34 | int shl_multithread_is_enable() 35 | { 36 | #ifdef _OPENMP 37 | omp_set_num_threads(shl_thread_num); 38 | if (omp_get_max_threads() > 1) { 39 | return CSINN_TRUE; 40 | } 41 | #endif 42 | return CSINN_FALSE; 43 | } 44 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | TEST_ROOT := $(shell pwd) 2 | 3 | all: test_ref test_anole 4 | 5 | test_ref_x86: 6 | make -C validation_layer -f Makefile.ref_x86 7 | 8 | test_ref: 9 | make -C validation_layer -f Makefile.ref 10 | 11 | test_c906: 12 | make -C validation_layer -f Makefile.c906 13 | 14 | test_anole: 15 | make -C validation_graph -f Makefile.anole 16 | 17 | test_pnna: 18 | make -C validation_graph -f Makefile.pnna 19 | 20 | test_pnna_x86: 21 | make -C validation_graph -f Makefile.pnna_x86 22 | 23 | unit_test_opt_interface: 24 | make -C unit_test -f Makefile.rvv 25 | 26 | clean: 27 | rm -rf *.a *.asm utils/*.o 28 | cd validation_layer; find . -name "*.o" -or -name "*.elf" | xargs rm; cd - 29 | cd validation_graph; find . -name "*.o" -or -name "*.elf" | xargs rm; cd - 30 | cd unit_test; find . -name "*.o" -or -name "*.elf" | xargs rm; cd - -------------------------------------------------------------------------------- /tests/autotest/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | junit_logging = out-err -------------------------------------------------------------------------------- /tests/llm/Makefile: -------------------------------------------------------------------------------- 1 | x86_ref_llama: 2 | gcc -c -g llama2.c -I../../include -I../../include/csinn 3 | gcc -c -g model-f16.c -I../../include -I../../include/csinn 4 | gcc llama2.o model-f16.o -o llama2.elf ../../install_nn2/x86/lib/libshl.a -lm -static -fopenmp -g 5 | 6 | x86_ref_llama_quantize: 7 | gcc -c -g llama2_quantize.c -I../../include -I../../include/csinn 8 | gcc -c -g model-f16.c -I../../include -I../../include/csinn 9 | g++ llama2_quantize.o model-f16.o -o llama2_quantize.elf ../../install_nn2/x86/lib/libshl.a -lm -static -fopenmp -g 10 | 11 | c920_llama_quantize: 12 | riscv64-unknown-linux-gnu-gcc -c -g c920_llama2_quantize.c -I../../include -I../../include/csinn 13 | riscv64-unknown-linux-gnu-gcc -c -g model-f16.c -I../../include -I../../include/csinn 14 | riscv64-unknown-linux-gnu-g++ c920_llama2_quantize.o model-f16.o -o c920_llama2_quantize.elf ../../install_nn2/c920/lib/libshl_c920.a -lm -static -fopenmp -g 15 | 16 | clean: 17 | rm -rf *.o *.elf 18 | -------------------------------------------------------------------------------- /tests/llm/convert/gguf-py/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Georgi Gerganov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/llm/convert/gguf-py/gguf/__init__.py: -------------------------------------------------------------------------------- 1 | from .gguf import * 2 | -------------------------------------------------------------------------------- /tests/llm/convert/gguf-py/gguf/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XUANTIE-RV/csi-nn2/4d61b3300bea9ad1ca8215d424433797bcc47552/tests/llm/convert/gguf-py/gguf/py.typed -------------------------------------------------------------------------------- /tests/llm/convert/gguf-py/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "gguf" 3 | version = "0.4.4" 4 | description = "Write ML models in GGUF for GGML" 5 | authors = ["GGML "] 6 | packages = [ 7 | {include = "gguf"}, 8 | {include = "gguf/py.typed"}, 9 | ] 10 | readme = "README.md" 11 | homepage = "https://ggml.ai" 12 | repository = "https://github.com/ggerganov/llama.cpp" 13 | keywords = ["ggml", "gguf", "llama.cpp"] 14 | classifiers = [ 15 | "Programming Language :: Python :: 3", 16 | "License :: OSI Approved :: MIT License", 17 | "Operating System :: OS Independent", 18 | ] 19 | 20 | [tool.poetry.dependencies] 21 | python = ">=3.8" 22 | numpy = ">=1.17" 23 | 24 | [tool.poetry.dev-dependencies] 25 | pytest = "^5.2" 26 | 27 | [build-system] 28 | requires = ["poetry-core>=1.0.0"] 29 | build-backend = "poetry.core.masonry.api" 30 | -------------------------------------------------------------------------------- /tests/llm/convert/gguf-py/tests/test_gguf.py: -------------------------------------------------------------------------------- 1 | import gguf 2 | 3 | # TODO: add tests 4 | 5 | 6 | def test_write_gguf(): 7 | pass 8 | -------------------------------------------------------------------------------- /tests/python_ref/arange.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #-*- coding:utf-8 -*- 3 | 4 | import sys 5 | import struct 6 | import numpy as np 7 | import tensorflow as tf 8 | 9 | 10 | def arange_f32(): 11 | para = [] 12 | # init the input data and parameters 13 | start = int(np.random.randint(1, high=512, size=1)) 14 | stop = int(np.random.randint(532, high=1024, size=1)) 15 | step = int(np.random.randint(1, high=20, size=1)) 16 | 17 | 18 | out_calcu = tf.keras.backend.arange(start,stop,step) 19 | with tf.Session() as sess: 20 | src_out = sess.run(out_calcu) 21 | src_out_1 = src_out.flatten() 22 | 23 | total_size = len(src_out_1) + 4 24 | 25 | para.append(total_size) 26 | para.append(start) 27 | para.append(stop) 28 | para.append(step) 29 | para.append(len(src_out_1)) 30 | 31 | with open("arange_data_f32.bin", "wb") as fp: 32 | data = struct.pack(('%di' % len(para)), *para) 33 | fp.write(data) 34 | data = struct.pack(('%df' % len(src_out_1)), *src_out_1) 35 | fp.write(data) 36 | fp.close() 37 | 38 | return 0 39 | 40 | 41 | if __name__ == '__main__': 42 | arange_f32() 43 | print("end") 44 | -------------------------------------------------------------------------------- /tests/python_ref/caffe/train.lmdb/data.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XUANTIE-RV/csi-nn2/4d61b3300bea9ad1ca8215d424433797bcc47552/tests/python_ref/caffe/train.lmdb/data.mdb -------------------------------------------------------------------------------- /tests/python_ref/caffe/train.lmdb/lock.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XUANTIE-RV/csi-nn2/4d61b3300bea9ad1ca8215d424433797bcc47552/tests/python_ref/caffe/train.lmdb/lock.mdb -------------------------------------------------------------------------------- /tests/python_ref/dequantize.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #-*- coding:utf-8 -*- 3 | 4 | import sys 5 | import struct 6 | import numpy as np 7 | 8 | 9 | def dequantize_f32(): 10 | para = [] 11 | # init the input data and parameters 12 | in_size = int(np.random.randint(128, high=512, size=1)) 13 | zero_point = int(np.random.randint(-60000, high=60000, size=1)) 14 | std = int(np.random.randint(1, high=20, size=1)) 15 | 16 | src_in = np.random.normal(zero_point, std, in_size) 17 | src_in = src_in.astype(np.float32) 18 | 19 | total_size = in_size + 1 20 | 21 | para.append(total_size) 22 | para.append(in_size) 23 | 24 | with open("dequantize_data_f32.bin", "wb") as fp: 25 | data = struct.pack(('%di' % len(para)), *para) 26 | fp.write(data) 27 | data = struct.pack(('%df' % len(src_in)), *src_in) 28 | fp.write(data) 29 | fp.close() 30 | 31 | return 0 32 | 33 | 34 | if __name__ == '__main__': 35 | dequantize_f32() 36 | print("end") 37 | -------------------------------------------------------------------------------- /tests/unit_test/Makefile.rvv: -------------------------------------------------------------------------------- 1 | LIB_DIR = ../../rvv_build 2 | INCLUDE = -I../../include -I../utils 3 | CFLAGS = -O0 -g3 -static 4 | CFLAGS += -march=rv64gcv_zfh_xtheadc_xtheadvdot -mabi=lp64d 5 | CFLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections 6 | CFLAGS += -DCSINN_API=15 7 | LIB_NAME = shl_rvv 8 | CC = riscv64-unknown-linux-gnu-gcc 9 | 10 | 11 | test_objs = 12 | 13 | test_objs += maxpool.o 14 | test_objs += avgpool.o 15 | test_objs += dwconv2d.o 16 | test_objs += relu.o 17 | test_objs += leaky_relu.o 18 | test_objs += add.o 19 | #test_objs += mul.o 20 | test_objs += pad.o 21 | test_objs += concat.o 22 | test_objs += fullyconnected.o 23 | test_objs += gemm.o 24 | test_objs += conv2d_1x1s1_gemm.o 25 | test_objs += conv2d_im2col_gemm.o 26 | test_objs += conv2d_winograd.o 27 | 28 | utils_objs = 29 | 30 | utils_objs += ../utils/test_utils.o 31 | 32 | all: csi 33 | 34 | csi: $(utils_objs) $(test_objs) 35 | 36 | $(utils_objs): %.o: %.c 37 | $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ 38 | 39 | $(test_objs): %.o: %.c 40 | $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ 41 | $(CC) $@ $(CFLAGS) $(BOARD) $(utils_objs) -L$(LIB_DIR) -l$(LIB_NAME) -lc -lm -o $@.elf -lgcov 42 | 43 | clean: 44 | rm -rf $(test_objs) $(utils_objs) *.a *.asm *.elf *.bin *.asm 45 | -------------------------------------------------------------------------------- /tests/validation_graph/hlight/Makefile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # Makefile Example to deploy TVM modules. 19 | 20 | ROOT_DIR=$(shell cd ../../..; pwd) 21 | INCLUDE += -I${ROOT_DIR}/include 22 | LDFLAGS = -L${ROOT_DIR}/pnna_x86_build -Wl,-unresolved-symbols=ignore-in-shared-libs 23 | 24 | CC = gcc 25 | 26 | CFLAGS += -O0 -g3 ${INCLUDE} 27 | 28 | LDFLAGS += -lstdc++ -lshl_pnna_x86 -lm 29 | 30 | .PHONY: clean all 31 | 32 | all: test_subgraph 33 | 34 | test_subgraph: test_subgraph.c 35 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 36 | 37 | clean: 38 | -rm subgraph -------------------------------------------------------------------------------- /tests/validation_graph/hlight/run.sh: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH=../../../module/nna_ddk_install/x86:../../../install_nn2/lib 2 | export SIM_VISION_PATH=../../../module/nna_ddk_install/x86/sim_nna.so 3 | ./test_subgraph -------------------------------------------------------------------------------- /tests/validation_graph/th1520/argmax.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "csi_nn.h" 20 | #include "test_utils.h" 21 | -------------------------------------------------------------------------------- /tests/validation_graph/th1520/batch_normalization.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "csi_nn.h" 20 | #include "test_utils.h" 21 | 22 | int main(int argc, char** argv) {} 23 | -------------------------------------------------------------------------------- /tests/validation_graph/th1520/batch_to_space_nd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "csi_nn.h" 20 | #include "test_utils.h" 21 | 22 | int main(int argc, char** argv) {} 23 | -------------------------------------------------------------------------------- /tests/validation_graph/th1520/crop.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2023 C-SKY Microsystems Co., Ltd. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "csi_nn.h" 20 | #include "test_utils.h" 21 | 22 | int main(int argc, char** argv) {} 23 | -------------------------------------------------------------------------------- /tests/validation_graph/tvmgen/Makefile: -------------------------------------------------------------------------------- 1 | CC = riscv64-unknown-linux-gnu-gcc 2 | INCLUDE = -I../../../include -I../../utils 3 | CFLAGS = -O2 -g3 -march=rv64gcv0p7_zfh_xtheadc -mabi=lp64d -static 4 | 5 | test_objs = 6 | 7 | test_objs += reg.o 8 | test_objs += callback.o 9 | 10 | all: csi 11 | 12 | csi: $(test_objs) 13 | 14 | $(test_objs): %.o: %.c 15 | $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ 16 | $(CC) $@ $(CFLAGS) -L../../../c906_static_build/ \ 17 | ../../../c906_static_build/libshl_c906.a -lc -lm -lstdc++ -o $@.elf 18 | 19 | clean: 20 | rm -rf $(test_objs) *.a *.asm *.elf *.bin *.asm 21 | -------------------------------------------------------------------------------- /tests/validation_graph/tvmgen/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | qemu-riscv64 -cpu c906fdv ./reg.o.elf 4 | qemu-riscv64 -cpu c906fdv ./callback.o.elf 5 | -------------------------------------------------------------------------------- /tests/validation_layer/.gdbinit: -------------------------------------------------------------------------------- 1 | target remote localhost:8809 2 | -------------------------------------------------------------------------------- /tests/validation_layer/Makefile.rvm: -------------------------------------------------------------------------------- 1 | LIB_DIR = ../../rvm_build 2 | INCLUDE = -I../../include -I../../include/csinn -I../../include/shl_public -I../utils -I./layer 3 | CFLAGS = -O0 -g3 -static 4 | CFLAGS += -march=rv64gcv_zfh_xtheadc_xtheadvdot_xtheadmatrix -mabi=lp64d 5 | CFLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections 6 | CFLAGS += -DCSINN_API=16 7 | LIB_NAME = shl_rvm 8 | CC = riscv64-unknown-linux-gnu-gcc 9 | CPLUS = riscv64-unknown-linux-gnu-g++ 10 | TYPE=? 11 | 12 | test_objs = 13 | 14 | 15 | test_objs += convolution_nhwc.o 16 | test_objs += depthwise_convolution_nhwc.o 17 | test_objs += averagepool_nhwc.o 18 | test_objs += maxpool_nhwc.o 19 | test_objs += global_avgpool_nhwc.o 20 | test_objs += global_maxpool_nhwc.o 21 | test_objs += fullyconnected.o 22 | test_objs += matmul.o 23 | 24 | 25 | 26 | utils_objs = 27 | utils_objs += ../utils/test_utils.o 28 | 29 | all: csi 30 | 31 | csi: $(utils_objs) $(test_objs) 32 | 33 | $(utils_objs): %.o: %.c 34 | $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ 35 | 36 | $(test_objs): %.o: %.cpp 37 | $(CPLUS) -c $(CFLAGS) $(INCLUDE) -D DTYPE=$(TYPE) $< -o $@ 38 | $(CPLUS) $@ $(CFLAGS) $(BOARD) $(utils_objs) -L$(LIB_DIR) -l$(LIB_NAME) -lc -lm -o $@.elf -lgcov 39 | 40 | clean: 41 | rm -rf $(test_objs) $(utils_objs) *.a *.asm *.elf *.asm 42 | -------------------------------------------------------------------------------- /tests/validation_layer/Makefile.rvv_nodot: -------------------------------------------------------------------------------- 1 | LIB_DIR = ../../rvv_nodot_build 2 | INCLUDE = -I../../include -I../../include/shl_public -I../utils -I./layer 3 | CFLAGS = -O0 -g3 -static 4 | CFLAGS += -march=rv64gcv_zfh_xtheadc -mabi=lp64d 5 | CFLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections 6 | CFLAGS += -DCSINN_API=15 7 | LIB_NAME = shl_rvv_nodot 8 | CC = riscv64-unknown-linux-gnu-gcc 9 | CPLUS = riscv64-unknown-linux-gnu-g++ 10 | TYPE=? 11 | 12 | test_objs = 13 | 14 | test_objs += convolution.o 15 | test_objs += convolution1d.o 16 | test_objs += group_convolution.o 17 | test_objs += fullyconnected.o 18 | test_objs += matmul.o 19 | test_objs += deconvolution.o 20 | 21 | utils_objs = 22 | utils_objs += ../utils/test_utils.o 23 | 24 | all: csi 25 | 26 | csi: $(utils_objs) $(test_objs) 27 | 28 | $(utils_objs): %.o: %.c 29 | $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ 30 | 31 | $(test_objs): %.o: %.cpp 32 | $(CPLUS) -c $(CFLAGS) $(INCLUDE) -D DTYPE=$(TYPE) $< -o $@ 33 | $(CPLUS) $@ $(CFLAGS) $(BOARD) $(utils_objs) -L$(LIB_DIR) -l$(LIB_NAME) -lc -lm -o $@.elf -lgcov 34 | 35 | clean: 36 | rm -rf $(test_objs) $(utils_objs) *.a *.asm *.elf *.asm 37 | -------------------------------------------------------------------------------- /version: -------------------------------------------------------------------------------- 1 | 2.9.5 2 | --------------------------------------------------------------------------------