Elffuss BraidHub

kikocis/ncnn public

master · 4.9 KiBRawPermalink
1
2if(MSVC)
3 # warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
4 add_definitions(/wd4996)
5endif()
6
7add_library(ncnntestutil STATIC testutil.cpp)
8target_link_libraries(ncnntestutil PUBLIC ncnn)
9
10macro(ncnn_add_test name)
11 add_executable(test_${name} test_${name}.cpp)
12 target_link_libraries(test_${name} PRIVATE ncnntestutil ncnn)
13
14 add_test(NAME test_${name} COMMAND ${CMAKE_COMMAND} -DTEST_EXECUTABLE=$<TARGET_FILE:test_${name}> -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/run_test.cmake)
15
16 # add test to a virtual project group
17 set_property(TARGET test_${name} PROPERTY FOLDER "tests")
18endmacro()
19
20macro(ncnn_add_layer_test class)
21 string(TOLOWER ${class} name)
22
23 # enable if WITH_LAYER_xxx option ON
24 if(${WITH_LAYER_${name}})
25 file(GLOB test_${name}_SRCS "test_${name}.cpp" "test_${name}_*.cpp" LIST_DIRECTORIES FALSE)
26
27 foreach(test_file ${test_${name}_SRCS})
28 get_filename_component(test_filename ${test_file} NAME_WE)
29 add_executable(${test_filename} ${test_file})
30 target_link_libraries(${test_filename} PRIVATE ncnntestutil ncnn)
31
32 add_test(NAME ${test_filename} COMMAND ${CMAKE_COMMAND} -DTEST_EXECUTABLE=$<TARGET_FILE:${test_filename}> -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/run_test.cmake)
33
34 # add test to a virtual project group
35 set_property(TARGET ${test_filename} PROPERTY FOLDER "tests")
36 endforeach()
37 endif()
38endmacro()
39
40include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
41include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src/layer)
42
43if(NCNN_PIXEL_AFFINE)
44 ncnn_add_test(mat_pixel_affine)
45endif()
46
47if(NCNN_PIXEL_DRAWING)
48 ncnn_add_test(mat_pixel_drawing)
49endif()
50
51if(NCNN_PIXEL_ROTATE)
52 ncnn_add_test(mat_pixel_rotate)
53endif()
54
55if(NCNN_PIXEL)
56 ncnn_add_test(mat_pixel_resize)
57 ncnn_add_test(mat_pixel)
58 ncnn_add_test(squeezenet)
59endif()
60
61ncnn_add_test(c_api)
62ncnn_add_test(cpu)
63
64if(NCNN_VULKAN)
65 ncnn_add_test(command)
66endif()
67
68if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
69 target_link_libraries(test_squeezenet PRIVATE nodefs.js)
70endif()
71
72ncnn_add_layer_test(AbsVal)
73ncnn_add_layer_test(BatchNorm)
74ncnn_add_layer_test(Bias)
75ncnn_add_layer_test(BinaryOp)
76ncnn_add_layer_test(BNLL)
77ncnn_add_layer_test(Cast)
78ncnn_add_layer_test(CELU)
79ncnn_add_layer_test(Clip)
80ncnn_add_layer_test(Concat)
81ncnn_add_layer_test(Convolution)
82ncnn_add_layer_test(Convolution1D)
83ncnn_add_layer_test(Convolution3D)
84ncnn_add_layer_test(ConvolutionDepthWise)
85ncnn_add_layer_test(ConvolutionDepthWise1D)
86ncnn_add_layer_test(ConvolutionDepthWise3D)
87ncnn_add_layer_test(CopyTo)
88ncnn_add_layer_test(Crop)
89ncnn_add_layer_test(CumulativeSum)
90ncnn_add_layer_test(Deconvolution)
91ncnn_add_layer_test(Deconvolution1D)
92ncnn_add_layer_test(Deconvolution3D)
93ncnn_add_layer_test(DeconvolutionDepthWise)
94ncnn_add_layer_test(DeconvolutionDepthWise1D)
95ncnn_add_layer_test(DeconvolutionDepthWise3D)
96ncnn_add_layer_test(DeepCopy)
97ncnn_add_layer_test(DeformableConv2D)
98ncnn_add_layer_test(Dequantize)
99ncnn_add_layer_test(Diag)
100ncnn_add_layer_test(Dropout)
101ncnn_add_layer_test(Einsum)
102ncnn_add_layer_test(Eltwise)
103ncnn_add_layer_test(ELU)
104ncnn_add_layer_test(Embed)
105ncnn_add_layer_test(Erf)
106ncnn_add_layer_test(ExpandDims)
107ncnn_add_layer_test(Flatten)
108ncnn_add_layer_test(Fold)
109ncnn_add_layer_test(GELU)
110ncnn_add_layer_test(GLU)
111ncnn_add_layer_test(Gemm)
112ncnn_add_layer_test(GridSample)
113ncnn_add_layer_test(GroupNorm)
114ncnn_add_layer_test(GRU)
115ncnn_add_layer_test(HardSigmoid)
116ncnn_add_layer_test(HardSwish)
117ncnn_add_layer_test(InnerProduct)
118ncnn_add_layer_test(InstanceNorm)
119ncnn_add_layer_test(Interp)
120ncnn_add_layer_test(LayerNorm)
121ncnn_add_layer_test(LRN)
122ncnn_add_layer_test(LSTM)
123ncnn_add_layer_test(MatMul)
124ncnn_add_layer_test(MemoryData)
125ncnn_add_layer_test(Mish)
126ncnn_add_layer_test(MultiHeadAttention)
127ncnn_add_layer_test(Noop)
128ncnn_add_layer_test(Normalize)
129ncnn_add_layer_test(Packing)
130ncnn_add_layer_test(Padding)
131ncnn_add_layer_test(Permute)
132ncnn_add_layer_test(PixelShuffle)
133ncnn_add_layer_test(Pooling)
134ncnn_add_layer_test(Pooling1D)
135ncnn_add_layer_test(Pooling3D)
136ncnn_add_layer_test(Power)
137ncnn_add_layer_test(PReLU)
138ncnn_add_layer_test(PriorBox)
139ncnn_add_layer_test(Quantize)
140ncnn_add_layer_test(Reduction)
141ncnn_add_layer_test(ReLU)
142ncnn_add_layer_test(Reorg)
143ncnn_add_layer_test(Requantize)
144ncnn_add_layer_test(Reshape)
145ncnn_add_layer_test(RMSNorm)
146ncnn_add_layer_test(RNN)
147ncnn_add_layer_test(ROIPooling)
148ncnn_add_layer_test(ROIAlign)
149ncnn_add_layer_test(Scale)
150ncnn_add_layer_test(SELU)
151ncnn_add_layer_test(Shrink)
152ncnn_add_layer_test(ShuffleChannel)
153ncnn_add_layer_test(Sigmoid)
154ncnn_add_layer_test(Slice)
155ncnn_add_layer_test(Softmax)
156ncnn_add_layer_test(Softplus)
157ncnn_add_layer_test(Squeeze)
158ncnn_add_layer_test(Swish)
159ncnn_add_layer_test(TanH)
160ncnn_add_layer_test(Tile)
161ncnn_add_layer_test(UnaryOp)
162ncnn_add_layer_test(Unfold)
163ncnn_add_layer_test(Yolov3DetectionOutput)