/home/liu/actions-runner/_work/ccv/ccv/lib/inc/ccv_convnet_internal.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef GUARD_ccv_convnet_internal_h |
2 | | #define GUARD_ccv_convnet_internal_h |
3 | | |
4 | | inline static void ccv_convnet_make_output(ccv_convnet_layer_t* layer, int input_rows, int input_cols, int* rows, int* cols, int* partition) |
5 | 3.26k | { |
6 | 3.26k | assert(rows != 0 && cols != 0); |
7 | 3.26k | switch(layer->type) |
8 | 3.26k | { |
9 | 2.40k | case CCV_CONVNET_CONVOLUTIONAL: |
10 | 2.40k | assert(layer->net.convolutional.rows % 2); // as of now, don't support even number of kernel size |
11 | 2.40k | assert(layer->net.convolutional.cols % 2); |
12 | 2.40k | assert((input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows) % layer->net.convolutional.strides == 0); |
13 | 2.40k | assert((input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols) % layer->net.convolutional.strides == 0); |
14 | 2.40k | *rows = (input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; |
15 | 2.40k | *cols = (input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; |
16 | 2.40k | *partition = layer->input.matrix.partition; |
17 | 2.40k | break; |
18 | 6 | case CCV_CONVNET_FULL_CONNECT: |
19 | 6 | *rows = layer->net.full_connect.count; |
20 | 6 | *cols = 1; |
21 | 6 | *partition = 1; |
22 | 6 | break; |
23 | 827 | case CCV_CONVNET_LOCAL_RESPONSE_NORM: |
24 | 827 | *rows = input_rows; |
25 | 827 | *cols = input_cols; |
26 | 827 | *partition = layer->input.matrix.partition; |
27 | 827 | break; |
28 | 24 | case CCV_CONVNET_MAX_POOL: |
29 | 27 | case CCV_CONVNET_AVERAGE_POOL: |
30 | 27 | assert((input_rows + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); |
31 | 27 | assert((input_cols + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); |
32 | 27 | *rows = (input_rows + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; |
33 | 27 | *cols = (input_cols + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; |
34 | 27 | *partition = layer->input.matrix.partition; |
35 | 27 | break; |
36 | 0 | default: |
37 | 0 | assert(0); |
38 | 0 | break; |
39 | 3.26k | } |
40 | 3.26k | } convnet.tests.c:ccv_convnet_make_output Line | Count | Source | 5 | 11 | { | 6 | 11 | assert(rows != 0 && cols != 0); | 7 | 11 | switch(layer->type) | 8 | 11 | { | 9 | 7 | case CCV_CONVNET_CONVOLUTIONAL: | 10 | 7 | assert(layer->net.convolutional.rows % 2); // as of now, don't support even number of kernel size | 11 | 7 | assert(layer->net.convolutional.cols % 2); | 12 | 7 | assert((input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows) % layer->net.convolutional.strides == 0); | 13 | 7 | assert((input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols) % layer->net.convolutional.strides == 0); | 14 | 7 | *rows = (input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; | 15 | 7 | *cols = (input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; | 16 | 7 | *partition = layer->input.matrix.partition; | 17 | 7 | break; | 18 | 0 | case CCV_CONVNET_FULL_CONNECT: | 19 | 0 | *rows = layer->net.full_connect.count; | 20 | 0 | *cols = 1; | 21 | 0 | *partition = 1; | 22 | 0 | break; | 23 | 4 | case CCV_CONVNET_LOCAL_RESPONSE_NORM: | 24 | 4 | *rows = input_rows; | 25 | 4 | *cols = input_cols; | 26 | 4 | *partition = layer->input.matrix.partition; | 27 | 4 | break; | 28 | 0 | case CCV_CONVNET_MAX_POOL: | 29 | 0 | case CCV_CONVNET_AVERAGE_POOL: | 30 | 0 | assert((input_rows + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); | 31 | 0 | assert((input_cols + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); | 32 | 0 | *rows = (input_rows + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; | 33 | 0 | *cols = (input_cols + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; | 34 | 0 | *partition = layer->input.matrix.partition; | 35 | 0 | break; | 36 | 0 | default: | 37 | 0 | assert(0); | 38 | 0 | break; | 39 | 11 | } | 40 | 11 | } |
symbolic.graph.vgg.d.tests.c:ccv_convnet_make_output Line | Count | Source | 5 | 21 | { | 6 | 21 | assert(rows != 0 && cols != 0); | 7 | 21 | switch(layer->type) | 8 | 21 | { | 9 | 13 | case CCV_CONVNET_CONVOLUTIONAL: | 10 | 13 | assert(layer->net.convolutional.rows % 2); // as of now, don't support even number of kernel size | 11 | 13 | assert(layer->net.convolutional.cols % 2); | 12 | 13 | assert((input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows) % layer->net.convolutional.strides == 0); | 13 | 13 | assert((input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols) % layer->net.convolutional.strides == 0); | 14 | 13 | *rows = (input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; | 15 | 13 | *cols = (input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; | 16 | 13 | *partition = layer->input.matrix.partition; | 17 | 13 | break; | 18 | 3 | case CCV_CONVNET_FULL_CONNECT: | 19 | 3 | *rows = layer->net.full_connect.count; | 20 | 3 | *cols = 1; | 21 | 3 | *partition = 1; | 22 | 3 | break; | 23 | 0 | case CCV_CONVNET_LOCAL_RESPONSE_NORM: | 24 | 0 | *rows = input_rows; | 25 | 0 | *cols = input_cols; | 26 | 0 | *partition = layer->input.matrix.partition; | 27 | 0 | break; | 28 | 5 | case CCV_CONVNET_MAX_POOL: | 29 | 5 | case CCV_CONVNET_AVERAGE_POOL: | 30 | 5 | assert((input_rows + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); | 31 | 5 | assert((input_cols + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); | 32 | 5 | *rows = (input_rows + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; | 33 | 5 | *cols = (input_cols + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; | 34 | 5 | *partition = layer->input.matrix.partition; | 35 | 5 | break; | 36 | 0 | default: | 37 | 0 | assert(0); | 38 | 0 | break; | 39 | 21 | } | 40 | 21 | } |
graph.vgg.d.tests.c:ccv_convnet_make_output Line | Count | Source | 5 | 21 | { | 6 | 21 | assert(rows != 0 && cols != 0); | 7 | 21 | switch(layer->type) | 8 | 21 | { | 9 | 13 | case CCV_CONVNET_CONVOLUTIONAL: | 10 | 13 | assert(layer->net.convolutional.rows % 2); // as of now, don't support even number of kernel size | 11 | 13 | assert(layer->net.convolutional.cols % 2); | 12 | 13 | assert((input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows) % layer->net.convolutional.strides == 0); | 13 | 13 | assert((input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols) % layer->net.convolutional.strides == 0); | 14 | 13 | *rows = (input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; | 15 | 13 | *cols = (input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; | 16 | 13 | *partition = layer->input.matrix.partition; | 17 | 13 | break; | 18 | 3 | case CCV_CONVNET_FULL_CONNECT: | 19 | 3 | *rows = layer->net.full_connect.count; | 20 | 3 | *cols = 1; | 21 | 3 | *partition = 1; | 22 | 3 | break; | 23 | 0 | case CCV_CONVNET_LOCAL_RESPONSE_NORM: | 24 | 0 | *rows = input_rows; | 25 | 0 | *cols = input_cols; | 26 | 0 | *partition = layer->input.matrix.partition; | 27 | 0 | break; | 28 | 5 | case CCV_CONVNET_MAX_POOL: | 29 | 5 | case CCV_CONVNET_AVERAGE_POOL: | 30 | 5 | assert((input_rows + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); | 31 | 5 | assert((input_cols + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); | 32 | 5 | *rows = (input_rows + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; | 33 | 5 | *cols = (input_cols + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; | 34 | 5 | *partition = layer->input.matrix.partition; | 35 | 5 | break; | 36 | 0 | default: | 37 | 0 | assert(0); | 38 | 0 | break; | 39 | 21 | } | 40 | 21 | } |
Unexecuted instantiation: dense.net.tests.c:ccv_convnet_make_output ccv_convnet.c:ccv_convnet_make_output Line | Count | Source | 5 | 3.21k | { | 6 | 3.21k | assert(rows != 0 && cols != 0); | 7 | 3.21k | switch(layer->type) | 8 | 3.21k | { | 9 | 2.37k | case CCV_CONVNET_CONVOLUTIONAL: | 10 | 2.37k | assert(layer->net.convolutional.rows % 2); // as of now, don't support even number of kernel size | 11 | 2.37k | assert(layer->net.convolutional.cols % 2); | 12 | 2.37k | assert((input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows) % layer->net.convolutional.strides == 0); | 13 | 2.37k | assert((input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols) % layer->net.convolutional.strides == 0); | 14 | 2.37k | *rows = (input_rows + layer->net.convolutional.border * 2 - layer->net.convolutional.rows + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; | 15 | 2.37k | *cols = (input_cols + layer->net.convolutional.border * 2 - layer->net.convolutional.cols + layer->net.convolutional.strides - 1) / layer->net.convolutional.strides + 1; | 16 | 2.37k | *partition = layer->input.matrix.partition; | 17 | 2.37k | break; | 18 | 0 | case CCV_CONVNET_FULL_CONNECT: | 19 | 0 | *rows = layer->net.full_connect.count; | 20 | 0 | *cols = 1; | 21 | 0 | *partition = 1; | 22 | 0 | break; | 23 | 823 | case CCV_CONVNET_LOCAL_RESPONSE_NORM: | 24 | 823 | *rows = input_rows; | 25 | 823 | *cols = input_cols; | 26 | 823 | *partition = layer->input.matrix.partition; | 27 | 823 | break; | 28 | 14 | case CCV_CONVNET_MAX_POOL: | 29 | 17 | case CCV_CONVNET_AVERAGE_POOL: | 30 | 17 | assert((input_rows + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); | 31 | 17 | assert((input_cols + layer->net.pool.border * 2 - layer->net.pool.size) % layer->net.pool.strides == 0); | 32 | 17 | *rows = (input_rows + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; | 33 | 17 | *cols = (input_cols + layer->net.pool.border * 2 - layer->net.pool.size + layer->net.pool.strides - 1) / layer->net.pool.strides + 1; | 34 | 17 | *partition = layer->input.matrix.partition; | 35 | 17 | break; | 36 | 0 | default: | 37 | 0 | assert(0); | 38 | 0 | break; | 39 | 3.21k | } | 40 | 3.21k | } |
|
41 | | |
42 | | #endif |