├── CMakeLists.txt
├── CONTRIBUTING.md
├── Info.plist
├── LICENSE.txt
├── README.md
├── benchmark
├── CMakeLists.txt
├── README.md
├── alexnet.param
├── benchncnn.cpp
├── googlenet.param
├── googlenet_int8.param
├── mnasnet.param
├── mobilenet.param
├── mobilenet_int8.param
├── mobilenet_ssd.param
├── mobilenet_ssd_int8.param
├── mobilenet_v2.param
├── mobilenet_yolo.param
├── mobilenet_yolov3.param
├── proxylessnasnet.param
├── resnet18.param
├── resnet18_int8.param
├── resnet50.param
├── resnet50_int8.param
├── shufflenet.param
├── squeezenet.param
├── squeezenet_int8.param
├── squeezenet_ssd.param
├── squeezenet_ssd_int8.param
├── vgg16.param
└── vgg16_int8.param
├── build.sh
├── cmake
└── ncnnConfig.cmake.in
├── docs
├── Home.md
├── application-with-ncnn-inside.md
├── benchmark
│ ├── the-benchmark-of-caffe-android-lib,-mini-caffe,-and-ncnn.md
│ └── vulkan-conformance-test.md
├── developer-guide
│ ├── aarch64-mix-assembly-and-intrinsic.md
│ ├── add-custom-layer.zh.md
│ ├── armv7-mix-assembly-and-intrinsic.md
│ ├── binaryop-broadcasting.md
│ ├── custom-allocator.md
│ ├── element-packing.md
│ ├── how-to-implement-custom-layer-step-by-step.md
│ ├── how-to-write-a-neon-optimized-op-kernel.md
│ ├── low-level-operation-api.md
│ ├── ncnn-tips-and-tricks.zh.md
│ ├── new-model-load-api.md
│ ├── new-param-load-api.md
│ ├── operation-param-weight-table.md
│ ├── param-and-model-file-structure.md
│ ├── preload-practice.zh.md
│ └── tensorflow-op-combination.md
├── how-to-build
│ ├── build-for-VS2017.zh.md
│ ├── build-for-android.zh.md
│ ├── build-for-ios.zh.md
│ └── enable-openmp-for-ios.zh.md
└── how-to-use-and-FAQ
│ ├── FAQ-ncnn-produce-wrong-result.md
│ ├── FAQ-ncnn-throw-error.md
│ ├── FAQ-ncnn-vulkan.md
│ ├── quantized-int8-inference.md
│ ├── use-ncnn-with-alexnet.md
│ ├── use-ncnn-with-alexnet.zh.md
│ ├── use-ncnn-with-pytorch-or-onnx.md
│ ├── use-ncnnoptmize-to-optimize-model.md
│ └── vulkan-notes.md
├── examples
├── CMakeLists.txt
├── fasterrcnn.cpp
├── mobilenetssd.cpp
├── mobilenetv2ssdlite.cpp
├── peleenetssd_seg.cpp
├── rfcn.cpp
├── shufflenetv2.cpp
├── squeezencnn
│ ├── AndroidManifest.xml
│ ├── ant.properties
│ ├── assets
│ │ ├── squeezenet_v1.1.bin
│ │ ├── squeezenet_v1.1.param.bin
│ │ └── synset_words.txt
│ ├── build.xml
│ ├── jni
│ │ ├── Android.mk
│ │ ├── Application.mk
│ │ ├── squeezencnn_jni.cpp
│ │ └── squeezenet_v1.1.id.h
│ ├── local.properties
│ ├── proguard-project.txt
│ ├── project.properties
│ ├── res
│ │ ├── layout
│ │ │ └── main.xml
│ │ └── values
│ │ │ └── strings.xml
│ └── src
│ │ └── com
│ │ └── tencent
│ │ └── squeezencnn
│ │ ├── MainActivity.java
│ │ └── SqueezeNcnn.java
├── squeezenet.cpp
├── squeezenet_v1.1.bin
├── squeezenet_v1.1.caffemodel
├── squeezenet_v1.1.param
├── squeezenet_v1.1.prototxt
├── squeezenetssd.cpp
├── synset_words.txt
├── yolov2.cpp
└── yolov3.cpp
├── images
├── 128-ncnn.png
├── 16-ncnn.png
├── 256-ncnn.png
├── 2eff677a1588b8bcf8382183192b44c.png
├── 32-ncnn.png
└── 64-ncnn.png
├── myPro
├── benchmark
│ └── benchncnn
├── examples
│ ├── fasterrcnn
│ ├── mobilenetssd
│ ├── mobilenetv2ssdlite
│ ├── peleenetssd_seg
│ ├── rfcn
│ ├── shufflenetv2
│ ├── squeezenet
│ ├── squeezenet_v1.1.bin
│ ├── squeezenet_v1.1.param
│ ├── squeezenetssd
│ ├── yolov2
│ └── yolov3
├── projects
│ ├── 1.jpg
│ ├── 2.jpg
│ ├── myNet
│ ├── ncnn.param
│ └── yolo
├── src
│ ├── layer_declaration.h
│ ├── layer_registry.h
│ ├── layer_shader_registry.h
│ ├── layer_shader_spv_data.h
│ ├── layer_type_enum.h
│ ├── libncnn.a
│ └── platform.h
└── tools
│ ├── caffe
│ ├── caffe.pb.cc
│ ├── caffe.pb.h
│ └── caffe2ncnn
│ ├── mxnet
│ └── mxnet2ncnn
│ ├── ncnn2mem
│ ├── ncnnoptimize
│ ├── onnx
│ ├── exp.frozen.onnx
│ ├── ncnn.bin
│ ├── ncnn.param
│ ├── onnx.pb.cc
│ ├── onnx.pb.h
│ └── onnx2ncnn
│ └── tensorflow
│ ├── attr_value.pb.cc
│ ├── attr_value.pb.h
│ ├── function.pb.cc
│ ├── function.pb.h
│ ├── graph.pb.cc
│ ├── graph.pb.h
│ ├── node_def.pb.cc
│ ├── node_def.pb.h
│ ├── op_def.pb.cc
│ ├── op_def.pb.h
│ ├── resource_handle.pb.cc
│ ├── resource_handle.pb.h
│ ├── tensor.pb.cc
│ ├── tensor.pb.h
│ ├── tensor_shape.pb.cc
│ ├── tensor_shape.pb.h
│ ├── tensorflow2ncnn
│ ├── types.pb.cc
│ ├── types.pb.h
│ ├── versions.pb.cc
│ └── versions.pb.h
├── package.sh
├── projects
├── CMakeLists.txt
├── myNet.cpp
├── yolo.cpp
└── yoloDection.h
├── src
├── CMakeLists.txt
├── allocator.cpp
├── allocator.h
├── benchmark.cpp
├── benchmark.h
├── blob.cpp
├── blob.h
├── command.cpp
├── command.h
├── cpu.cpp
├── cpu.h
├── gpu.cpp
├── gpu.h
├── layer.cpp
├── layer.h
├── layer
│ ├── .clip.cpp.swp
│ ├── absval.cpp
│ ├── absval.h
│ ├── argmax.cpp
│ ├── argmax.h
│ ├── arm
│ │ ├── absval_arm.cpp
│ │ ├── absval_arm.h
│ │ ├── batchnorm_arm.cpp
│ │ ├── batchnorm_arm.h
│ │ ├── bias_arm.cpp
│ │ ├── bias_arm.h
│ │ ├── binaryop_arm.cpp
│ │ ├── binaryop_arm.h
│ │ ├── clip_arm.cpp
│ │ ├── clip_arm.h
│ │ ├── convolution_1x1.h
│ │ ├── convolution_1x1_int8.h
│ │ ├── convolution_2x2.h
│ │ ├── convolution_3x3.h
│ │ ├── convolution_3x3_int8.h
│ │ ├── convolution_4x4.h
│ │ ├── convolution_5x5.h
│ │ ├── convolution_5x5_int8.h
│ │ ├── convolution_7x7.h
│ │ ├── convolution_7x7_int8.h
│ │ ├── convolution_arm.cpp
│ │ ├── convolution_arm.h
│ │ ├── convolution_sgemm.h
│ │ ├── convolution_sgemm_int8.h
│ │ ├── convolutiondepthwise_3x3.h
│ │ ├── convolutiondepthwise_3x3_int8.h
│ │ ├── convolutiondepthwise_5x5.h
│ │ ├── convolutiondepthwise_arm.cpp
│ │ ├── convolutiondepthwise_arm.h
│ │ ├── deconvolution_3x3.h
│ │ ├── deconvolution_4x4.h
│ │ ├── deconvolution_arm.cpp
│ │ ├── deconvolution_arm.h
│ │ ├── deconvolutiondepthwise_arm.cpp
│ │ ├── deconvolutiondepthwise_arm.h
│ │ ├── dequantize_arm.cpp
│ │ ├── dequantize_arm.h
│ │ ├── dropout_arm.cpp
│ │ ├── dropout_arm.h
│ │ ├── eltwise_arm.cpp
│ │ ├── eltwise_arm.h
│ │ ├── flatten_arm.cpp
│ │ ├── flatten_arm.h
│ │ ├── hardsigmoid_arm.cpp
│ │ ├── hardsigmoid_arm.h
│ │ ├── innerproduct_arm.cpp
│ │ ├── innerproduct_arm.h
│ │ ├── interp_arm.cpp
│ │ ├── interp_arm.h
│ │ ├── lrn_arm.cpp
│ │ ├── lrn_arm.h
│ │ ├── neon_mathfun.h
│ │ ├── packing_arm.cpp
│ │ ├── packing_arm.h
│ │ ├── padding_arm.cpp
│ │ ├── padding_arm.h
│ │ ├── pooling_2x2.h
│ │ ├── pooling_3x3.h
│ │ ├── pooling_arm.cpp
│ │ ├── pooling_arm.h
│ │ ├── prelu_arm.cpp
│ │ ├── prelu_arm.h
│ │ ├── quantize_arm.cpp
│ │ ├── quantize_arm.h
│ │ ├── relu_arm.cpp
│ │ ├── relu_arm.h
│ │ ├── requantize_arm.cpp
│ │ ├── requantize_arm.h
│ │ ├── scale_arm.cpp
│ │ ├── scale_arm.h
│ │ ├── selu_arm.cpp
│ │ ├── selu_arm.h
│ │ ├── sigmoid_arm.cpp
│ │ ├── sigmoid_arm.h
│ │ ├── softmax_arm.cpp
│ │ ├── softmax_arm.h
│ │ ├── unaryop_arm.cpp
│ │ └── unaryop_arm.h
│ ├── batchnorm.cpp
│ ├── batchnorm.h
│ ├── bias.cpp
│ ├── bias.h
│ ├── binaryop.cpp
│ ├── binaryop.h
│ ├── bnll.cpp
│ ├── bnll.h
│ ├── cast.cpp
│ ├── cast.h
│ ├── clip.cpp
│ ├── clip.h
│ ├── concat.cpp
│ ├── concat.h
│ ├── convolution.cpp
│ ├── convolution.h
│ ├── convolutiondepthwise.cpp
│ ├── convolutiondepthwise.h
│ ├── crop.cpp
│ ├── crop.h
│ ├── deconvolution.cpp
│ ├── deconvolution.h
│ ├── deconvolutiondepthwise.cpp
│ ├── deconvolutiondepthwise.h
│ ├── dequantize.cpp
│ ├── dequantize.h
│ ├── detectionoutput.cpp
│ ├── detectionoutput.h
│ ├── dropout.cpp
│ ├── dropout.h
│ ├── eltwise.cpp
│ ├── eltwise.h
│ ├── elu.cpp
│ ├── elu.h
│ ├── embed.cpp
│ ├── embed.h
│ ├── exp.cpp
│ ├── exp.h
│ ├── expanddims.cpp
│ ├── expanddims.h
│ ├── flatten.cpp
│ ├── flatten.h
│ ├── hardsigmoid.cpp
│ ├── hardsigmoid.h
│ ├── innerproduct.cpp
│ ├── innerproduct.h
│ ├── input.cpp
│ ├── input.h
│ ├── instancenorm.cpp
│ ├── instancenorm.h
│ ├── interp.cpp
│ ├── interp.h
│ ├── log.cpp
│ ├── log.h
│ ├── lrn.cpp
│ ├── lrn.h
│ ├── lstm.cpp
│ ├── lstm.h
│ ├── memorydata.cpp
│ ├── memorydata.h
│ ├── mvn.cpp
│ ├── mvn.h
│ ├── normalize.cpp
│ ├── normalize.h
│ ├── packing.cpp
│ ├── packing.h
│ ├── padding.cpp
│ ├── padding.h
│ ├── permute.cpp
│ ├── permute.h
│ ├── pooling.cpp
│ ├── pooling.h
│ ├── power.cpp
│ ├── power.h
│ ├── prelu.cpp
│ ├── prelu.h
│ ├── priorbox.cpp
│ ├── priorbox.h
│ ├── proposal.cpp
│ ├── proposal.h
│ ├── psroipooling.cpp
│ ├── psroipooling.h
│ ├── quantize.cpp
│ ├── quantize.h
│ ├── reduction.cpp
│ ├── reduction.h
│ ├── relu.cpp
│ ├── relu.h
│ ├── reorg.cpp
│ ├── reorg.h
│ ├── requantize.cpp
│ ├── requantize.h
│ ├── reshape.cpp
│ ├── reshape.h
│ ├── rnn.cpp
│ ├── rnn.h
│ ├── roialign.cpp
│ ├── roialign.h
│ ├── roipooling.cpp
│ ├── roipooling.h
│ ├── scale.cpp
│ ├── scale.h
│ ├── selu.cpp
│ ├── selu.h
│ ├── shufflechannel.cpp
│ ├── shufflechannel.h
│ ├── sigmoid.cpp
│ ├── sigmoid.h
│ ├── slice.cpp
│ ├── slice.h
│ ├── softmax.cpp
│ ├── softmax.h
│ ├── split.cpp
│ ├── split.h
│ ├── spp.cpp
│ ├── spp.h
│ ├── squeeze.cpp
│ ├── squeeze.h
│ ├── tanh.cpp
│ ├── tanh.h
│ ├── tfpack.cpp
│ ├── tfpack.h
│ ├── tfrange.cpp
│ ├── tfrange.h
│ ├── tfreshape.cpp
│ ├── tfreshape.h
│ ├── tfresizebilinear.cpp
│ ├── tfresizebilinear.h
│ ├── tfshape.cpp
│ ├── tfshape.h
│ ├── tfstridedslice.cpp
│ ├── tfstridedslice.h
│ ├── tftile.cpp
│ ├── tftile.h
│ ├── threshold.cpp
│ ├── threshold.h
│ ├── tile.cpp
│ ├── tile.h
│ ├── unaryop.cpp
│ ├── unaryop.h
│ ├── vulkan
│ │ ├── absval_vulkan.cpp
│ │ ├── absval_vulkan.h
│ │ ├── batchnorm_vulkan.cpp
│ │ ├── batchnorm_vulkan.h
│ │ ├── binaryop_vulkan.cpp
│ │ ├── binaryop_vulkan.h
│ │ ├── cast_vulkan.cpp
│ │ ├── cast_vulkan.h
│ │ ├── clip_vulkan.cpp
│ │ ├── clip_vulkan.h
│ │ ├── concat_vulkan.cpp
│ │ ├── concat_vulkan.h
│ │ ├── convolution_vulkan.cpp
│ │ ├── convolution_vulkan.h
│ │ ├── convolutiondepthwise_vulkan.cpp
│ │ ├── convolutiondepthwise_vulkan.h
│ │ ├── crop_vulkan.cpp
│ │ ├── crop_vulkan.h
│ │ ├── deconvolution_vulkan.cpp
│ │ ├── deconvolution_vulkan.h
│ │ ├── deconvolutiondepthwise_vulkan.cpp
│ │ ├── deconvolutiondepthwise_vulkan.h
│ │ ├── dropout_vulkan.cpp
│ │ ├── dropout_vulkan.h
│ │ ├── eltwise_vulkan.cpp
│ │ ├── eltwise_vulkan.h
│ │ ├── flatten_vulkan.cpp
│ │ ├── flatten_vulkan.h
│ │ ├── hardsigmoid_vulkan.cpp
│ │ ├── hardsigmoid_vulkan.h
│ │ ├── innerproduct_vulkan.cpp
│ │ ├── innerproduct_vulkan.h
│ │ ├── interp_vulkan.cpp
│ │ ├── interp_vulkan.h
│ │ ├── lrn_vulkan.cpp
│ │ ├── lrn_vulkan.h
│ │ ├── packing_vulkan.cpp
│ │ ├── packing_vulkan.h
│ │ ├── padding_vulkan.cpp
│ │ ├── padding_vulkan.h
│ │ ├── permute_vulkan.cpp
│ │ ├── permute_vulkan.h
│ │ ├── pooling_vulkan.cpp
│ │ ├── pooling_vulkan.h
│ │ ├── prelu_vulkan.cpp
│ │ ├── prelu_vulkan.h
│ │ ├── priorbox_vulkan.cpp
│ │ ├── priorbox_vulkan.h
│ │ ├── relu_vulkan.cpp
│ │ ├── relu_vulkan.h
│ │ ├── reorg_vulkan.cpp
│ │ ├── reorg_vulkan.h
│ │ ├── reshape_vulkan.cpp
│ │ ├── reshape_vulkan.h
│ │ ├── scale_vulkan.cpp
│ │ ├── scale_vulkan.h
│ │ ├── shader
│ │ │ ├── absval.comp
│ │ │ ├── absval_pack4.comp
│ │ │ ├── batchnorm.comp
│ │ │ ├── batchnorm_pack4.comp
│ │ │ ├── binaryop.comp
│ │ │ ├── binaryop_pack4.comp
│ │ │ ├── cast_fp16_to_fp32.comp
│ │ │ ├── cast_fp16_to_fp32_pack4.comp
│ │ │ ├── cast_fp32_to_fp16.comp
│ │ │ ├── cast_fp32_to_fp16_pack4.comp
│ │ │ ├── clip.comp
│ │ │ ├── clip_pack4.comp
│ │ │ ├── concat.comp
│ │ │ ├── concat_pack4.comp
│ │ │ ├── concat_pack4to1.comp
│ │ │ ├── convolution.comp
│ │ │ ├── convolution_1x1s1d1.comp
│ │ │ ├── convolution_pack1to4.comp
│ │ │ ├── convolution_pack4.comp
│ │ │ ├── convolution_pack4_1x1s1d1.comp
│ │ │ ├── convolution_pack4_3x3s1d1_lds_8_8_2.comp
│ │ │ ├── convolution_pack4_3x3s1d1_winograd23_gemm.comp
│ │ │ ├── convolution_pack4_3x3s1d1_winograd23_transform_input.comp
│ │ │ ├── convolution_pack4_3x3s1d1_winograd23_transform_output.comp
│ │ │ ├── convolution_pack4_3x3s1d1_winograd63_gemm.comp
│ │ │ ├── convolution_pack4_3x3s1d1_winograd63_transform_input.comp
│ │ │ ├── convolution_pack4_3x3s1d1_winograd63_transform_output.comp
│ │ │ ├── convolution_pack4to1.comp
│ │ │ ├── convolutiondepthwise.comp
│ │ │ ├── convolutiondepthwise_group.comp
│ │ │ ├── convolutiondepthwise_group_pack1to4.comp
│ │ │ ├── convolutiondepthwise_group_pack4.comp
│ │ │ ├── convolutiondepthwise_group_pack4to1.comp
│ │ │ ├── convolutiondepthwise_pack4.comp
│ │ │ ├── crop.comp
│ │ │ ├── crop_pack4.comp
│ │ │ ├── deconvolution.comp
│ │ │ ├── deconvolution_pack1to4.comp
│ │ │ ├── deconvolution_pack4.comp
│ │ │ ├── deconvolution_pack4to1.comp
│ │ │ ├── deconvolutiondepthwise.comp
│ │ │ ├── deconvolutiondepthwise_group.comp
│ │ │ ├── deconvolutiondepthwise_group_pack1to4.comp
│ │ │ ├── deconvolutiondepthwise_group_pack4.comp
│ │ │ ├── deconvolutiondepthwise_group_pack4to1.comp
│ │ │ ├── deconvolutiondepthwise_pack4.comp
│ │ │ ├── dropout.comp
│ │ │ ├── dropout_pack4.comp
│ │ │ ├── eltwise.comp
│ │ │ ├── eltwise_pack4.comp
│ │ │ ├── flatten.comp
│ │ │ ├── flatten_pack1to4.comp
│ │ │ ├── flatten_pack4.comp
│ │ │ ├── hardsigmoid.comp
│ │ │ ├── hardsigmoid_pack4.comp
│ │ │ ├── innerproduct.comp
│ │ │ ├── innerproduct_pack1to4.comp
│ │ │ ├── innerproduct_pack4.comp
│ │ │ ├── innerproduct_pack4_lds_64.comp
│ │ │ ├── innerproduct_pack4to1.comp
│ │ │ ├── interp.comp
│ │ │ ├── interp_bicubic.comp
│ │ │ ├── interp_bicubic_coeffs.comp
│ │ │ ├── interp_bicubic_pack4.comp
│ │ │ ├── interp_pack4.comp
│ │ │ ├── lrn_norm.comp
│ │ │ ├── lrn_norm_across_channel_pack4.comp
│ │ │ ├── lrn_norm_within_channel_pack4.comp
│ │ │ ├── lrn_square_pad.comp
│ │ │ ├── lrn_square_pad_across_channel_pack4.comp
│ │ │ ├── lrn_square_pad_within_channel_pack4.comp
│ │ │ ├── packing_1to4.comp
│ │ │ ├── packing_4to1.comp
│ │ │ ├── padding.comp
│ │ │ ├── padding_pack4.comp
│ │ │ ├── permute.comp
│ │ │ ├── permute_pack4to1.comp
│ │ │ ├── pooling.comp
│ │ │ ├── pooling_global.comp
│ │ │ ├── pooling_global_pack4.comp
│ │ │ ├── pooling_pack4.comp
│ │ │ ├── prelu.comp
│ │ │ ├── prelu_pack4.comp
│ │ │ ├── priorbox.comp
│ │ │ ├── priorbox_mxnet.comp
│ │ │ ├── relu.comp
│ │ │ ├── relu_pack4.comp
│ │ │ ├── reorg.comp
│ │ │ ├── reorg_pack1to4.comp
│ │ │ ├── reorg_pack4.comp
│ │ │ ├── reshape.comp
│ │ │ ├── reshape_pack1to4.comp
│ │ │ ├── reshape_pack4.comp
│ │ │ ├── reshape_pack4to1.comp
│ │ │ ├── scale.comp
│ │ │ ├── scale_pack4.comp
│ │ │ ├── shufflechannel.comp
│ │ │ ├── shufflechannel_pack4.comp
│ │ │ ├── sigmoid.comp
│ │ │ ├── sigmoid_pack4.comp
│ │ │ ├── softmax_div_sum.comp
│ │ │ ├── softmax_div_sum_pack4.comp
│ │ │ ├── softmax_exp_sub_max.comp
│ │ │ ├── softmax_exp_sub_max_pack4.comp
│ │ │ ├── softmax_reduce_max.comp
│ │ │ ├── softmax_reduce_max_pack4.comp
│ │ │ ├── softmax_reduce_sum.comp
│ │ │ ├── softmax_reduce_sum_pack4.comp
│ │ │ ├── tanh.comp
│ │ │ ├── tanh_pack4.comp
│ │ │ ├── unaryop.comp
│ │ │ └── unaryop_pack4.comp
│ │ ├── shufflechannel_vulkan.cpp
│ │ ├── shufflechannel_vulkan.h
│ │ ├── sigmoid_vulkan.cpp
│ │ ├── sigmoid_vulkan.h
│ │ ├── softmax_vulkan.cpp
│ │ ├── softmax_vulkan.h
│ │ ├── tanh_vulkan.cpp
│ │ ├── tanh_vulkan.h
│ │ ├── unaryop_vulkan.cpp
│ │ └── unaryop_vulkan.h
│ ├── x86
│ │ ├── avx_mathfun.h
│ │ ├── convolution_1x1.h
│ │ ├── convolution_1x1_int8.h
│ │ ├── convolution_3x3.h
│ │ ├── convolution_3x3_int8.h
│ │ ├── convolution_5x5.h
│ │ ├── convolution_5x5_int8.h
│ │ ├── convolution_7x7.h
│ │ ├── convolution_7x7_int8.h
│ │ ├── convolution_sgemm.h
│ │ ├── convolution_sgemm_int8.h
│ │ ├── convolution_x86.cpp
│ │ ├── convolution_x86.h
│ │ ├── convolutiondepthwise_3x3.h
│ │ ├── convolutiondepthwise_3x3_int8.h
│ │ ├── convolutiondepthwise_x86.cpp
│ │ ├── convolutiondepthwise_x86.h
│ │ └── sse_mathfun.h
│ ├── yolodetectionoutput.cpp
│ ├── yolodetectionoutput.h
│ ├── yolov3detectionoutput.cpp
│ └── yolov3detectionoutput.h
├── layer_declaration.h.in
├── layer_registry.h.in
├── layer_shader_registry.h.in
├── layer_shader_spv_data.h.in
├── layer_type.h
├── layer_type_enum.h.in
├── mat.cpp
├── mat.h
├── mat_pixel.cpp
├── mat_pixel_resize.cpp
├── modelbin.cpp
├── modelbin.h
├── net.cpp
├── net.h
├── opencv.cpp
├── opencv.h
├── option.cpp
├── option.h
├── paramdict.cpp
├── paramdict.h
├── pipeline.cpp
├── pipeline.h
└── platform.h.in
├── toolchains
├── aarch64-linux-gnu.toolchain.cmake
├── arm-linux-gnueabi.toolchain.cmake
├── arm-linux-gnueabihf.toolchain.cmake
├── himix100.toolchain.cmake
├── himix200.toolchain.cmake
├── hisiv300.toolchain.cmake
├── hisiv500.toolchain.cmake
├── hisiv600.toolchain.cmake
├── host.gcc.toolchain.cmake
├── ios.toolchain.cmake
├── iossimxc-x64.toolchain.cmake
├── iossimxc.toolchain.cmake
├── iosxc-arm64.toolchain.cmake
├── iosxc.toolchain.cmake
├── jetson.toolchain.cmake
└── pi3.toolchain.cmake
└── tools
├── CMakeLists.txt
├── README_CN.md
├── caffe
├── CMakeLists.txt
├── caffe.proto
└── caffe2ncnn.cpp
├── darknet
└── readme.txt
├── mxnet
├── CMakeLists.txt
└── mxnet2ncnn.cpp
├── ncnn2mem.cpp
├── ncnnoptimize.cpp
├── onnx
├── CMakeLists.txt
├── onnx.proto
├── onnx2ncnn.cpp
└── ssd.onnx
├── plugin
├── ImageWatchNCNN.natvis
├── README.md
└── snapshot.png
├── pytorch
└── readme.txt
├── quantize
├── CMakeLists.txt
├── ncnn2int8.cpp
└── ncnn2table.cpp
└── tensorflow
├── .tensorflow2ncnn.cpp.swp
├── CMakeLists.txt
├── attr_value.proto
├── function.proto
├── graph.proto
├── node_def.proto
├── op_def.proto
├── resource_handle.proto
├── tensor.proto
├── tensor_shape.proto
├── tensorflow2ncnn.cpp
├── types.proto
└── versions.proto
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 | ## Acknowledgements
3 | - Thanks to bug1989 [https://github.com/bug1989] for contributing the initial quantized int8 inference code and a large variety of device benchmark
4 |
--------------------------------------------------------------------------------
/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleName
6 | ncnn
7 | CFBundleIdentifier
8 | com.tencent.ncnn
9 | CFBundleVersion
10 | 1.0
11 | CFBundleShortVersionString
12 | 1.0
13 | CFBundleSignature
14 | ????
15 | CFBundlePackageType
16 | FMWK
17 |
18 |
19 |
--------------------------------------------------------------------------------
/benchmark/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(benchncnn benchncnn.cpp)
2 | target_link_libraries(benchncnn PRIVATE ncnn)
3 |
--------------------------------------------------------------------------------
/benchmark/alexnet.param:
--------------------------------------------------------------------------------
1 | 7767517
2 | 15 15
3 | Input data 0 1 data 0=227 1=227 2=3
4 | Convolution conv1 1 1 data conv1_relu1 0=96 1=11 3=4 5=1 6=34848 9=1
5 | LRN norm1 1 1 conv1_relu1 norm1 2=0.000100
6 | Pooling pool1 1 1 norm1 pool1 1=3 2=2
7 | ConvolutionDepthWise conv2 1 1 pool1 conv2_relu2 0=256 1=5 4=2 5=1 6=307200 7=2 9=1
8 | LRN norm2 1 1 conv2_relu2 norm2 2=0.000100
9 | Pooling pool2 1 1 norm2 pool2 1=3 2=2
10 | Convolution conv3 1 1 pool2 conv3_relu3 0=384 1=3 4=1 5=1 6=884736 9=1
11 | ConvolutionDepthWise conv4 1 1 conv3_relu3 conv4_relu4 0=384 1=3 4=1 5=1 6=663552 7=2 9=1
12 | ConvolutionDepthWise conv5 1 1 conv4_relu4 conv5_relu5 0=256 1=3 4=1 5=1 6=442368 7=2 9=1
13 | Pooling pool5 1 1 conv5_relu5 pool5 1=3 2=2
14 | InnerProduct fc6 1 1 pool5 fc6_drop6 0=4096 1=1 2=37748736 9=1
15 | InnerProduct fc7 1 1 fc6_drop6 fc7_drop7 0=4096 1=1 2=16777216 9=1
16 | InnerProduct fc8 1 1 fc7_drop7 fc8 0=1000 1=1 2=4096000
17 | Softmax prob 1 1 fc8 output
18 |
--------------------------------------------------------------------------------
/cmake/ncnnConfig.cmake.in:
--------------------------------------------------------------------------------
1 | set(NCNN_OPENMP @NCNN_OPENMP@)
2 | set(NCNN_VULKAN @NCNN_VULKAN@)
3 |
4 | if(NCNN_OPENMP)
5 | find_package(OpenMP)
6 | endif()
7 |
8 | if(NCNN_VULKAN)
9 | find_package(Vulkan REQUIRED)
10 |
11 | add_library(Vulkan UNKNOWN IMPORTED)
12 | set_target_properties(Vulkan PROPERTIES IMPORTED_LOCATION ${Vulkan_LIBRARY})
13 | set_target_properties(Vulkan PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Vulkan_INCLUDE_DIR})
14 | endif()
15 |
16 | include(${CMAKE_CURRENT_LIST_DIR}/ncnn.cmake)
17 |
--------------------------------------------------------------------------------
/docs/developer-guide/aarch64-mix-assembly-and-intrinsic.md:
--------------------------------------------------------------------------------
1 | ```
2 | // v寄存器全部使用 %.4s
3 | // 128-bit vreg matches %.4s
4 | // a += b * c
5 | float32x4_t _a = vld1q_f32(a);
6 | float32x4_t _b = vld1q_f32(b);
7 | float32x4_t _c = vld1q_f32(c);
8 | asm volatile(
9 | "fmla %0.4s, %2.4s, %3.4s"
10 | : "=w"(_a) // %0
11 | : "0"(_a),
12 | "w"(_b), // %2
13 | "w"(_c) // %3
14 | :
15 | );
16 | ```
17 | ```
18 | // v寄存器使用低64位 %.2s
19 | // low 64-bit vreg matches %.2s
20 | // a += b * c
21 | float32x2_t _a = vld1_f32(a);
22 | float32x2_t _b = vld1_f32(b);
23 | float32x2_t _c = vld1_f32(c);
24 | asm volatile(
25 | "fmla %0.2s, %2.2s, %3.2s"
26 | : "=w"(_a) // %0
27 | : "0"(_a),
28 | "w"(_b), // %2
29 | "w"(_c) // %3
30 | :
31 | );
32 | ```
33 | ```
34 | // v寄存器单路使用 %.s[0] %.s[1] %.s[2] %.s[3]
35 | // 32-bit register matches %.s[0]
36 | // a += b * c[0]
37 | // a += b * c[1]
38 | // a += b * c[2]
39 | // a += b * c[3]
40 | float32x4_t _a = vld1_f32(a);
41 | float32x4_t _b = vld1_f32(b);
42 | float32x4_t _c = vld1_f32(c);
43 | asm volatile(
44 | "fmla %0.4s, %2.4s, %3.s[0]"
45 | "fmla %0.4s, %2.4s, %3.s[1]"
46 | "fmla %0.4s, %2.4s, %3.s[2]"
47 | "fmla %0.4s, %2.4s, %3.s[3]"
48 | : "=w"(_a) // %0
49 | : "0"(_a),
50 | "w"(_b), // %2
51 | "w"(_c) // %3
52 | :
53 | );
54 | ```
55 |
56 |
57 | qwq
58 |
--------------------------------------------------------------------------------
/docs/developer-guide/binaryop-broadcasting.md:
--------------------------------------------------------------------------------
1 | ### broadcasting rule
2 |
3 | ncnn BinaryOp accepts blobs with different shape
4 |
5 | C = BinaryOp(A, B)
6 |
7 | shape notation convention is [w], [w,h], [w,h,c]
8 |
9 | |type|A|B|C|
10 | |---|---|---|---|
11 | |1|[1]|scalar|[1]|
12 | |2|[1]|[1]|[1]|
13 | |3|[1]|[2,3]|[2,3]|
14 | |4|[1]|[2,3,4]|[2,3,4]|
15 | |5|[2]|scalar|[2]|
16 | |6|[2]|[1]|[2]|
17 | |7|[2]|[2]|[2]|
18 | |8|[3]|[2,3]|[2,3]|
19 | |9|[4]|[2,3,4]|[2,3,4]|
20 | |10|[2,3]|scalar|[2,3]|
21 | |11|[2,3]|[1]|[2,3]|
22 | |12|[2,3]|[3]|[2,3]|
23 | |13|[2,3]|[2,3]|[2,3]|
24 | |14|[3,4]|[2,3,4]|[2,3,4]|
25 | |15|[2,3,4]|scalar|[2,3,4]|
26 | |16|[2,3,4]|[1]|[2,3,4]|
27 | |17|[2,3,4]|[4]|[2,3,4]|
28 | |18|[2,3,4]|[3,4]|[2,3,4]|
29 | |19|[2,3,4]|[2,3,4]|[2,3,4]|
30 |
31 | some special broadcasting rule exists for model compatibility
32 |
33 | |special type|A|B|C|
34 | |---|---|---|---|
35 | |1|[2,3,4]|[1,1,4]|[2,3,4]|
36 |
--------------------------------------------------------------------------------
/docs/developer-guide/how-to-write-a-neon-optimized-op-kernel.md:
--------------------------------------------------------------------------------
1 | # benchmark
2 | op
3 |
4 | # naive C with openmp
5 | for for for
6 |
7 | # unroll, first try
8 | h
9 |
10 | # register allocation
11 | kernels
12 |
13 | # unroll, second try
14 | simd
15 |
16 | # neon intrinsics
17 | optional
18 |
19 | # naive neon assembly with pld
20 | asm
21 |
22 | # pipeline optimize, first try
23 | more register load mla
24 |
25 | # pipeline optimize, second try
26 | interleave load mla
27 |
28 | # pipeline optimize, third try
29 | loop tail
30 |
31 | # usual practice, load/save
32 | 233
33 |
34 | # usual practice, unroll
35 | 233
36 |
37 | # usual practice, save register
38 | 233
39 |
--------------------------------------------------------------------------------
/docs/developer-guide/preload-practice.zh.md:
--------------------------------------------------------------------------------
1 | ## 只是实践经验,没有理论,不一定正确
2 |
3 | ```
4 | prfm pldl1keep, [x0, #256]
5 | ```
6 | * 放在 ld1 [x0] 前面 0~8 条指令
7 | * #256 表示把 x0+256 的内容放进 L1 cache
8 | * ldp 也适用
9 | * (经验)不写 offset 不如写个 #128
10 | * (经验)pldl1strm 似乎没啥意思,也没 pldl1keep 快
11 | * (经验)x0 ~ x0+256 的内容也会进来
12 | * (经验)load 128bit 用 #128,256bit或更多用 #256
13 | * (经验)避免 pld a,pld b,load a,load b 顺序,可能相互干扰
14 | * (经验)提前太多会失效
15 | * (经验)适合连续读
16 |
17 | ```
18 | prfm pldl2strm, [x0, #256]
19 | ```
20 | * 放在 ld1 [x0] 前面 N 条指令,N 尽量大些
21 | * #256 表示把 x0+256 的内容放进 L2 cache
22 | * ldp 也适用
23 | * (经验)不写 offset 不如写个 #128
24 | * (经验)pldl2strm 效果稍好于 pldl2keep
25 | * (经验)x0 ~ x0+256 的内容也会进来
26 | * (经验)load 128bit 用 #128,256bit 用 #256
27 | * (经验)读很多数据,用不同 offset 连续两次 pldl2strm
28 | * (经验)后面不要对同位置再 pldl1keep,会变慢
29 | * (经验)适合提前准备要跳到很远的地方读,比如换 channel
30 |
--------------------------------------------------------------------------------
/docs/how-to-build/build-for-VS2017.zh.md:
--------------------------------------------------------------------------------
1 | ## 预先准备
2 |
3 | Visual Studio 2017 Community Edition,使用动态的 CRT 运行库
4 |
5 | 以下命令行均使用 **适用于 VS 2017 的 x64 本机工具命令提示**
6 |
7 | ## 编译安装 protobuf
8 |
9 | https://github.com/google/protobuf/archive/v3.4.0.zip
10 |
11 | 我下载到 C:/Users/shuiz/source 解压缩
12 |
13 | ```
14 | mkdir build-vs2017
15 | cd build-vs2017
16 | cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install \
17 | -Dprotobuf_BUILD_TESTS=OFF \
18 | -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
19 | nmake
20 | nmake install
21 | ```
22 |
23 | protobuf 会安装在 build-vs2017/install 里头
24 |
25 | ## 编译安装 ncnn
26 |
27 | https://github.com/Tencent/ncnn.git
28 |
29 | cmake 命令中的 protobuf 路径要相应修改成自己的
30 |
31 | ```
32 | mkdir build-vs2017
33 | cd build-vs2017
34 | cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install \
35 | -DProtobuf_INCLUDE_DIR=C:/Users/shuiz/source/protobuf-3.4.0/build-vs2017/install/include \
36 | -DProtobuf_LIBRARIES=C:/Users/shuiz/source/protobuf-3.4.0/build-vs2017/install/lib/libprotobuf.lib \
37 | -DProtobuf_PROTOC_EXECUTABLE=C:/Users/shuiz/source/protobuf-3.4.0/build-vs2017/install/bin/protoc.exe ..
38 | nmake
39 | nmake install
40 | ```
41 |
42 | ncnn 会安装在 build-vs2017/install 里头
43 |
44 | ncnn 转换工具在 build-vs2017/tools 里头
45 |
46 |
--------------------------------------------------------------------------------
/docs/how-to-use-and-FAQ/quantized-int8-inference.md:
--------------------------------------------------------------------------------
1 | under construction ...
2 |
3 | ## caffe-int8-convert-tools
4 | https://github.com/BUG1989/caffe-int8-convert-tools
5 |
6 | ## convert caffe model to ncnn quantized int8 model
7 | ### the offline way, reduce model binary size down to 25%
8 |
9 | |sample model binary|size|
10 | |---|---|
11 | |squeezenet.bin|4.7M|
12 | |squeezenet-int8.bin|1.2M|
13 | |mobilenet_ssd_voc.bin|22.1M|
14 | |mobilenet_ssd_voc-int8.bin|5.6M|
15 |
16 | ```
17 | ./caffe2ncnn resnet.prototxt resnet.caffemodel resnet-int8.param resnet-int8.bin 256 resnet.table
18 | ```
19 | ### the runtime way, no model binary reduction
20 | ```
21 | ./caffe2ncnn resnet.prototxt resnet.caffemodel resnet-fp32-int8.param resnet-fp32-int8.bin 0 resnet.table
22 | ```
23 |
24 | ## use ncnn int8 inference
25 | the ncnn library would use int8 inference automatically, nothing changed in your code
26 | ```
27 | ncnn::Net resnet;
28 | resnet.load_param("resnet-int8.param");
29 | resnet.load_model("resnet-int8.bin");
30 | ```
31 | ### turn off int8 inference, the runtime model only
32 | ```
33 | ncnn::Net resnet;
34 | resnet.use_int8_inference = 0;// set the switch before loading, force int8 inference off
35 | resnet.load_param("resnet-fp32-int8.param");
36 | resnet.load_model("resnet-fp32-int8.bin");
37 | ```
38 |
39 | ## mixed precision inference
40 | before converting your model files, delete the layer weight scale line in table file, and that layer will do the float32 inference
41 | ```
42 | conv1_param_0 156.639840536
43 | ```
44 | ```
45 | ```
46 |
--------------------------------------------------------------------------------
/docs/how-to-use-and-FAQ/use-ncnn-with-pytorch-or-onnx.md:
--------------------------------------------------------------------------------
1 | Here is a practical guide for converting pytorch model to ncnn
2 |
3 | resnet18 is used as the example
4 |
5 | ## pytorch to onnx
6 |
7 | The official pytorch tutorial for exporting onnx model
8 |
9 | https://pytorch.org/tutorials/advanced/super_resolution_with_caffe2.html
10 |
11 | ```
12 | import torch
13 | import torchvision
14 | import torch.onnx
15 |
16 | # An instance of your model
17 | model = torchvision.models.resnet18()
18 |
19 | # An example input you would normally provide to your model's forward() method
20 | x = torch.rand(1, 3, 224, 224)
21 |
22 | # Export the model
23 | torch_out = torch.onnx._export(model, x, "resnet18.onnx", export_params=True)
24 | ```
25 |
26 | ## simplify onnx model
27 |
28 | The exported resnet18.onnx model may contains many redundant operators such as Shape, Gather and Unsqueeze that is not supported in ncnn
29 |
30 | ```
31 | Shape not supported yet!
32 | Gather not supported yet!
33 | # axis=0
34 | Unsqueeze not supported yet!
35 | # axes 7
36 | Unsqueeze not supported yet!
37 | # axes 7
38 | ```
39 |
40 | Fortunately, daquexian developed a handy tool to eliminate them. cheers!
41 |
42 | https://github.com/daquexian/onnx-simplifier
43 |
44 | ```
45 | python3 -m onnxsim resnet18.onnx resnet18-sim.onnx
46 | ```
47 |
48 | ## onnx to ncnn
49 |
50 | Finally, you can convert the model to ncnn using tools/onnx2ncnn
51 |
52 | ```
53 | onnx2ncnn resnet18-sim.onnx resnet18.param resnet18.bin
54 | ```
55 |
56 |
--------------------------------------------------------------------------------
/docs/how-to-use-and-FAQ/use-ncnnoptmize-to-optimize-model.md:
--------------------------------------------------------------------------------
1 | ### Non ARM Linux Platform
2 |
3 | the typical usage
4 | ```
5 | ncnnoptimize mobilenet.param mobilenet.bin mobilenet-opt.param mobilenet-opt.bin 65536
6 | ```
7 |
8 | operator fusion
9 | * batchnorm - scale
10 | * convolution - batchnorm
11 | * convolutiondepthwise - batchnorm
12 | * deconvolution - batchnorm
13 | * deconvolutiondepthwise - batchnorm
14 | * innerproduct - batchnorm
15 | * convolution - relu
16 | * convolutiondepthwise - relu
17 | * deconvolution - relu
18 | * deconvolutiondepthwise - relu
19 | * innerproduct - relu
20 |
21 | eliminate noop operator
22 | * innerproduct - dropout
23 | * flatten after global pooling
24 |
25 | prefer better operator
26 | * replace convolution with innerproduct after global pooling
27 |
28 | ### ARM Linux Platform
29 | usage
30 | ```
31 | ncnnoptimize squeezenet.param squeezenet.bin squeezenet-opt.param squeezenet-opt.bin 0 data 227 224 3
32 | ```
33 |
34 | explanation
35 |
36 | |parameter|meaning|
37 | |---|---|
38 | |data|input data node, currently support one input|
39 | |227|input weight|
40 | |224|input height|
41 | |3|input channel|
42 |
43 | this feature would auto choose the fastest convolution implementation, normally speedup 10%.
44 |
--------------------------------------------------------------------------------
/examples/squeezencnn/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/examples/squeezencnn/ant.properties:
--------------------------------------------------------------------------------
1 | # This file is used to override default values used by the Ant build system.
2 | #
3 | # This file must be checked into Version Control Systems, as it is
4 | # integral to the build system of your project.
5 |
6 | # This file is only used by the Ant script.
7 |
8 | # You can use this to override default values such as
9 | # 'source.dir' for the location of your java source folder and
10 | # 'out.dir' for the location of your output folder.
11 |
12 | # You can also use it define how the release builds are signed by declaring
13 | # the following properties:
14 | # 'key.store' for the location of your keystore and
15 | # 'key.alias' for the name of the key to use.
16 | # The password will be asked during the build when you use the 'release' target.
17 |
18 | key.store=/home/nihui/osd/nihuini-release-key.keystore
19 | key.alias=nihuini
20 | key.store.password=nihuini
21 | key.alias.password=nihuini
22 |
--------------------------------------------------------------------------------
/examples/squeezencnn/assets/squeezenet_v1.1.bin:
--------------------------------------------------------------------------------
1 | ../../squeezenet_v1.1.bin
--------------------------------------------------------------------------------
/examples/squeezencnn/assets/squeezenet_v1.1.param.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/examples/squeezencnn/assets/squeezenet_v1.1.param.bin
--------------------------------------------------------------------------------
/examples/squeezencnn/assets/synset_words.txt:
--------------------------------------------------------------------------------
1 | ../../synset_words.txt
--------------------------------------------------------------------------------
/examples/squeezencnn/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | # change this folder path to yours
4 | NCNN_INSTALL_PATH := /home/nihui/osd/ncnn-release/ncnn-android-vulkan-lib
5 |
6 | include $(CLEAR_VARS)
7 | LOCAL_MODULE := ncnn
8 | LOCAL_SRC_FILES := $(NCNN_INSTALL_PATH)/$(TARGET_ARCH_ABI)/libncnn.a
9 | include $(PREBUILT_STATIC_LIBRARY)
10 |
11 | include $(CLEAR_VARS)
12 |
13 | LOCAL_MODULE := squeezencnn
14 | LOCAL_SRC_FILES := squeezencnn_jni.cpp
15 |
16 | LOCAL_C_INCLUDES := $(NCNN_INSTALL_PATH)/include
17 |
18 | LOCAL_STATIC_LIBRARIES := ncnn
19 |
20 | LOCAL_CFLAGS := -O2 -fvisibility=hidden -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math
21 | LOCAL_CPPFLAGS := -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math
22 | LOCAL_LDFLAGS += -Wl,--gc-sections
23 |
24 | LOCAL_CFLAGS += -fopenmp
25 | LOCAL_CPPFLAGS += -fopenmp
26 | LOCAL_LDFLAGS += -fopenmp
27 |
28 | LOCAL_LDLIBS := -lz -llog -ljnigraphics -lvulkan
29 |
30 | include $(BUILD_SHARED_LIBRARY)
31 |
--------------------------------------------------------------------------------
/examples/squeezencnn/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_STL := c++_static
2 | APP_ABI := armeabi-v7a arm64-v8a
3 | APP_PLATFORM := android-24
4 |
--------------------------------------------------------------------------------
/examples/squeezencnn/local.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must *NOT* be checked into Version Control Systems,
5 | # as it contains information specific to your local configuration.
6 |
7 | # location of the SDK. This is only used by Ant
8 | # For customization when using a Version Control System, please read the
9 | # header note.
10 | sdk.dir=/home/nihui/osd/android-sdk-linux
11 |
--------------------------------------------------------------------------------
/examples/squeezencnn/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/examples/squeezencnn/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-24
15 |
--------------------------------------------------------------------------------
/examples/squeezencnn/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
22 |
27 |
28 |
29 |
34 |
35 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/examples/squeezencnn/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | squeezencnn
4 |
5 |
--------------------------------------------------------------------------------
/examples/squeezencnn/src/com/tencent/squeezencnn/SqueezeNcnn.java:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | package com.tencent.squeezencnn;
16 |
17 | import android.graphics.Bitmap;
18 | import android.content.Context;
19 |
20 | public class SqueezeNcnn
21 | {
22 | public native boolean Init(byte[] param, byte[] bin, byte[] words);
23 |
24 | public native String Detect(Bitmap bitmap, boolean use_gpu);
25 |
26 | static {
27 | System.loadLibrary("squeezencnn");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/examples/squeezenet_v1.1.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/examples/squeezenet_v1.1.bin
--------------------------------------------------------------------------------
/examples/squeezenet_v1.1.caffemodel:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/examples/squeezenet_v1.1.caffemodel
--------------------------------------------------------------------------------
/images/128-ncnn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/images/128-ncnn.png
--------------------------------------------------------------------------------
/images/16-ncnn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/images/16-ncnn.png
--------------------------------------------------------------------------------
/images/256-ncnn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/images/256-ncnn.png
--------------------------------------------------------------------------------
/images/2eff677a1588b8bcf8382183192b44c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/images/2eff677a1588b8bcf8382183192b44c.png
--------------------------------------------------------------------------------
/images/32-ncnn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/images/32-ncnn.png
--------------------------------------------------------------------------------
/images/64-ncnn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/images/64-ncnn.png
--------------------------------------------------------------------------------
/myPro/benchmark/benchncnn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/benchmark/benchncnn
--------------------------------------------------------------------------------
/myPro/examples/fasterrcnn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/fasterrcnn
--------------------------------------------------------------------------------
/myPro/examples/mobilenetssd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/mobilenetssd
--------------------------------------------------------------------------------
/myPro/examples/mobilenetv2ssdlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/mobilenetv2ssdlite
--------------------------------------------------------------------------------
/myPro/examples/peleenetssd_seg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/peleenetssd_seg
--------------------------------------------------------------------------------
/myPro/examples/rfcn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/rfcn
--------------------------------------------------------------------------------
/myPro/examples/shufflenetv2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/shufflenetv2
--------------------------------------------------------------------------------
/myPro/examples/squeezenet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/squeezenet
--------------------------------------------------------------------------------
/myPro/examples/squeezenet_v1.1.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/squeezenet_v1.1.bin
--------------------------------------------------------------------------------
/myPro/examples/squeezenetssd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/squeezenetssd
--------------------------------------------------------------------------------
/myPro/examples/yolov2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/yolov2
--------------------------------------------------------------------------------
/myPro/examples/yolov3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/examples/yolov3
--------------------------------------------------------------------------------
/myPro/projects/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/projects/1.jpg
--------------------------------------------------------------------------------
/myPro/projects/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/projects/2.jpg
--------------------------------------------------------------------------------
/myPro/projects/myNet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/projects/myNet
--------------------------------------------------------------------------------
/myPro/projects/yolo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/projects/yolo
--------------------------------------------------------------------------------
/myPro/src/layer_shader_registry.h:
--------------------------------------------------------------------------------
1 | // Layer Shader Registry header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/myPro/src/layer_shader_spv_data.h:
--------------------------------------------------------------------------------
1 | // Layer Shader Spv Data header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/myPro/src/layer_type_enum.h:
--------------------------------------------------------------------------------
1 | // Layer Type Enum header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 | AbsVal = 0,
6 | ArgMax = 1,
7 | BatchNorm = 2,
8 | Bias = 3,
9 | BNLL = 4,
10 | Concat = 5,
11 | Convolution = 6,
12 | Crop = 7,
13 | Deconvolution = 8,
14 | Dropout = 9,
15 | Eltwise = 10,
16 | ELU = 11,
17 | Embed = 12,
18 | Exp = 13,
19 | Flatten = 14,
20 | InnerProduct = 15,
21 | Input = 16,
22 | Log = 17,
23 | LRN = 18,
24 | MemoryData = 19,
25 | MVN = 20,
26 | Pooling = 21,
27 | Power = 22,
28 | PReLU = 23,
29 | Proposal = 24,
30 | Reduction = 25,
31 | ReLU = 26,
32 | Reshape = 27,
33 | ROIPooling = 28,
34 | Scale = 29,
35 | Sigmoid = 30,
36 | Slice = 31,
37 | Softmax = 32,
38 | Split = 33,
39 | SPP = 34,
40 | TanH = 35,
41 | Threshold = 36,
42 | Tile = 37,
43 | RNN = 38,
44 | LSTM = 39,
45 | BinaryOp = 40,
46 | UnaryOp = 41,
47 | ConvolutionDepthWise = 42,
48 | Padding = 43,
49 | Squeeze = 44,
50 | ExpandDims = 45,
51 | Normalize = 46,
52 | Permute = 47,
53 | PriorBox = 48,
54 | DetectionOutput = 49,
55 | Interp = 50,
56 | DeconvolutionDepthWise = 51,
57 | ShuffleChannel = 52,
58 | InstanceNorm = 53,
59 | Clip = 54,
60 | Reorg = 55,
61 | YoloDetectionOutput = 56,
62 | Quantize = 57,
63 | Dequantize = 58,
64 | Yolov3DetectionOutput = 59,
65 | PSROIPooling = 60,
66 | ROIAlign = 61,
67 | Packing = 62,
68 | Requantize = 63,
69 | Cast = 64,
70 | HardSigmoid = 65,
71 | SELU = 66,
72 | TFReshape = 67,
73 | TFShape = 68,
74 | TFStridedSlice = 69,
75 | TFPack = 70,
76 | TFResizeBilinear = 71,
77 | TFRange = 72,
78 | TFTile = 73,
79 |
80 |
--------------------------------------------------------------------------------
/myPro/src/libncnn.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/src/libncnn.a
--------------------------------------------------------------------------------
/myPro/tools/caffe/caffe2ncnn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/tools/caffe/caffe2ncnn
--------------------------------------------------------------------------------
/myPro/tools/mxnet/mxnet2ncnn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/tools/mxnet/mxnet2ncnn
--------------------------------------------------------------------------------
/myPro/tools/ncnn2mem:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/tools/ncnn2mem
--------------------------------------------------------------------------------
/myPro/tools/ncnnoptimize:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/tools/ncnnoptimize
--------------------------------------------------------------------------------
/myPro/tools/onnx/exp.frozen.onnx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/tools/onnx/exp.frozen.onnx
--------------------------------------------------------------------------------
/myPro/tools/onnx/ncnn.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/tools/onnx/ncnn.bin
--------------------------------------------------------------------------------
/myPro/tools/onnx/onnx2ncnn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/tools/onnx/onnx2ncnn
--------------------------------------------------------------------------------
/myPro/tools/tensorflow/tensorflow2ncnn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/myPro/tools/tensorflow/tensorflow2ncnn
--------------------------------------------------------------------------------
/projects/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs)
2 | if(NOT OpenCV_FOUND)
3 | find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)
4 | endif()
5 |
6 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
7 | include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)
8 |
9 | set(NCNN_EXAMPLE_LINK_LIBRARIES ncnn ${OpenCV_LIBS})
10 | if(NCNN_VULKAN)
11 | list(APPEND NCNN_EXAMPLE_LINK_LIBRARIES ${Vulkan_LIBRARY})
12 | endif()
13 |
14 |
15 | add_executable(myNet myNet.cpp)
16 | target_link_libraries(myNet ${NCNN_EXAMPLE_LINK_LIBRARIES})
17 |
18 | add_executable(yolo yolo.cpp)
19 | target_link_libraries(yolo ${NCNN_EXAMPLE_LINK_LIBRARIES})
20 |
--------------------------------------------------------------------------------
/src/benchmark.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_BENCHMARK_H
16 | #define NCNN_BENCHMARK_H
17 |
18 | #include "platform.h"
19 | #include "mat.h"
20 | #include "layer.h"
21 |
22 | namespace ncnn {
23 |
24 | // get now timestamp in ms
25 | double get_current_time();
26 |
27 | #if NCNN_BENCHMARK
28 |
29 | void benchmark(const Layer* layer, double start, double end);
30 | void benchmark(const Layer* layer, const Mat& bottom_blob, Mat& top_blob, double start, double end);
31 |
32 | #endif // NCNN_BENCHMARK
33 |
34 | } // namespace ncnn
35 |
36 | #endif // NCNN_BENCHMARK_H
37 |
--------------------------------------------------------------------------------
/src/blob.cpp:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #include "blob.h"
16 |
17 | namespace ncnn {
18 |
19 | Blob::Blob()
20 | {
21 | producer = -1;
22 | }
23 |
24 | } // namespace ncnn
25 |
--------------------------------------------------------------------------------
/src/blob.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_BLOB_H
16 | #define NCNN_BLOB_H
17 |
18 | #include
19 | #include
20 | #include "platform.h"
21 |
22 | namespace ncnn {
23 |
24 | class Blob
25 | {
26 | public:
27 | // empty
28 | Blob();
29 |
30 | public:
31 | #if NCNN_STRING
32 | // blob name
33 | std::string name;
34 | #endif // NCNN_STRING
35 | // layer index which produce this blob as output
36 | int producer;
37 | // layer index which need this blob as input
38 | std::vector consumers;
39 | };
40 |
41 | } // namespace ncnn
42 |
43 | #endif // NCNN_BLOB_H
44 |
--------------------------------------------------------------------------------
/src/layer/.clip.cpp.swp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/src/layer/.clip.cpp.swp
--------------------------------------------------------------------------------
/src/layer/absval.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ABSVAL_H
16 | #define LAYER_ABSVAL_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class AbsVal : public Layer
23 | {
24 | public:
25 | AbsVal();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_ABSVAL_H
33 |
--------------------------------------------------------------------------------
/src/layer/argmax.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ARGMAX_H
16 | #define LAYER_ARGMAX_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class ArgMax : public Layer
23 | {
24 | public:
25 | ArgMax();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int out_max_val;
33 | int topk;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_ARGMAX_H
39 |
--------------------------------------------------------------------------------
/src/layer/arm/absval_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ABSVAL_ARM_H
16 | #define LAYER_ABSVAL_ARM_H
17 |
18 | #include "absval.h"
19 |
20 | namespace ncnn {
21 |
22 | class AbsVal_arm : virtual public AbsVal
23 | {
24 | public:
25 | AbsVal_arm();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_ABSVAL_ARM_H
33 |
--------------------------------------------------------------------------------
/src/layer/arm/batchnorm_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_BATCHNORM_ARM_H
16 | #define LAYER_BATCHNORM_ARM_H
17 |
18 | #include "batchnorm.h"
19 |
20 | namespace ncnn {
21 |
22 | class BatchNorm_arm : virtual public BatchNorm
23 | {
24 | public:
25 | BatchNorm_arm();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_BATCHNORM_ARM_H
33 |
--------------------------------------------------------------------------------
/src/layer/arm/bias_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_BIAS_ARM_H
16 | #define LAYER_BIAS_ARM_H
17 |
18 | #include "bias.h"
19 |
20 | namespace ncnn {
21 |
22 | class Bias_arm : virtual public Bias
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_BIAS_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/binaryop_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_BINARYOP_ARM_H
16 | #define LAYER_BINARYOP_ARM_H
17 |
18 | #include "binaryop.h"
19 |
20 | namespace ncnn {
21 |
22 | class BinaryOp_arm : virtual public BinaryOp
23 | {
24 | public:
25 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_BINARYOP_ARM_H
33 |
--------------------------------------------------------------------------------
/src/layer/arm/clip_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CLIP_ARM_H
16 | #define LAYER_CLIP_ARM_H
17 |
18 | #include "clip.h"
19 |
20 | namespace ncnn {
21 |
22 | class Clip_arm : virtual public Clip
23 | {
24 | public:
25 | Clip_arm();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_CLIP_ARM_H
33 |
--------------------------------------------------------------------------------
/src/layer/arm/convolution_5x5_int8.h:
--------------------------------------------------------------------------------
1 | // BUG1989 is pleased to support the open source community by supporting ncnn available.
2 | //
3 | // Copyright (C) 2019 BUG1989. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | static void conv5x5s1_int8_neon(const Mat &bottom_blob, Mat &top_blob, const Mat &_kernel, const Option& opt)
16 | {
17 | int kernel_w = 5;
18 | int kernel_h = 5;
19 |
20 | int stride_w = 1;
21 | int stride_h = 1;
22 |
23 | conv_im2col_sgemm_int8_neon(bottom_blob, top_blob, _kernel, kernel_w, kernel_h, stride_w, stride_h, opt);
24 | }
25 |
26 | static void conv5x5s2_int8_neon(const Mat &bottom_blob, Mat &top_blob, const Mat &_kernel, const Option& opt)
27 | {
28 | int kernel_w = 5;
29 | int kernel_h = 5;
30 |
31 | int stride_w = 2;
32 | int stride_h = 2;
33 |
34 | conv_im2col_sgemm_int8_neon(bottom_blob, top_blob, _kernel, kernel_w, kernel_h, stride_w, stride_h, opt);
35 | }
36 |
--------------------------------------------------------------------------------
/src/layer/arm/convolution_7x7_int8.h:
--------------------------------------------------------------------------------
1 | // BUG1989 is pleased to support the open source community by supporting ncnn available.
2 | //
3 | // Copyright (C) 2019 BUG1989. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | static void conv7x7s1_int8_neon(const Mat &bottom_blob, Mat &top_blob, const Mat &_kernel, const Option& opt)
16 | {
17 | int kernel_w = 7;
18 | int kernel_h = 7;
19 |
20 | int stride_w = 1;
21 | int stride_h = 1;
22 |
23 | conv_im2col_sgemm_int8_neon(bottom_blob, top_blob, _kernel, kernel_w, kernel_h, stride_w, stride_h, opt);
24 | }
25 |
26 | static void conv7x7s2_int8_neon(const Mat &bottom_blob, Mat &top_blob, const Mat &_kernel, const Option& opt)
27 | {
28 | int kernel_w = 7;
29 | int kernel_h = 7;
30 |
31 | int stride_w = 2;
32 | int stride_h = 2;
33 |
34 | conv_im2col_sgemm_int8_neon(bottom_blob, top_blob, _kernel, kernel_w, kernel_h, stride_w, stride_h, opt);
35 | }
36 |
--------------------------------------------------------------------------------
/src/layer/arm/deconvolution_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_DECONVOLUTION_ARM_H
16 | #define LAYER_DECONVOLUTION_ARM_H
17 |
18 | #include "deconvolution.h"
19 |
20 | namespace ncnn {
21 |
22 | class Deconvolution_arm : virtual public Deconvolution
23 | {
24 | public:
25 | Deconvolution_arm();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
31 |
32 | public:
33 | Layer* activation;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_DECONVOLUTION_ARM_H
39 |
--------------------------------------------------------------------------------
/src/layer/arm/deconvolutiondepthwise_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_DECONVOLUTIONDEPTHWISE_ARM_H
16 | #define LAYER_DECONVOLUTIONDEPTHWISE_ARM_H
17 |
18 | #include "deconvolutiondepthwise.h"
19 |
20 | namespace ncnn {
21 |
22 | class DeconvolutionDepthWise_arm : virtual public DeconvolutionDepthWise
23 | {
24 | public:
25 | DeconvolutionDepthWise_arm();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
31 |
32 | public:
33 | Layer* activation;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_DECONVOLUTIONDEPTHWISE_ARM_H
39 |
--------------------------------------------------------------------------------
/src/layer/arm/dequantize_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_DEQUANTIZE_ARM_H
16 | #define LAYER_DEQUANTIZE_ARM_H
17 |
18 | #include "dequantize.h"
19 |
20 | namespace ncnn {
21 |
22 | class Dequantize_arm : virtual public Dequantize
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_DEQUANTIZE_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/dropout_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_DROPOUT_ARM_H
16 | #define LAYER_DROPOUT_ARM_H
17 |
18 | #include "dropout.h"
19 |
20 | namespace ncnn {
21 |
22 | class Dropout_arm : virtual public Dropout
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_DROPOUT_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/eltwise_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ELTWISE_ARM_H
16 | #define LAYER_ELTWISE_ARM_H
17 |
18 | #include "eltwise.h"
19 |
20 | namespace ncnn {
21 |
22 | class Eltwise_arm : virtual public Eltwise
23 | {
24 | public:
25 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_ELTWISE_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/flatten_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_FLATTEN_ARM_H
16 | #define LAYER_FLATTEN_ARM_H
17 |
18 | #include "flatten.h"
19 |
20 | namespace ncnn {
21 |
22 | class Flatten_arm : virtual public Flatten
23 | {
24 | public:
25 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_FLATTEN_ARM_H
31 |
32 |
--------------------------------------------------------------------------------
/src/layer/arm/hardsigmoid_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_HARDSIGMOID_ARM_H
16 | #define LAYER_HARDSIGMOID_ARM_H
17 |
18 | #include "hardsigmoid.h"
19 |
20 | namespace ncnn {
21 |
22 | class HardSigmoid_arm : virtual public HardSigmoid
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_HARDSIGMOID_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/innerproduct_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_INNERPRODUCT_ARM_H
16 | #define LAYER_INNERPRODUCT_ARM_H
17 |
18 | #include "innerproduct.h"
19 |
20 | namespace ncnn {
21 |
22 | class InnerProduct_arm : virtual public InnerProduct
23 | {
24 | public:
25 | virtual int create_pipeline(const Option& opt);
26 |
27 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
28 |
29 | public:
30 | // pack4
31 | Mat weight_data_pack4;
32 | Mat weight_data_pack1to4;
33 | Mat weight_data_pack4to1;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_INNERPRODUCT_ARM_H
39 |
--------------------------------------------------------------------------------
/src/layer/arm/interp_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_INTERP_ARM_H
16 | #define LAYER_INTERP_ARM_H
17 |
18 | #include "interp.h"
19 |
20 | namespace ncnn {
21 |
22 | class Interp_arm : virtual public Interp
23 | {
24 | public:
25 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_INTERP_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/lrn_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_LRN_ARM_H
16 | #define LAYER_LRN_ARM_H
17 |
18 | #include "lrn.h"
19 |
20 | namespace ncnn {
21 |
22 | class LRN_arm : virtual public LRN
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_LRN_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/packing_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PACKING_ARM_H
16 | #define LAYER_PACKING_ARM_H
17 |
18 | #include "packing.h"
19 |
20 | namespace ncnn {
21 |
22 | class Packing_arm : virtual public Packing
23 | {
24 | public:
25 | Packing_arm();
26 |
27 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_PACKING_ARM_H
33 |
--------------------------------------------------------------------------------
/src/layer/arm/padding_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PADDING_ARM_H
16 | #define LAYER_PADDING_ARM_H
17 |
18 | #include "padding.h"
19 |
20 | namespace ncnn {
21 |
22 | class Padding_arm : virtual public Padding
23 | {
24 | public:
25 | Padding_arm();
26 |
27 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_PADDING_ARM_H
33 |
--------------------------------------------------------------------------------
/src/layer/arm/pooling_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_POOLING_ARM_H
16 | #define LAYER_POOLING_ARM_H
17 |
18 | #include "pooling.h"
19 |
20 | namespace ncnn {
21 |
22 | class Pooling_arm : virtual public Pooling
23 | {
24 | public:
25 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_POOLING_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/prelu_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PRELU_ARM_H
16 | #define LAYER_PRELU_ARM_H
17 |
18 | #include "prelu.h"
19 |
20 | namespace ncnn {
21 |
22 | class PReLU_arm : virtual public PReLU
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_PRELU_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/quantize_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_QUANTIZE_ARM_H
16 | #define LAYER_QUANTIZE_ARM_H
17 |
18 | #include "quantize.h"
19 |
20 | namespace ncnn {
21 |
22 | class Quantize_arm : virtual public Quantize
23 | {
24 | public:
25 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_QUANTIZE_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/relu_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_RELU_ARM_H
16 | #define LAYER_RELU_ARM_H
17 |
18 | #include "relu.h"
19 |
20 | namespace ncnn {
21 |
22 | class ReLU_arm : virtual public ReLU
23 | {
24 | public:
25 | ReLU_arm();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | virtual int forward_inplace_int8(Mat& bottom_top_blob, const Option& opt) const;
29 | };
30 |
31 | } // namespace ncnn
32 |
33 | #endif // LAYER_RELU_ARM_H
34 |
--------------------------------------------------------------------------------
/src/layer/arm/requantize_arm.h:
--------------------------------------------------------------------------------
1 | // BUG1989 is pleased to support the open source community by supporting ncnn available.
2 | //
3 | // Copyright (C) 2019 BUG1989. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_REQUANTIZE_ARM_H
16 | #define LAYER_REQUANTIZE_ARM_H
17 |
18 | #include "requantize.h"
19 |
20 | namespace ncnn {
21 |
22 | class Requantize_arm : virtual public Requantize
23 | {
24 | public:
25 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_REQUANTIZE_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/scale_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SCALE_ARM_H
16 | #define LAYER_SCALE_ARM_H
17 |
18 | #include "scale.h"
19 |
20 | namespace ncnn {
21 |
22 | class Scale_arm : virtual public Scale
23 | {
24 | public:
25 | virtual int forward_inplace(std::vector& bottom_top_blobs, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_SCALE_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/selu_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SELU_ARM_H
16 | #define LAYER_SELU_ARM_H
17 |
18 | #include "selu.h"
19 |
20 | namespace ncnn {
21 |
22 | class SELU_arm : virtual public SELU
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_SELU_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/sigmoid_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SIGMOID_ARM_H
16 | #define LAYER_SIGMOID_ARM_H
17 |
18 | #include "sigmoid.h"
19 |
20 | namespace ncnn {
21 |
22 | class Sigmoid_arm : virtual public Sigmoid
23 | {
24 | public:
25 | Sigmoid_arm();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_SIGMOID_ARM_H
33 |
--------------------------------------------------------------------------------
/src/layer/arm/softmax_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SOFTMAX_ARM_H
16 | #define LAYER_SOFTMAX_ARM_H
17 |
18 | #include "softmax.h"
19 |
20 | namespace ncnn {
21 |
22 | class Softmax_arm : virtual public Softmax
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_SOFTMAX_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/arm/unaryop_arm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_UNARYOP_ARM_H
16 | #define LAYER_UNARYOP_ARM_H
17 |
18 | #include "unaryop.h"
19 |
20 | namespace ncnn {
21 |
22 | class UnaryOp_arm : virtual public UnaryOp
23 | {
24 | public:
25 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
26 | };
27 |
28 | } // namespace ncnn
29 |
30 | #endif // LAYER_UNARYOP_ARM_H
31 |
--------------------------------------------------------------------------------
/src/layer/batchnorm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_BATCHNORM_H
16 | #define LAYER_BATCHNORM_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class BatchNorm : public Layer
23 | {
24 | public:
25 | BatchNorm();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
32 |
33 | public:
34 | // param
35 | int channels;
36 | float eps;
37 |
38 | // model
39 | Mat slope_data;
40 | Mat mean_data;
41 | Mat var_data;
42 | Mat bias_data;
43 |
44 | Mat a_data;
45 | Mat b_data;
46 | };
47 |
48 | } // namespace ncnn
49 |
50 | #endif // LAYER_BATCHNORM_H
51 |
--------------------------------------------------------------------------------
/src/layer/bias.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_BIAS_H
16 | #define LAYER_BIAS_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Bias : public Layer
23 | {
24 | public:
25 | Bias();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
32 |
33 | public:
34 | // param
35 | int bias_data_size;
36 |
37 | // model
38 | Mat bias_data;
39 | };
40 |
41 | } // namespace ncnn
42 |
43 | #endif // LAYER_BIAS_H
44 |
--------------------------------------------------------------------------------
/src/layer/bnll.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_BNLL_H
16 | #define LAYER_BNLL_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class BNLL : public Layer
23 | {
24 | public:
25 | BNLL();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 |
29 | public:
30 | };
31 |
32 | } // namespace ncnn
33 |
34 | #endif // LAYER_BNLL_H
35 |
--------------------------------------------------------------------------------
/src/layer/cast.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CAST_H
16 | #define LAYER_CAST_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Cast : public Layer
23 | {
24 | public:
25 | Cast();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | // element type
33 | // 0 = auto
34 | // 1 = float32
35 | // 2 = float16
36 | // 3 = int8
37 | int type_from;
38 | int type_to;
39 | };
40 |
41 | } // namespace ncnn
42 |
43 | #endif // LAYER_CAST_H
44 |
--------------------------------------------------------------------------------
/src/layer/clip.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CLIP_H
16 | #define LAYER_CLIP_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Clip : public Layer
23 | {
24 | public:
25 | Clip();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float min;
33 | float max;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_CLIP_H
39 |
--------------------------------------------------------------------------------
/src/layer/concat.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CONCAT_H
16 | #define LAYER_CONCAT_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Concat : public Layer
23 | {
24 | public:
25 | Concat();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | int axis;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_CONCAT_H
38 |
--------------------------------------------------------------------------------
/src/layer/dequantize.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_DEQUANTIZE_H
16 | #define LAYER_DEQUANTIZE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Dequantize : public Layer
23 | {
24 | public:
25 | Dequantize();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
32 |
33 | public:
34 | float scale;
35 | int bias_term;
36 | int bias_data_size;
37 |
38 | Mat bias_data;
39 | };
40 |
41 | } // namespace ncnn
42 |
43 | #endif // LAYER_DEQUANTIZE_H
44 |
--------------------------------------------------------------------------------
/src/layer/detectionoutput.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_DETECTIONOUTPUT_H
16 | #define LAYER_DETECTIONOUTPUT_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class DetectionOutput : public Layer
23 | {
24 | public:
25 | DetectionOutput();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | int num_class;
33 | float nms_threshold;
34 | int nms_top_k;
35 | int keep_top_k;
36 | float confidence_threshold;
37 | float variances[4];
38 | };
39 |
40 | } // namespace ncnn
41 |
42 | #endif // LAYER_DETECTIONOUTPUT_H
43 |
--------------------------------------------------------------------------------
/src/layer/dropout.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_DROPOUT_H
16 | #define LAYER_DROPOUT_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Dropout : public Layer
23 | {
24 | public:
25 | Dropout();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float scale;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_DROPOUT_H
38 |
--------------------------------------------------------------------------------
/src/layer/eltwise.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ELTWISE_H
16 | #define LAYER_ELTWISE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Eltwise : public Layer
23 | {
24 | public:
25 | Eltwise();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | enum { Operation_PROD = 0, Operation_SUM = 1, Operation_MAX = 2 };
32 |
33 | public:
34 | // param
35 | int op_type;
36 | Mat coeffs;
37 | };
38 |
39 | } // namespace ncnn
40 |
41 | #endif // LAYER_ELTWISE_H
42 |
--------------------------------------------------------------------------------
/src/layer/elu.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ELU_H
16 | #define LAYER_ELU_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class ELU : public Layer
23 | {
24 | public:
25 | ELU();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float alpha;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_ELU_H
38 |
--------------------------------------------------------------------------------
/src/layer/embed.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_EMBED_H
16 | #define LAYER_EMBED_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Embed : public Layer
23 | {
24 | public:
25 | Embed();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
32 |
33 | public:
34 | // param
35 | int num_output;
36 | int input_dim;
37 | int bias_term;
38 |
39 | int weight_data_size;
40 |
41 | // model
42 | Mat weight_data;
43 | Mat bias_data;
44 | };
45 |
46 | } // namespace ncnn
47 |
48 | #endif // LAYER_EMBED_H
49 |
--------------------------------------------------------------------------------
/src/layer/exp.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_EXP_H
16 | #define LAYER_EXP_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Exp : public Layer
23 | {
24 | public:
25 | Exp();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float base;
33 | float scale;
34 | float shift;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_EXP_H
40 |
--------------------------------------------------------------------------------
/src/layer/expanddims.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_EXPANDDIMS_H
16 | #define LAYER_EXPANDDIMS_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class ExpandDims : public Layer
23 | {
24 | public:
25 | ExpandDims();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int expand_w;
33 | int expand_h;
34 | int expand_c;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_EXPANDDIMS_H
40 |
--------------------------------------------------------------------------------
/src/layer/flatten.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_FLATTEN_H
16 | #define LAYER_FLATTEN_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Flatten : public Layer
23 | {
24 | public:
25 | Flatten();
26 |
27 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_FLATTEN_H
33 |
--------------------------------------------------------------------------------
/src/layer/hardsigmoid.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_HARDSIGMOID_H
16 | #define LAYER_HARDSIGMOID_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class HardSigmoid : public Layer
23 | {
24 | public:
25 | HardSigmoid();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float alpha, beta, lower, upper;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_HARDSIGMOID_H
38 |
--------------------------------------------------------------------------------
/src/layer/input.cpp:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #include "input.h"
16 |
17 | namespace ncnn {
18 |
19 | DEFINE_LAYER_CREATOR(Input)
20 |
21 | Input::Input()
22 | {
23 | one_blob_only = true;
24 | support_inplace = true;
25 | support_vulkan = false;
26 | }
27 |
28 | int Input::load_param(const ParamDict& pd)
29 | {
30 | w = pd.get(0, 0);
31 | h = pd.get(1, 0);
32 | c = pd.get(2, 0);
33 |
34 | return 0;
35 | }
36 |
37 | int Input::forward_inplace(Mat& /*bottom_top_blob*/, const Option& /*opt*/) const
38 | {
39 | return 0;
40 | }
41 |
42 | } // namespace ncnn
43 |
--------------------------------------------------------------------------------
/src/layer/input.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_INPUT_H
16 | #define LAYER_INPUT_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Input : public Layer
23 | {
24 | public:
25 | Input();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | int w;
33 | int h;
34 | int c;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_INPUT_H
40 |
--------------------------------------------------------------------------------
/src/layer/instancenorm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_INSTANCENORM_H
16 | #define LAYER_INSTANCENORM_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class InstanceNorm : public Layer
23 | {
24 | public:
25 | InstanceNorm();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
32 |
33 | public:
34 | // param
35 | int channels;
36 | float eps;
37 |
38 | // model
39 | Mat gamma_data;
40 | Mat beta_data;
41 | };
42 |
43 | } // namespace ncnn
44 |
45 | #endif // LAYER_INSTANCENORM_H
46 |
--------------------------------------------------------------------------------
/src/layer/interp.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_INTERP_H
16 | #define LAYER_INTERP_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Interp : public Layer
23 | {
24 | public:
25 | Interp();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat &bottom_blob, Mat &top_blob, const Option& opt) const;
30 |
31 | public:
32 | // param
33 | int resize_type;//1=nearest 2=bilinear 3=bicubic
34 | float width_scale;
35 | float height_scale;
36 | int output_width;
37 | int output_height;
38 | };
39 |
40 | } // namespace ncnn
41 |
42 | #endif // LAYER_INTERP_H
43 |
--------------------------------------------------------------------------------
/src/layer/log.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_LOG_H
16 | #define LAYER_LOG_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Log : public Layer
23 | {
24 | public:
25 | Log();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float base;
33 | float scale;
34 | float shift;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_LOG_H
40 |
--------------------------------------------------------------------------------
/src/layer/lrn.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_LRN_H
16 | #define LAYER_LRN_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class LRN : public Layer
23 | {
24 | public:
25 | LRN();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | enum { NormRegion_ACROSS_CHANNELS = 0, NormRegion_WITHIN_CHANNEL = 1 };
32 |
33 | public:
34 | // param
35 | int region_type;
36 | int local_size;
37 | float alpha;
38 | float beta;
39 | float bias;
40 | };
41 |
42 | } // namespace ncnn
43 |
44 | #endif // LAYER_LRN_H
45 |
--------------------------------------------------------------------------------
/src/layer/lstm.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_LSTM_H
16 | #define LAYER_LSTM_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class LSTM : public Layer
23 | {
24 | public:
25 | LSTM();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
32 |
33 | public:
34 | // param
35 | int num_output;
36 | int weight_data_size;
37 |
38 | // model
39 | Mat weight_hc_data;
40 | Mat weight_xc_data;
41 | Mat bias_c_data;
42 | };
43 |
44 | } // namespace ncnn
45 |
46 | #endif // LAYER_LSTM_H
47 |
--------------------------------------------------------------------------------
/src/layer/memorydata.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_MEMORYDATA_H
16 | #define LAYER_MEMORYDATA_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class MemoryData : public Layer
23 | {
24 | public:
25 | MemoryData();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
32 |
33 | public:
34 | int w;
35 | int h;
36 | int c;
37 |
38 | Mat data;
39 | };
40 |
41 | } // namespace ncnn
42 |
43 | #endif // LAYER_MEMORYDATA_H
44 |
--------------------------------------------------------------------------------
/src/layer/mvn.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_MVN_H
16 | #define LAYER_MVN_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class MVN : public Layer
23 | {
24 | public:
25 | MVN();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int normalize_variance;
33 | int across_channels;
34 | float eps;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_MVN_H
40 |
--------------------------------------------------------------------------------
/src/layer/normalize.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_NORMALIZE_H
16 | #define LAYER_NORMALIZE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Normalize : public Layer
23 | {
24 | public:
25 | Normalize();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
32 |
33 | public:
34 | // param
35 | int across_spatial;
36 | int across_channel;
37 | int channel_shared;
38 | float eps;
39 | int scale_data_size;
40 |
41 | Mat scale_data;
42 | };
43 |
44 | } // namespace ncnn
45 |
46 | #endif // LAYER_NORMALIZE_H
47 |
--------------------------------------------------------------------------------
/src/layer/packing.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PACKING_H
16 | #define LAYER_PACKING_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Packing : public Layer
23 | {
24 | public:
25 | Packing();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int out_elempack;
33 | int use_padding;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_PACKING_H
39 |
--------------------------------------------------------------------------------
/src/layer/padding.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PADDING_H
16 | #define LAYER_PADDING_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Padding : public Layer
23 | {
24 | public:
25 | Padding();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
32 |
33 | public:
34 | // -233 = dynamic offset from reference blob
35 | int top;
36 | int bottom;
37 | int left;
38 | int right;
39 | int type;// 0=BORDER_CONSTANT 1=BORDER_REPLICATE
40 | float value;
41 | };
42 |
43 | } // namespace ncnn
44 |
45 | #endif // LAYER_PADDING_H
46 |
--------------------------------------------------------------------------------
/src/layer/permute.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PERMUTE_H
16 | #define LAYER_PERMUTE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Permute : public Layer
23 | {
24 | public:
25 | Permute();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int order_type;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_PERMUTE_H
38 |
--------------------------------------------------------------------------------
/src/layer/power.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_POWER_H
16 | #define LAYER_POWER_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Power : public Layer
23 | {
24 | public:
25 | Power();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float power;
33 | float scale;
34 | float shift;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_POWER_H
40 |
--------------------------------------------------------------------------------
/src/layer/prelu.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PRELU_H
16 | #define LAYER_PRELU_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class PReLU : public Layer
23 | {
24 | public:
25 | PReLU();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
32 |
33 | public:
34 | int num_slope;
35 | Mat slope_data;
36 | };
37 |
38 | } // namespace ncnn
39 |
40 | #endif // LAYER_PRELU_H
41 |
--------------------------------------------------------------------------------
/src/layer/priorbox.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PRIORBOX_H
16 | #define LAYER_PRIORBOX_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class PriorBox : public Layer
23 | {
24 | public:
25 | PriorBox();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | Mat min_sizes;
33 | Mat max_sizes;
34 | Mat aspect_ratios;
35 | float variances[4];
36 | int flip;
37 | int clip;
38 | int image_width;
39 | int image_height;
40 | float step_width;
41 | float step_height;
42 | float offset;
43 | };
44 |
45 | } // namespace ncnn
46 |
47 | #endif // LAYER_PRIORBOX_H
48 |
--------------------------------------------------------------------------------
/src/layer/proposal.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PROPOSAL_H
16 | #define LAYER_PROPOSAL_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Proposal : public Layer
23 | {
24 | public:
25 | Proposal();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | // param
33 | int feat_stride;
34 | int base_size;
35 | int pre_nms_topN;
36 | int after_nms_topN;
37 | float nms_thresh;
38 | int min_size;
39 |
40 | Mat ratios;
41 | Mat scales;
42 |
43 | Mat anchors;
44 | };
45 |
46 | } // namespace ncnn
47 |
48 | #endif // LAYER_PROPOSAL_H
49 |
--------------------------------------------------------------------------------
/src/layer/psroipooling.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PSROIPOOLING_H
16 | #define LAYER_PSROIPOOLING_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class PSROIPooling : public Layer
23 | {
24 | public:
25 | PSROIPooling();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | int pooled_width;
33 | int pooled_height;
34 | float spatial_scale;
35 | int output_dim;
36 | };
37 |
38 | } // namespace ncnn
39 |
40 | #endif // LAYER_PSROIPOOLING_H
41 |
--------------------------------------------------------------------------------
/src/layer/quantize.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_QUANTIZE_H
16 | #define LAYER_QUANTIZE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Quantize : public Layer
23 | {
24 | public:
25 | Quantize();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | float scale;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_QUANTIZE_H
38 |
--------------------------------------------------------------------------------
/src/layer/relu.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_RELU_H
16 | #define LAYER_RELU_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class ReLU : public Layer
23 | {
24 | public:
25 | ReLU();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 | virtual int forward_inplace_int8(Mat& bottom_top_blob, const Option& opt) const;
31 |
32 | public:
33 | float slope;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_RELU_H
39 |
--------------------------------------------------------------------------------
/src/layer/reorg.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_REORG_H
16 | #define LAYER_REORG_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Reorg : public Layer
23 | {
24 | public:
25 | Reorg();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int stride;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_REORG_H
38 |
--------------------------------------------------------------------------------
/src/layer/requantize.h:
--------------------------------------------------------------------------------
1 | // BUG1989 is pleased to support the open source community by supporting ncnn available.
2 | //
3 | // Copyright (C) 2019 BUG1989. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_REQUANTIZE_H
16 | #define LAYER_REQUANTIZE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Requantize : public Layer
23 | {
24 | public:
25 | Requantize();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
32 |
33 | public:
34 | float scale_in; // bottom_blob_scale * weight_scale
35 | float scale_out;// top_blob_scale / (bottom_blob_scale * weight_scale)
36 | int bias_term;
37 | int bias_data_size;
38 |
39 | bool fusion_relu;
40 |
41 | Mat bias_data;
42 | };
43 |
44 | } // namespace ncnn
45 |
46 | #endif // LAYER_REQUANTIZE_H
--------------------------------------------------------------------------------
/src/layer/reshape.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_RESHAPE_H
16 | #define LAYER_RESHAPE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Reshape : public Layer
23 | {
24 | public:
25 | Reshape();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | // reshape flag
33 | // 0 = copy from bottom
34 | // -1 = remaining
35 | // -233 = drop this dim (default)
36 | int w;
37 | int h;
38 | int c;
39 | int permute;
40 | int ndim;
41 | };
42 |
43 | } // namespace ncnn
44 |
45 | #endif // LAYER_RESHAPE_H
46 |
--------------------------------------------------------------------------------
/src/layer/rnn.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_RNN_H
16 | #define LAYER_RNN_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class RNN : public Layer
23 | {
24 | public:
25 | RNN();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
32 |
33 | public:
34 | // param
35 | int num_output;
36 | int weight_data_size;
37 |
38 | // model
39 | Mat weight_hh_data;
40 | Mat weight_xh_data;
41 | Mat weight_ho_data;
42 | Mat bias_h_data;
43 | Mat bias_o_data;
44 | };
45 |
46 | } // namespace ncnn
47 |
48 | #endif // LAYER_RNN_H
49 |
--------------------------------------------------------------------------------
/src/layer/roialign.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ROIALIGN_H
16 | #define LAYER_ROIALIGN_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class ROIAlign : public Layer
23 | {
24 | public:
25 | ROIAlign();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | int pooled_width;
33 | int pooled_height;
34 | float spatial_scale;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_ROIALIGN_H
40 |
--------------------------------------------------------------------------------
/src/layer/roipooling.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ROIPOOLING_H
16 | #define LAYER_ROIPOOLING_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class ROIPooling : public Layer
23 | {
24 | public:
25 | ROIPooling();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | int pooled_width;
33 | int pooled_height;
34 | float spatial_scale;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_ROIPOOLING_H
40 |
--------------------------------------------------------------------------------
/src/layer/scale.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SCALE_H
16 | #define LAYER_SCALE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Scale : public Layer
23 | {
24 | public:
25 | Scale();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward_inplace(std::vector& bottom_top_blobs, const Option& opt) const;
32 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
33 |
34 | public:
35 | // param
36 | int scale_data_size;
37 | int bias_term;
38 |
39 | // model
40 | Mat scale_data;
41 | Mat bias_data;
42 | };
43 |
44 | } // namespace ncnn
45 |
46 | #endif // LAYER_SCALE_H
47 |
--------------------------------------------------------------------------------
/src/layer/selu.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SELU_H
16 | #define LAYER_SELU_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class SELU : public Layer
23 | {
24 | public:
25 | SELU();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float alpha;
33 | float lambda;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_SELU_H
39 |
--------------------------------------------------------------------------------
/src/layer/shufflechannel.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SHUFFLECHANNEL_H
16 | #define LAYER_SHUFFLECHANNEL_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class ShuffleChannel : public Layer
23 | {
24 | public:
25 | ShuffleChannel();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int group;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_SHUFFLECHANNEL_H
38 |
--------------------------------------------------------------------------------
/src/layer/sigmoid.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SIGMOID_H
16 | #define LAYER_SIGMOID_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Sigmoid : public Layer
23 | {
24 | public:
25 | Sigmoid();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_SIGMOID_H
33 |
--------------------------------------------------------------------------------
/src/layer/slice.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SLICE_H
16 | #define LAYER_SLICE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Slice : public Layer
23 | {
24 | public:
25 | Slice();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | Mat slices;
33 | int axis;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_SLICE_H
39 |
--------------------------------------------------------------------------------
/src/layer/softmax.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SOFTMAX_H
16 | #define LAYER_SOFTMAX_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Softmax : public Layer
23 | {
24 | public:
25 | Softmax();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | int axis;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_SOFTMAX_H
38 |
--------------------------------------------------------------------------------
/src/layer/split.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SPLIT_H
16 | #define LAYER_SPLIT_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Split : public Layer
23 | {
24 | public:
25 | Split();
26 |
27 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
28 |
29 | #if NCNN_VULKAN
30 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, VkCompute& cmd, const Option& opt) const;
31 | #endif // NCNN_VULKAN
32 |
33 | public:
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_SPLIT_H
39 |
--------------------------------------------------------------------------------
/src/layer/spp.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SPP_H
16 | #define LAYER_SPP_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class SPP : public Layer
23 | {
24 | public:
25 | SPP();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | enum { PoolMethod_MAX = 0, PoolMethod_AVE = 1 };
32 |
33 | public:
34 | // param
35 | int pooling_type;
36 | int pyramid_height;
37 | };
38 |
39 | } // namespace ncnn
40 |
41 | #endif // LAYER_SPP_H
42 |
--------------------------------------------------------------------------------
/src/layer/squeeze.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SQUEEZE_H
16 | #define LAYER_SQUEEZE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Squeeze : public Layer
23 | {
24 | public:
25 | Squeeze();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int squeeze_w;
33 | int squeeze_h;
34 | int squeeze_c;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_SQUEEZE_H
40 |
--------------------------------------------------------------------------------
/src/layer/tanh.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TANH_H
16 | #define LAYER_TANH_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class TanH : public Layer
23 | {
24 | public:
25 | TanH();
26 |
27 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
28 | };
29 |
30 | } // namespace ncnn
31 |
32 | #endif // LAYER_TANH_H
33 |
--------------------------------------------------------------------------------
/src/layer/tfpack.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TFPACK_H
16 | #define LAYER_TFPACK_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class TFPack : public Layer
23 | {
24 | public:
25 | TFPack();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
32 |
33 | public:
34 | // reshape flag
35 | // 0 = copy from bottom
36 | // -1 = remaining
37 | // -233 = drop this dim (default)
38 | int slices;
39 | Mat pack;
40 | };
41 |
42 | } // namespace ncnn
43 |
44 | #endif // LAYER_TFPack_H
45 |
--------------------------------------------------------------------------------
/src/layer/tfrange.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TFRange_H
16 | #define LAYER_TFRange_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class TFRange : public Layer
23 | {
24 | public:
25 | TFRange();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 |
33 | int start;
34 | int limit;
35 | int delta;
36 | };
37 |
38 | } // namespace ncnn
39 |
40 | #endif // LAYER_TFPack_H
41 |
--------------------------------------------------------------------------------
/src/layer/tfreshape.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TFRESHAPE_H
16 | #define LAYER_TFRESHAPE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class TFReshape : public Layer
23 | {
24 | public:
25 | TFReshape();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, const Option& opt) const;
30 |
31 | public:
32 | // reshape flag
33 | // 0 = copy from bottom
34 | // -1 = remaining
35 | // -233 = drop this dim (default)
36 | int w;
37 | int h;
38 | int c;
39 | int permute;
40 | int ndim;
41 | };
42 |
43 | } // namespace ncnn
44 |
45 | #endif // LAYER_TFRESHAPE_H
46 |
--------------------------------------------------------------------------------
/src/layer/tfresizebilinear.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TFRESIZEBILINEAR_H
16 | #define LAYER_TFRESIZEBILINEAR_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class TFResizeBilinear : public Layer
23 | {
24 | public:
25 | TFResizeBilinear();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat &bottom_blob, Mat &top_blob, const Option& opt) const;
30 |
31 | public:
32 | // param
33 | int output_width;
34 | int output_height;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_TFRESIZEBILINEAR_H
40 |
--------------------------------------------------------------------------------
/src/layer/tfshape.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TFSHAPE_H
16 | #define LAYER_TFSHAPE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class TFShape : public Layer
23 | {
24 | public:
25 | TFShape();
26 |
27 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
28 |
29 | public:
30 | // shape flag
31 | // 0 = the dim not exist
32 | int w;
33 | int h;
34 | int c;
35 | int ndim;
36 | };
37 |
38 | } // namespace ncnn
39 |
40 | #endif // LAYER_TFSHAPE_H
41 |
--------------------------------------------------------------------------------
/src/layer/tfstridedslice.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TFStridedSlice_H
16 | #define LAYER_TFStridedSlice_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class TFStridedSlice : public Layer
23 | {
24 | public:
25 | TFStridedSlice();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int load_model(const ModelBin& mb);
30 |
31 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
32 |
33 | public:
34 | int slices;
35 |
36 | // model
37 | Mat slice_begin;
38 | Mat slice_end;
39 | Mat slice_step;
40 | };
41 |
42 | } // namespace ncnn
43 |
44 | #endif // LAYER_TFStridedSlice_H
45 |
--------------------------------------------------------------------------------
/src/layer/tftile.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TFTILE_H
16 | #define LAYER_TFTILE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class TFTile : public Layer
23 | {
24 | public:
25 | TFTile();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int dim;
33 | int tiles;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_TFTILE_H
39 |
--------------------------------------------------------------------------------
/src/layer/threshold.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_THRESHOLD_H
16 | #define LAYER_THRESHOLD_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Threshold : public Layer
23 | {
24 | public:
25 | Threshold();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const;
30 |
31 | public:
32 | float threshold;
33 | };
34 |
35 | } // namespace ncnn
36 |
37 | #endif // LAYER_THRESHOLD_H
38 |
--------------------------------------------------------------------------------
/src/layer/tile.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TILE_H
16 | #define LAYER_TILE_H
17 |
18 | #include "layer.h"
19 |
20 | namespace ncnn {
21 |
22 | class Tile : public Layer
23 | {
24 | public:
25 | Tile();
26 |
27 | virtual int load_param(const ParamDict& pd);
28 |
29 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
30 |
31 | public:
32 | int dim;
33 | int tiles;
34 | };
35 |
36 | } // namespace ncnn
37 |
38 | #endif // LAYER_TILE_H
39 |
--------------------------------------------------------------------------------
/src/layer/vulkan/absval_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ABSVAL_VULKAN_H
16 | #define LAYER_ABSVAL_VULKAN_H
17 |
18 | #include "absval.h"
19 |
20 | namespace ncnn {
21 |
22 | class AbsVal_vulkan : virtual public AbsVal
23 | {
24 | public:
25 | AbsVal_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_absval;
34 | Pipeline* pipeline_absval_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_ABSVAL_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/cast_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CAST_VULKAN_H
16 | #define LAYER_CAST_VULKAN_H
17 |
18 | #include "cast.h"
19 |
20 | namespace ncnn {
21 |
22 | class Cast_vulkan : virtual public Cast
23 | {
24 | public:
25 | Cast_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_cast_fp32_to_fp16;
34 | Pipeline* pipeline_cast_fp32_to_fp16_pack4;
35 | Pipeline* pipeline_cast_fp16_to_fp32;
36 | Pipeline* pipeline_cast_fp16_to_fp32_pack4;
37 | };
38 |
39 | } // namespace ncnn
40 |
41 | #endif // LAYER_CAST_VULKAN_H
42 |
--------------------------------------------------------------------------------
/src/layer/vulkan/clip_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CLIP_VULKAN_H
16 | #define LAYER_CLIP_VULKAN_H
17 |
18 | #include "clip.h"
19 |
20 | namespace ncnn {
21 |
22 | class Clip_vulkan : virtual public Clip
23 | {
24 | public:
25 | Clip_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_clip;
34 | Pipeline* pipeline_clip_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_CLIP_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/concat_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CONCAT_VULKAN_H
16 | #define LAYER_CONCAT_VULKAN_H
17 |
18 | #include "concat.h"
19 |
20 | namespace ncnn {
21 |
22 | class Concat_vulkan : virtual public Concat
23 | {
24 | public:
25 | Concat_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_concat[2];
34 | Pipeline* pipeline_concat_pack4[2];
35 | Pipeline* pipeline_concat_pack4to1[2];
36 | };
37 |
38 | } // namespace ncnn
39 |
40 | #endif // LAYER_CONCAT_VULKAN_H
41 |
--------------------------------------------------------------------------------
/src/layer/vulkan/crop_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CROP_VULKAN_H
16 | #define LAYER_CROP_VULKAN_H
17 |
18 | #include "crop.h"
19 |
20 | namespace ncnn {
21 |
22 | class Crop_vulkan : virtual public Crop
23 | {
24 | public:
25 | Crop_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, VkCompute& cmd, const Option& opt) const;
33 |
34 | public:
35 | Pipeline* pipeline_crop;
36 | Pipeline* pipeline_crop_pack4;
37 | };
38 |
39 | } // namespace ncnn
40 |
41 | #endif // LAYER_CROP_VULKAN_H
42 |
--------------------------------------------------------------------------------
/src/layer/vulkan/dropout_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_DROPOUT_VULKAN_H
16 | #define LAYER_DROPOUT_VULKAN_H
17 |
18 | #include "dropout.h"
19 |
20 | namespace ncnn {
21 |
22 | class Dropout_vulkan : virtual public Dropout
23 | {
24 | public:
25 | Dropout_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_dropout;
34 | Pipeline* pipeline_dropout_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_DROPOUT_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/eltwise_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_ELTWISE_VULKAN_H
16 | #define LAYER_ELTWISE_VULKAN_H
17 |
18 | #include "eltwise.h"
19 |
20 | namespace ncnn {
21 |
22 | class Eltwise_vulkan : virtual public Eltwise
23 | {
24 | public:
25 | Eltwise_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const std::vector& bottom_blobs, std::vector& top_blobs, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_eltwise[2];
34 | Pipeline* pipeline_eltwise_pack4[2];
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_ELTWISE_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/flatten_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_FLATTEN_VULKAN_H
16 | #define LAYER_FLATTEN_VULKAN_H
17 |
18 | #include "flatten.h"
19 |
20 | namespace ncnn {
21 |
22 | class Flatten_vulkan : virtual public Flatten
23 | {
24 | public:
25 | Flatten_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_flatten;
34 | Pipeline* pipeline_flatten_pack4;
35 | Pipeline* pipeline_flatten_pack1to4;
36 | };
37 |
38 | } // namespace ncnn
39 |
40 | #endif // LAYER_FLATTEN_VULKAN_H
41 |
--------------------------------------------------------------------------------
/src/layer/vulkan/hardsigmoid_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_HARDSIGMOID_VULKAN_H
16 | #define LAYER_HARDSIGMOID_VULKAN_H
17 |
18 | #include "hardsigmoid.h"
19 |
20 | namespace ncnn {
21 |
22 | class HardSigmoid_vulkan : virtual public HardSigmoid
23 | {
24 | public:
25 | HardSigmoid_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_hardsigmoid;
34 | Pipeline* pipeline_hardsigmoid_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_HARDSIGMOID_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/packing_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PACKING_VULKAN_H
16 | #define LAYER_PACKING_VULKAN_H
17 |
18 | #include "packing.h"
19 |
20 | namespace ncnn {
21 |
22 | class Packing_vulkan : virtual public Packing
23 | {
24 | public:
25 | Packing_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_packing_1to4;
34 | Pipeline* pipeline_packing_4to1;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_PACKING_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/permute_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PERMUTE_VULKAN_H
16 | #define LAYER_PERMUTE_VULKAN_H
17 |
18 | #include "permute.h"
19 |
20 | namespace ncnn {
21 |
22 | class Permute_vulkan : virtual public Permute
23 | {
24 | public:
25 | Permute_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_permute;
34 | Pipeline* pipeline_permute_pack4to1;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_PERMUTE_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/prelu_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_PRELU_VULKAN_H
16 | #define LAYER_PRELU_VULKAN_H
17 |
18 | #include "prelu.h"
19 |
20 | namespace ncnn {
21 |
22 | class PReLU_vulkan : virtual public PReLU
23 | {
24 | public:
25 | PReLU_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int upload_model(VkTransfer& cmd, const Option& opt);
31 |
32 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
33 |
34 | public:
35 | VkMat slope_data_gpu;
36 | Pipeline* pipeline_prelu;
37 | Pipeline* pipeline_prelu_pack4;
38 | };
39 |
40 | } // namespace ncnn
41 |
42 | #endif // LAYER_PRELU_VULKAN_H
43 |
--------------------------------------------------------------------------------
/src/layer/vulkan/relu_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_RELU_VULKAN_H
16 | #define LAYER_RELU_VULKAN_H
17 |
18 | #include "relu.h"
19 |
20 | namespace ncnn {
21 |
22 | class ReLU_vulkan : virtual public ReLU
23 | {
24 | public:
25 | ReLU_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_relu;
34 | Pipeline* pipeline_relu_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_RELU_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/reorg_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_REORG_VULKAN_H
16 | #define LAYER_REORG_VULKAN_H
17 |
18 | #include "reorg.h"
19 |
20 | namespace ncnn {
21 |
22 | class Reorg_vulkan : virtual public Reorg
23 | {
24 | public:
25 | Reorg_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_reorg;
34 | Pipeline* pipeline_reorg_pack4;
35 | Pipeline* pipeline_reorg_pack1to4;
36 | };
37 |
38 | } // namespace ncnn
39 |
40 | #endif // LAYER_REORG_VULKAN_H
41 |
--------------------------------------------------------------------------------
/src/layer/vulkan/reshape_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_RESHAPE_VULKAN_H
16 | #define LAYER_RESHAPE_VULKAN_H
17 |
18 | #include "reshape.h"
19 |
20 | namespace ncnn {
21 |
22 | class Reshape_vulkan : virtual public Reshape
23 | {
24 | public:
25 | Reshape_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_reshape;
34 | Pipeline* pipeline_reshape_pack4;
35 | Pipeline* pipeline_reshape_pack1to4;
36 | Pipeline* pipeline_reshape_pack4to1;
37 | };
38 |
39 | } // namespace ncnn
40 |
41 | #endif // LAYER_RESHAPE_VULKAN_H
42 |
--------------------------------------------------------------------------------
/src/layer/vulkan/shufflechannel_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SHUFFLECHANNEL_VULKAN_H
16 | #define LAYER_SHUFFLECHANNEL_VULKAN_H
17 |
18 | #include "shufflechannel.h"
19 |
20 | namespace ncnn {
21 |
22 | class ShuffleChannel_vulkan : virtual public ShuffleChannel
23 | {
24 | public:
25 | ShuffleChannel_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const VkMat& bottom_blob, VkMat& top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_shufflechannel;
34 | Pipeline* pipeline_shufflechannel_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_SHUFFLECHANNEL_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/sigmoid_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_SIGMOID_VULKAN_H
16 | #define LAYER_SIGMOID_VULKAN_H
17 |
18 | #include "sigmoid.h"
19 |
20 | namespace ncnn {
21 |
22 | class Sigmoid_vulkan : virtual public Sigmoid
23 | {
24 | public:
25 | Sigmoid_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_sigmoid;
34 | Pipeline* pipeline_sigmoid_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_SIGMOID_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/tanh_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_TANH_VULKAN_H
16 | #define LAYER_TANH_VULKAN_H
17 |
18 | #include "tanh.h"
19 |
20 | namespace ncnn {
21 |
22 | class TanH_vulkan : virtual public TanH
23 | {
24 | public:
25 | TanH_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_tanh;
34 | Pipeline* pipeline_tanh_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_TANH_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/vulkan/unaryop_vulkan.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_UNARYOP_VULKAN_H
16 | #define LAYER_UNARYOP_VULKAN_H
17 |
18 | #include "unaryop.h"
19 |
20 | namespace ncnn {
21 |
22 | class UnaryOp_vulkan : virtual public UnaryOp
23 | {
24 | public:
25 | UnaryOp_vulkan();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward_inplace(VkMat& bottom_top_blob, VkCompute& cmd, const Option& opt) const;
31 |
32 | public:
33 | Pipeline* pipeline_unaryop;
34 | Pipeline* pipeline_unaryop_pack4;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_UNARYOP_VULKAN_H
40 |
--------------------------------------------------------------------------------
/src/layer/x86/convolution_7x7.h:
--------------------------------------------------------------------------------
1 | // BUG1989 is pleased to support the open source community by supporting ncnn available.
2 | //
3 | // Copyright (C) 2019 BUG1989. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | static void conv7x7s1_sse(const Mat &bottom_blob, Mat &top_blob, const Mat &_kernel, const Mat& _bias, const Option& opt)
16 | {
17 | int kernel_w = 7;
18 | int kernel_h = 7;
19 |
20 | int stride_w = 1;
21 | int stride_h = 1;
22 |
23 | conv_im2col_sgemm_sse(bottom_blob, top_blob, _kernel, _bias, kernel_w, kernel_h, stride_w, stride_h, opt);
24 | }
25 |
26 | static void conv7x7s2_sse(const Mat &bottom_blob, Mat &top_blob, const Mat &_kernel, const Mat& _bias, const Option& opt)
27 | {
28 | int kernel_w = 7;
29 | int kernel_h = 7;
30 |
31 | int stride_w = 2;
32 | int stride_h = 2;
33 |
34 | conv_im2col_sgemm_sse(bottom_blob, top_blob, _kernel, _bias, kernel_w, kernel_h, stride_w, stride_h, opt);
35 | }
--------------------------------------------------------------------------------
/src/layer/x86/convolutiondepthwise_x86.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef LAYER_CONVOLUTIONDEPTHWISE_X86_H
16 | #define LAYER_CONVOLUTIONDEPTHWISE_X86_H
17 |
18 | #include "convolutiondepthwise.h"
19 |
20 | namespace ncnn {
21 |
22 | class ConvolutionDepthWise_x86 : virtual public ConvolutionDepthWise
23 | {
24 | public:
25 | ConvolutionDepthWise_x86();
26 |
27 | virtual int create_pipeline(const Option& opt);
28 | virtual int destroy_pipeline(const Option& opt);
29 |
30 | virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const;
31 |
32 | public:
33 | Layer* activation;
34 | std::vector group_ops;
35 | };
36 |
37 | } // namespace ncnn
38 |
39 | #endif // LAYER_CONVOLUTIONDEPTHWISE_X86_H
40 |
--------------------------------------------------------------------------------
/src/layer_declaration.h.in:
--------------------------------------------------------------------------------
1 | // Layer Declaration header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 | @layer_declaration@
6 |
--------------------------------------------------------------------------------
/src/layer_registry.h.in:
--------------------------------------------------------------------------------
1 | // Layer Registry header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 | @layer_registry@
6 |
--------------------------------------------------------------------------------
/src/layer_shader_registry.h.in:
--------------------------------------------------------------------------------
1 | // Layer Shader Registry header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 | @layer_shader_registry@
6 |
7 |
--------------------------------------------------------------------------------
/src/layer_shader_spv_data.h.in:
--------------------------------------------------------------------------------
1 | // Layer Shader Spv Data header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 | @layer_shader_spv_data@
6 |
7 |
--------------------------------------------------------------------------------
/src/layer_type.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_LAYER_TYPE_H
16 | #define NCNN_LAYER_TYPE_H
17 |
18 | namespace ncnn {
19 |
20 | namespace LayerType {
21 | enum
22 | {
23 | #include "layer_type_enum.h"
24 | CustomBit = (1<<8),
25 | };
26 | } // namespace LayerType
27 |
28 | } // namespace ncnn
29 |
30 | #endif // NCNN_LAYER_TYPE_H
31 |
--------------------------------------------------------------------------------
/src/layer_type_enum.h.in:
--------------------------------------------------------------------------------
1 | // Layer Type Enum header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 | @layer_type_enum@
6 |
--------------------------------------------------------------------------------
/toolchains/aarch64-linux-gnu.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR aarch64 )
4 | # for the reason of aarch64-linux-gnu-gcc DONOT need to be installed, make sure aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++ can be found in $PATH:
5 | SET ( CMAKE_C_COMPILER "aarch64-linux-gnu-gcc" )
6 | SET ( CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++" )
7 |
8 | # set searching rules for cross-compiler
9 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
12 |
13 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
14 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv8-a -fopenmp ${CMAKE_CXX_FLAGS}" )
15 |
16 | # other settings
17 | add_definitions(-D__ARM_NEON)
18 | add_definitions(-DLINUX)
19 | SET ( LINUX true)
20 |
--------------------------------------------------------------------------------
/toolchains/arm-linux-gnueabi.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR arm )
4 | # when hislicon SDK was installed, toolchain was installed in the path as below:
5 | SET ( CMAKE_C_COMPILER "arm-linux-gnueabi-gcc" )
6 | SET ( CMAKE_CXX_COMPILER "arm-linux-gnueabi-g++" )
7 |
8 | # set searching rules for cross-compiler
9 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
12 |
13 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
14 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -fopenmp ${CMAKE_CXX_FLAGS}" )
15 |
16 | # other settings
17 | add_definitions(-D__ARM_NEON)
18 | add_definitions(-D__ANDROID__)
19 | SET ( ANDROID true)
20 |
--------------------------------------------------------------------------------
/toolchains/arm-linux-gnueabihf.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR arm )
4 | # when hislicon SDK was installed, toolchain was installed in the path as below:
5 | SET ( CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc" )
6 | SET ( CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++" )
7 |
8 | # set searching rules for cross-compiler
9 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
12 |
13 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
14 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4 -fopenmp ${CMAKE_CXX_FLAGS}" )
15 |
16 | # other settings
17 | add_definitions(-D__ARM_NEON)
18 | add_definitions(-D__ANDROID__)
19 | SET ( ANDROID true)
20 |
--------------------------------------------------------------------------------
/toolchains/himix100.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR aarch64 )
4 | # when hislicon SDK was installed, toolchain was installed in the path as below:
5 | SET ( CMAKE_C_COMPILER "/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-gcc" )
6 | SET ( CMAKE_CXX_COMPILER "/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-g++" )
7 | SET ( CMAKE_FIND_ROOT_PATH "/opt/hisi-linux/x86-arm/aarch64-himix100-linux" )
8 |
9 | # set searching rules for cross-compiler
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
12 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
13 |
14 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
15 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv8-a -fopenmp ${CMAKE_CXX_FLAGS}" )
16 |
17 | # other settings
18 | add_definitions(-D__ARM_NEON)
19 | add_definitions(-D__ANDROID__)
20 | SET ( ANDROID true)
21 |
--------------------------------------------------------------------------------
/toolchains/himix200.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR arm )
4 | # when hislicon SDK was installed, toolchain was installed in the path as below:
5 | SET ( CMAKE_C_COMPILER /opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc )
6 | SET ( CMAKE_CXX_COMPILER /opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ )
7 |
8 | # set searching rules for cross-compiler
9 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
12 |
13 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
14 | SET ( CROSS_COMPILATION_ARM himix200 )
15 | SET ( CROSS_COMPILATION_ARCHITECTURE armv7-a )
16 |
17 | # set g++ param
18 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -fopenmp ${CMAKE_CXX_FLAGS}" )
19 |
20 | add_definitions(-D__ARM_NEON)
21 | add_definitions(-D__ANDROID__)
22 |
--------------------------------------------------------------------------------
/toolchains/hisiv300.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR arm )
4 | # when hislicon SDK was installed, toolchain was installed in the path as below:
5 | SET ( CMAKE_C_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-gcc" )
6 | SET ( CMAKE_CXX_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-g++" )
7 | SET ( CMAKE_FIND_ROOT_PATH "/opt/hisi-linux/x86-arm/arm-hisiv300-linux" )
8 |
9 | # set searching rules for cross-compiler
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
12 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
13 |
14 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
15 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -fopenmp ${CMAKE_CXX_FLAGS}" )
16 |
17 | # other settings
18 | add_definitions(-D__ARM_NEON)
19 | add_definitions(-D__ANDROID__)
20 | SET ( ANDROID true)
21 |
--------------------------------------------------------------------------------
/toolchains/hisiv500.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR arm )
4 | # when hislicon SDK was installed, toolchain was installed in the path as below:
5 | SET ( CMAKE_C_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-gcc" )
6 | SET ( CMAKE_CXX_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-g++" )
7 | SET ( CMAKE_FIND_ROOT_PATH "/opt/hisi-linux/x86-arm/arm-hisiv500-linux" )
8 |
9 | # set searching rules for cross-compiler
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
12 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
13 |
14 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
15 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -fopenmp ${CMAKE_CXX_FLAGS}" )
16 |
17 | # other settings
18 | add_definitions(-D__ARM_NEON)
19 | add_definitions(-D__ANDROID__)
20 | SET ( ANDROID true)
21 |
--------------------------------------------------------------------------------
/toolchains/hisiv600.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR arm )
4 | # when hislicon SDK was installed, toolchain was installed in the path as below:
5 | SET ( CMAKE_C_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv600-linux/target/bin/arm-hisiv600-linux-gcc" )
6 | SET ( CMAKE_CXX_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv600-linux/target/bin/arm-hisiv600-linux-g++" )
7 | SET ( CMAKE_FIND_ROOT_PATH "/opt/hisi-linux/x86-arm/arm-hisiv600-linux" )
8 |
9 | # set searching rules for cross-compiler
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
12 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
13 |
14 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
15 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon ${CMAKE_CXX_FLAGS}" )
16 |
17 | # other settings
18 | add_definitions(-D__ARM_NEON)
19 | add_definitions(-D__ANDROID__)
20 | SET ( ANDROID true)
21 |
--------------------------------------------------------------------------------
/toolchains/host.gcc.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR x86 )
4 | # if gcc/g++ was installed:
5 | SET ( CMAKE_C_COMPILER "gcc" )
6 | SET ( CMAKE_CXX_COMPILER "g++" )
7 |
8 | # set searching rules
9 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
12 |
13 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag
14 | SET ( CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" )
15 |
--------------------------------------------------------------------------------
/toolchains/iossimxc-x64.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings
2 | # set(UNIX True)
3 | # set(Darwin True)
4 | # set(IOS True)
5 | set (CMAKE_SYSTEM_NAME Darwin)
6 | set (CMAKE_SYSTEM_VERSION 1)
7 | set (UNIX True)
8 | set (APPLE True)
9 | set (IOS True)
10 |
11 | # suppress -rdynamic
12 | # set(CMAKE_SYSTEM_NAME Generic)
13 |
14 | set(CMAKE_C_COMPILER i386-apple-darwin11-clang)
15 | set(CMAKE_CXX_COMPILER i386-apple-darwin11-clang++)
16 |
17 | set(_CMAKE_TOOLCHAIN_PREFIX i386-apple-darwin11-)
18 |
19 | set(CMAKE_IOS_SDK_ROOT "/home/nihui/osd/cctools-port/usage_examples/ios_toolchain/target-sim/SDK/iPhoneSimulator10.2.sdk")
20 |
21 | # Set the sysroot default to the most recent SDK
22 | set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
23 |
24 | # set the architecture for iOS
25 | set(IOS_ARCH x86_64)
26 |
27 | set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS Simulator")
28 |
29 | # Set the find root to the iOS developer roots and to user defined paths
30 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS Simulator find search path root")
31 |
32 | # searching for frameworks only
33 | set(CMAKE_FIND_FRAMEWORK FIRST)
34 |
35 | # set up the default search directories for frameworks
36 | set(CMAKE_SYSTEM_FRAMEWORK_PATH
37 | ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
38 | )
39 |
--------------------------------------------------------------------------------
/toolchains/iossimxc.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings
2 | # set(UNIX True)
3 | # set(Darwin True)
4 | # set(IOS True)
5 | set (CMAKE_SYSTEM_NAME Darwin)
6 | set (CMAKE_SYSTEM_VERSION 1)
7 | set (UNIX True)
8 | set (APPLE True)
9 | set (IOS True)
10 |
11 | # suppress -rdynamic
12 | # set(CMAKE_SYSTEM_NAME Generic)
13 |
14 | set(CMAKE_C_COMPILER i386-apple-darwin11-clang)
15 | set(CMAKE_CXX_COMPILER i386-apple-darwin11-clang++)
16 |
17 | set(_CMAKE_TOOLCHAIN_PREFIX i386-apple-darwin11-)
18 |
19 | set(CMAKE_IOS_SDK_ROOT "/home/nihui/osd/cctools-port/usage_examples/ios_toolchain/target-sim/SDK/iPhoneSimulator10.2.sdk")
20 |
21 | # Set the sysroot default to the most recent SDK
22 | set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
23 |
24 | # set the architecture for iOS
25 | # set(IOS_ARCH i386)
26 | # set(IOS_ARCH x86_64)
27 | set(IOS_ARCH i386;x86_64)
28 |
29 | set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS Simulator")
30 |
31 | # Set the find root to the iOS developer roots and to user defined paths
32 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS Simulator find search path root")
33 |
34 | # searching for frameworks only
35 | set(CMAKE_FIND_FRAMEWORK FIRST)
36 |
37 | # set up the default search directories for frameworks
38 | set(CMAKE_SYSTEM_FRAMEWORK_PATH
39 | ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
40 | )
41 |
--------------------------------------------------------------------------------
/toolchains/iosxc-arm64.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings
2 | # set(UNIX True)
3 | # set(Darwin True)
4 | # set(IOS True)
5 | set (CMAKE_SYSTEM_NAME Darwin)
6 | set (CMAKE_SYSTEM_VERSION 1)
7 | set (UNIX True)
8 | set (APPLE True)
9 | set (IOS True)
10 |
11 | # suppress -rdynamic
12 | # set(CMAKE_SYSTEM_NAME Generic)
13 |
14 | set(CMAKE_C_COMPILER arm-apple-darwin11-clang)
15 | set(CMAKE_CXX_COMPILER arm-apple-darwin11-clang++)
16 |
17 | set(_CMAKE_TOOLCHAIN_PREFIX arm-apple-darwin11-)
18 |
19 | set(CMAKE_IOS_SDK_ROOT "/home/nihui/osd/cctools-port/usage_examples/ios_toolchain/target/SDK/iPhoneOS10.2.sdk")
20 |
21 | # Set the sysroot default to the most recent SDK
22 | set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
23 |
24 | # set the architecture for iOS
25 | set(IOS_ARCH arm64)
26 |
27 | set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS")
28 |
29 | # Set the find root to the iOS developer roots and to user defined paths
30 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS find search path root")
31 |
32 | # searching for frameworks only
33 | set(CMAKE_FIND_FRAMEWORK FIRST)
34 |
35 | # set up the default search directories for frameworks
36 | set(CMAKE_SYSTEM_FRAMEWORK_PATH
37 | ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
38 | )
39 |
--------------------------------------------------------------------------------
/toolchains/iosxc.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Standard settings
2 | # set(UNIX True)
3 | # set(Darwin True)
4 | # set(IOS True)
5 | set (CMAKE_SYSTEM_NAME Darwin)
6 | set (CMAKE_SYSTEM_VERSION 1)
7 | set (UNIX True)
8 | set (APPLE True)
9 | set (IOS True)
10 |
11 | # suppress -rdynamic
12 | # set(CMAKE_SYSTEM_NAME Generic)
13 |
14 | set(CMAKE_C_COMPILER arm-apple-darwin11-clang)
15 | set(CMAKE_CXX_COMPILER arm-apple-darwin11-clang++)
16 |
17 | set(_CMAKE_TOOLCHAIN_PREFIX arm-apple-darwin11-)
18 |
19 | set(CMAKE_IOS_SDK_ROOT "/home/nihui/osd/cctools-port/usage_examples/ios_toolchain/target/SDK/iPhoneOS10.2.sdk")
20 |
21 | # Set the sysroot default to the most recent SDK
22 | set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
23 |
24 | # set the architecture for iOS
25 | # set(IOS_ARCH arm64)
26 | set(IOS_ARCH armv7;arm64)
27 |
28 | set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS")
29 |
30 | # Set the find root to the iOS developer roots and to user defined paths
31 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS find search path root")
32 |
33 | # searching for frameworks only
34 | set(CMAKE_FIND_FRAMEWORK FIRST)
35 |
36 | # set up the default search directories for frameworks
37 | set(CMAKE_SYSTEM_FRAMEWORK_PATH
38 | ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
39 | )
40 |
--------------------------------------------------------------------------------
/toolchains/jetson.toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2 | SET ( CMAKE_SYSTEM_NAME Linux )
3 | SET ( CMAKE_SYSTEM_PROCESSOR aarch64 )
4 | # for the reason of aarch64-linux-gnu-gcc DONOT need to be installed, make sure aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++ can be found in $PATH:
5 | SET ( CMAKE_C_COMPILER "aarch64-linux-gnu-gcc" )
6 | SET ( CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++" )
7 |
8 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
9 | # -march=armv8-a could work on Jetson, but will compile without some extra cpu features
10 | SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=native -fopenmp ${CMAKE_CXX_FLAGS}" )
11 |
12 | # other settings
13 | # Jetson CPU supports asimd
14 | add_definitions ( -D__ARM_NEON)
15 | # Jetson does NOT run ANDROID
16 | # but `__ANDROID__` marco is tested before `__aarch64__`
17 | # and currently no negative effect is caused by this marco
18 | add_definitions( -D__ANDROID__)
19 | SET ( ANDROID true)
20 |
--------------------------------------------------------------------------------
/toolchains/pi3.toolchain.cmake:
--------------------------------------------------------------------------------
1 | SET(CMAKE_SYSTEM_NANE Android)
2 | SET(CMAKE_SYSTEM_PROCESSOR "armv7l")
3 | SET(ANDROID_ARCH_NAME "arm")
4 | SET(UNIX true)
5 | SET(CMAKE_C_COMPILER "gcc")
6 | SET(CMAKE_CXX_COMPILER "g++")
7 |
--------------------------------------------------------------------------------
/tools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_subdirectory(caffe)
3 | add_subdirectory(mxnet)
4 | add_subdirectory(onnx)
5 | add_subdirectory(tensorflow)
6 | # add_subdirectory(quantize)
7 |
8 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
9 | include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)
10 |
11 | include_directories(${CMAKE_SOURCE_DIR}/src)
12 |
13 | add_executable(ncnn2mem ncnn2mem.cpp)
14 |
15 | target_link_libraries(ncnn2mem PRIVATE ncnn)
16 |
17 | if(NCNN_VULKAN)
18 | target_link_libraries(ncnn2mem PRIVATE ${Vulkan_LIBRARY})
19 | endif()
20 |
21 | add_executable(ncnnoptimize ncnnoptimize.cpp)
22 |
23 | target_link_libraries(ncnnoptimize PRIVATE ncnn)
24 |
25 | if(NCNN_VULKAN)
26 | target_link_libraries(ncnnoptimize PRIVATE ${Vulkan_LIBRARY})
27 | endif()
28 |
--------------------------------------------------------------------------------
/tools/caffe/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | find_package(Protobuf)
3 | set(PROTOBUF_INCLUDE_DIR /home/zyhan/anaconda3/include)
4 | set(PROTOBUF_LIBRARIES /home/zyhan/anaconda3/lib/libprotobuf.so)
5 |
6 | if(PROTOBUF_FOUND)
7 | protobuf_generate_cpp(CAFFE_PROTO_SRCS CAFFE_PROTO_HDRS caffe.proto)
8 | add_executable(caffe2ncnn caffe2ncnn.cpp ${CAFFE_PROTO_SRCS} ${CAFFE_PROTO_HDRS})
9 | target_include_directories(caffe2ncnn
10 | PRIVATE
11 | ${PROTOBUF_INCLUDE_DIR}
12 | ${CMAKE_CURRENT_BINARY_DIR})
13 | target_compile_features(caffe2ncnn PRIVATE cxx_std_11)
14 | target_link_libraries(caffe2ncnn PRIVATE ${PROTOBUF_LIBRARIES})
15 | else()
16 | message(WARNING "Protobuf not found, caffe model convert tool won't be built")
17 | endif()
18 |
--------------------------------------------------------------------------------
/tools/darknet/readme.txt:
--------------------------------------------------------------------------------
1 | You can find darknet2ncnn tool here
2 |
3 | https://github.com/xiangweizeng/darknet2ncnn
4 |
--------------------------------------------------------------------------------
/tools/mxnet/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(mxnet2ncnn mxnet2ncnn.cpp)
3 |
--------------------------------------------------------------------------------
/tools/onnx/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | find_package(Protobuf)
3 | set(PROTOBUF_INCLUDE_DIR /home/zyhan/anaconda3/include)
4 | set(PROTOBUF_LIBRARIES /home/zyhan/anaconda3/lib/libprotobuf.so)
5 |
6 | if(PROTOBUF_FOUND)
7 | protobuf_generate_cpp(ONNX_PROTO_SRCS ONNX_PROTO_HDRS onnx.proto)
8 | add_executable(onnx2ncnn onnx2ncnn.cpp ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS})
9 | target_include_directories(onnx2ncnn
10 | PRIVATE
11 | ${PROTOBUF_INCLUDE_DIR}
12 | ${CMAKE_CURRENT_BINARY_DIR})
13 | target_compile_features(onnx2ncnn PRIVATE cxx_std_11)
14 | target_link_libraries(onnx2ncnn PRIVATE ${PROTOBUF_LIBRARIES})
15 | else()
16 | message(WARNING "Protobuf not found, onnx model convert tool won't be built")
17 | endif()
18 |
--------------------------------------------------------------------------------
/tools/onnx/ssd.onnx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/tools/onnx/ssd.onnx
--------------------------------------------------------------------------------
/tools/plugin/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## NCNN Image Watch Plugin for Visual Studio
3 | Image Watch plugin is a good tool for better understanding insight of images. This tiny work offer a ".natvis" file which could add ncnn::Mat class support for Image Watch, and users could debug ncnn::Mat image just like debuging cv::Mat via Image Watch.
4 |
5 | To use this plugin, please move this "ImageWatchNCNN.natvis" file to "C:/user/${your user name}/Documents/Visual Studio ${VS_Version}/Visualizers" folder. If not exist this folder, create it(such as: "C:\Users\nihui\Documents\Visual Studio 2017\Visualizers").
6 |
7 | 
8 |
9 | See [Image Watch Help](https://imagewatch.azurewebsites.net/ImageWatchHelp/ImageWatchHelp.htm) page for more advanced using tips of Image Watch(For example, get single channel from channels, such as getting confidence heatmap from forward result list {confidence, x1, y1, x2, y2}).
--------------------------------------------------------------------------------
/tools/plugin/snapshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/tools/plugin/snapshot.png
--------------------------------------------------------------------------------
/tools/pytorch/readme.txt:
--------------------------------------------------------------------------------
1 | You can find pytorch2ncnn tool here
2 |
3 | https://github.com/starimeL/PytorchConverter
4 | https://github.com/inisis/brocolli
5 |
6 | For newer version, pytorch already supports exporting to onnx out of box
7 | You can follow the practical guide here
8 |
9 | https://github.com/Tencent/ncnn/wiki/practical-pytorch-to-onnx-to-ncnn
10 |
--------------------------------------------------------------------------------
/tools/quantize/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | #set(OpenCV_LIBS /home/zyhan/ncnn/3rdparty/lib)
3 | #find_package(OpenCV QUIET COMPONENTS 3rdparty)
4 | find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs)
5 | if(NOT OpenCV_FOUND)
6 | find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)
7 | #find_package(OpenCV REQUIRED COMPONENTS 3rdparty)
8 | endif()
9 |
10 | add_executable(ncnn2table ncnn2table.cpp)
11 | target_link_libraries(ncnn2table PRIVATE ncnn ${OpenCV_LIBS})
12 |
13 | add_executable(ncnn2int8 ncnn2int8.cpp)
14 | target_link_libraries(ncnn2int8 PRIVATE ncnn)
15 |
--------------------------------------------------------------------------------
/tools/tensorflow/.tensorflow2ncnn.cpp.swp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hanzy88/tensorflow2ncnn/a440bf6750af409cc1476da1c68f5e9bed1491a1/tools/tensorflow/.tensorflow2ncnn.cpp.swp
--------------------------------------------------------------------------------
/tools/tensorflow/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_package(Protobuf REQUIRED)
2 |
3 | if(PROTOBUF_FOUND)
4 | include_directories(${PROTOBUF_INCLUDE_DIR})
5 | include_directories(${CMAKE_CURRENT_BINARY_DIR})
6 | protobuf_generate_cpp(TENSORFLOW_PROTO_SRCS TENSORFLOW_PROTO_HDRS
7 | attr_value.proto
8 | function.proto
9 | graph.proto
10 | node_def.proto
11 | op_def.proto
12 | resource_handle.proto
13 | tensor.proto
14 | tensor_shape.proto
15 | types.proto
16 | versions.proto
17 | )
18 | add_executable(tensorflow2ncnn tensorflow2ncnn.cpp ${TENSORFLOW_PROTO_SRCS} ${TENSORFLOW_PROTO_HDRS})
19 | set_target_properties(tensorflow2ncnn PROPERTIES CXX_STANDARD 11)
20 | target_link_libraries(tensorflow2ncnn ${PROTOBUF_LIBRARIES})
21 | else()
22 | message(WARNING "Protobuf not found, tensorflow model convert tool won't be built")
23 | endif()
--------------------------------------------------------------------------------
/tools/tensorflow/resource_handle.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package tensorflow;
4 | option cc_enable_arenas = true;
5 | option java_outer_classname = "ResourceHandle";
6 | option java_multiple_files = true;
7 | option java_package = "org.tensorflow.framework";
8 |
9 | // Protocol buffer representing a handle to a tensorflow resource. Handles are
10 | // not valid across executions, but can be serialized back and forth from within
11 | // a single run.
12 | message ResourceHandleProto {
13 | // Unique name for the device containing the resource.
14 | string device = 1;
15 |
16 | // Container in which this resource is placed.
17 | string container = 2;
18 |
19 | // Unique name of this resource.
20 | string name = 3;
21 |
22 | // Hash code for the type of the resource. Is only valid in the same device
23 | // and in the same execution.
24 | uint64 hash_code = 4;
25 |
26 | // For debug-only, the name of the type pointed to by this handle, if
27 | // available.
28 | string maybe_type_name = 5;
29 | };
30 |
--------------------------------------------------------------------------------
/tools/tensorflow/versions.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package tensorflow;
4 | option cc_enable_arenas = true;
5 | option java_outer_classname = "VersionsProtos";
6 | option java_multiple_files = true;
7 | option java_package = "org.tensorflow.framework";
8 |
9 | // Version information for a piece of serialized data
10 | //
11 | // There are different types of versions for each type of data
12 | // (GraphDef, etc.), but they all have the same common shape
13 | // described here.
14 | //
15 | // Each consumer has "consumer" and "min_producer" versions (specified
16 | // elsewhere). A consumer is allowed to consume this data if
17 | //
18 | // producer >= min_producer
19 | // consumer >= min_consumer
20 | // consumer not in bad_consumers
21 | //
22 | message VersionDef {
23 | // The version of the code that produced this data.
24 | int32 producer = 1;
25 |
26 | // Any consumer below this version is not allowed to consume this data.
27 | int32 min_consumer = 2;
28 |
29 | // Specific consumer versions which are disallowed (e.g. due to bugs).
30 | repeated int32 bad_consumers = 3;
31 | };
32 |
--------------------------------------------------------------------------------