├── .gitignore ├── rgb_format.h ├── h5_format.h ├── rgb_format.c ├── h5_format.c ├── README.md ├── sample_model.c ├── rgb_prep.py ├── cnn_inference.h ├── generator.py ├── LICENSE ├── cnn_inference.c └── Doxyfile /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.jpg 3 | *.txt 4 | *.h5 5 | *.html 6 | *.png 7 | *.js 8 | *.css 9 | *.tex 10 | *.sty 11 | *.bat 12 | Makefile 13 | model.c 14 | driver.py 15 | -------------------------------------------------------------------------------- /rgb_format.h: -------------------------------------------------------------------------------- 1 | #ifndef JPG_FORMAT 2 | #define JPG_FORMAT 3 | #include 4 | #include 5 | #define MAX_FN 50 6 | 7 | float ***load_RGB(char *image_name, int h, int w); 8 | 9 | #endif -------------------------------------------------------------------------------- /h5_format.h: -------------------------------------------------------------------------------- 1 | #ifndef H5_FORMAT 2 | #define H5_FORMAT 3 | #include "cnn_inference.h" 4 | 5 | #define MAX_FN 50 6 | 7 | void load_Conv(ConvLayer *layer, char *layer_name); 8 | void load_Dense(DenseLayer *layer, char *layer_name); 9 | 10 | #endif -------------------------------------------------------------------------------- /rgb_format.c: -------------------------------------------------------------------------------- 1 | #include "rgb_format.h" 2 | 3 | float ***load_RGB(char *image_name, int h, int w){ 4 | FILE *fp; 5 | char file_name[MAX_FN]; 6 | int f,i,j; 7 | 8 | 9 | float ***img; 10 | img = malloc(3*sizeof(float**)); 11 | if(img==NULL){ 12 | fprintf(stderr, "Error: Unable to allocate memory to img in load_RGB."); 13 | exit(EXIT_FAILURE); 14 | } 15 | 16 | for(i=0; i<3; i++){ 17 | img[i] = malloc(h*sizeof(float*)); 18 | if(img[i]==NULL){ 19 | fprintf(stderr, "Error: Unable to allocate memory to img[%d] in load_RGB.",i); 20 | exit(EXIT_FAILURE); 21 | } 22 | for(j=0; jn_kb; n++){ 15 | for(d=0; dkernel_box_dims[0]; d++){ 16 | for(h=0; hkernel_box_dims[2]; h++){ 17 | for(w=0; wkernel_box_dims[1]; w++){ 18 | fscanf(fp, "%f", &(layer->kernel_box_group[n][d][h][w])); 19 | } 20 | } 21 | } 22 | } 23 | 24 | fclose(fp); 25 | 26 | sprintf(filename, "model_weights_txt/%s_biases.txt", layer_name); 27 | if((fp=fopen(filename, "r"))==NULL){ 28 | fprintf(stderr, "Error, unable to access %s", filename); 29 | exit(EXIT_FAILURE); 30 | } 31 | 32 | for(n=0; nn_kb; n++){ 33 | fscanf(fp, "%f", &(layer->bias_array[n])); 34 | } 35 | fclose(fp); 36 | } 37 | 38 | void load_Dense(DenseLayer *layer, char *layer_name){ 39 | FILE *fp; 40 | char filename[MAX_FN]; 41 | int n,d,h,w; 42 | 43 | sprintf(filename, "model_weights_txt/%s_weights.txt", layer_name); 44 | if((fp = fopen(filename, "r"))==NULL){ 45 | fprintf(stderr, "Error, unable to access %s", filename); 46 | exit(EXIT_FAILURE); 47 | } 48 | 49 | for(n=0; nn_kb; n++){ 50 | for(d=0; dkernel_box_dims[0]; d++){ 51 | for(h=0; hkernel_box_dims[1]; h++){ 52 | for(w=0; wkernel_box_dims[2]; w++){ 53 | fscanf(fp, "%f", &(layer->kernel_box_group[n][d][h][w])); 54 | } 55 | } 56 | } 57 | } 58 | 59 | fclose(fp); 60 | 61 | sprintf(filename, "model_weights_txt/%s_biases.txt", layer_name); 62 | if((fp=fopen(filename, "r"))==NULL){ 63 | fprintf(stderr, "Error, unable to access %s", filename); 64 | exit(EXIT_FAILURE); 65 | } 66 | 67 | for(n=0; nn_kb; n++){ 68 | fscanf(fp, "%f", &(layer->bias_array[n])); 69 | } 70 | fclose(fp); 71 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CNN-Inference-Didactic 2 | 3 | In this repositary you will find a C library written with didactic intentions using straight-forward algorithms, simple structures and lots of comments. 4 | 5 | ## Channels First 6 | 7 | This library uses a channels first convention. Anyone can read the code with this in mind, but in order to run experiments by replicating your model, its weights must be configured accordingly. 8 | 9 | ## Documentation 10 | 11 | In order to generate the documentation for this framework, open terminal/command prompt in the directory and run `doxygen Doxyfile`. Two versions of the documentation will be generated(one in html, one in LaTeX). In order to view the documentation website, open **/html/index.html** in your browser. 12 | 13 | ## Preparing the Input 14 | 15 | The input to your Convolutional Neural Network must be an RGB image. In order to prepare your input images for inference, you must run **rgb_prep.py** with the arguments ` `. This will automatically generate the input files for the C model to read. 16 | 17 | ## Replicating Your Model 18 | 19 | In order to experiment with this library, it is necessary to build a replica of your model in C. If your model is a *[Keras Sequential Model](https://keras.io/models/sequential/)* or was built in Keras in a sequential way, then you may choose to automate this process by interfacing with Keras directly(see below). Otherwise you will have to manually build your model using the library functions. See **sample_model.c** for an example model. 20 | 21 | ## Extracting Trained Weights 22 | 23 | Once you've built your model, you will need to load your trained weights into it. This is handled by the functions in **h5_format.c**. As the name suggests, the functions in this file were designed to work with .h5 style weights from Keras. Even if your model isn't sequential, all you need to do is to run `generator.extract_weights()` as shown below with your model's h5py file. This will generate the necessary files for the C model. All you need to do is to keep track of the names of your layers as shown in **sample_model.c**. **_This framework assumes all your layers have unique names._** 24 | 25 | import keras 26 | import generator 27 | 28 | generator.extract_weights(keras.models.load_model("path/to/your/model")) 29 | 30 | 31 | ## Interfacing With Keras 32 | 33 | If you have a *[Keras Sequential Model](https://keras.io/models/sequential/)*, then you may choose to directly interface with Keras and jump right into running your experiments after preparing your input(see above). In order to generate your model in C automatically, you can either run **generator.py** with the argument `` or you may call the generator functions from another scripts like this: 34 | 35 | import keras 36 | import generator 37 | 38 | model = keras.models.load_model("path/to/your/model") 39 | generator.generate(model) 40 | generator.extract_weights(model) 41 | 42 | 43 | ## Running Your Experiment 44 | 45 | After successfully preparing your input, replicating your model and extracting your trained weights it is time for running your inference. 46 | 47 | Run 48 | 49 | gcc model.c cnn_inference.c h5_format.c rgb_format.c -o infer.exe 50 | 51 | to compile. 52 | -------------------------------------------------------------------------------- /sample_model.c: -------------------------------------------------------------------------------- 1 | #include "cnn_inference.h" 2 | #include "h5_format.h" 3 | #include "rgb_format.h" 4 | #include 5 | 6 | 7 | 8 | // // // // This file servers the purpose of guiding you through creating your first model using this library. // // // // 9 | 10 | 11 | 12 | int main(int argc, char *argv[]){ 13 | 14 | 15 | // For running the executable wih different input images without recompiling 16 | if(argc!=2){ 17 | printf("\nPlease run as: model.c . Image name must be given without the 0,1,2 and without its extension."); 18 | exit(EXIT_FAILURE); 19 | } 20 | 21 | 22 | 23 | // Optional 24 | // If you wish, you may get the inference time 25 | clock_t start, end; 26 | double cpu_time_used; 27 | 28 | 29 | 30 | // Preparing your input 31 | // The name of the image is read as a command line argument. 32 | // INPUT_IMAGE_HEIGHT and INPUT_IMAGE_WIDTH represent the height and the width of the input image to your model 33 | // These values should either be defined in your header, or be replaced and hard-coded here 34 | // The load_RGB() function could be found in rgb_format.c 35 | float ***img; 36 | img = load_RGB(argv[1], INPUT_IMAGE_HEIGHT, INPUT_IMAGE_WIDTH); 37 | 38 | 39 | 40 | // Configuring the tensors 41 | // You can make tensors using the make_tensor() function from cnn_inference.c 42 | Tensor *t; 43 | t = make_tensor(3, 63, 63, img); 44 | 45 | 46 | 47 | // Generating Layers 48 | // Before running your inference experiment, you will first need to replicate your model's Conv and Dense layers using the functions in cnn_inference.c 49 | // After generating your layers you will need to load their weights. This is done by the functions in h5_format.c. 50 | // For loading your weights you will first need to export them using generator.py, for details on this module see the README or the documentation. 51 | // After having generated the weights, all you need to do is to pass the layers and their names to the loading functions. 52 | // If you've used generator.extract_weights(), then the names of your layers will be the names of your layers from Keras. 53 | ConvLayer *_conv2d_1; 54 | _conv2d_1 = empty_Conv(32, 3, 3, 3, 2, 2, VALID); 55 | load_Conv(_conv2d_1, "conv2d_1"); 56 | 57 | ConvLayer *_conv2d_2; 58 | _conv2d_2 = empty_Conv(32, 32, 3, 3, 1, 1, SAME); 59 | load_Conv(_conv2d_2, "conv2d_2"); 60 | 61 | DenseLayer *_dense_1; 62 | _dense_1 = empty_Dense(512, 1568, 1, 1); 63 | load_Dense(_dense_1, "dense_1"); 64 | 65 | DenseLayer *_dense_2; 66 | _dense_2 = empty_Dense(1, 512, 1, 1); 67 | load_Dense(_dense_2, "dense_2"); 68 | 69 | 70 | 71 | 72 | // Inference 73 | // Once you've created your Dense and Conv layers and loaded their weights, you may start inference. 74 | // During inference you have access to a variety of tensor operation implementations. 75 | // Take a look at cnn_inference.h and the documentation for the list of available functions and their details. 76 | start = clock(); 77 | 78 | t = Conv(t, _conv2d_1, ReLU_activation, 1); 79 | t = MaxPool(t, 3, 3, 2, 2, VALID, 1); 80 | t = Conv(t, _conv2d_2, ReLU_activation, 1); 81 | t = MaxPool(t, 3, 3, 2, 2, VALID, 1); 82 | t = FlattenD(t, 1); 83 | t = Dense(t, _dense_1, ReLU_activation, 1); 84 | t = Dense(t, _dense_2, linear_activation, 1); 85 | 86 | end = clock(); 87 | 88 | 89 | 90 | 91 | // Output 92 | // The print_tensor() function will print the output tensor to std_out 93 | print_tensor(t); 94 | 95 | 96 | 97 | 98 | // Optional 99 | // If you wish, you may get the inference time 100 | cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC; 101 | printf("\nInference completed in: %f", cpu_time_used); 102 | 103 | 104 | 105 | 106 | // Freeing memory 107 | // You may use these functions to free the weights of your model once inference is complete. 108 | free_ConvLayer(_conv2d_1); 109 | free_ConvLayer(_conv2d_2); 110 | free_DenseLayer(_dense_1); 111 | free_DenseLayer(_dense_2); 112 | } -------------------------------------------------------------------------------- /rgb_prep.py: -------------------------------------------------------------------------------- 1 | """ @file rgb_prep.py You may run this script with arguments to generate input images for the C model. """ 2 | 3 | import numpy as np 4 | import sys 5 | import os 6 | 7 | # THE BELOW CODE HAS BEEN TAKEN FROM THE KERAS SOURCE CODE IN ORDER TO MAKE THE IMAGE PREPARATION PROSCESS FASTER AND LIGHTER 8 | # THE CODE HAS BEEN TAKEN FROM keras.preprocessing.image 9 | 10 | try: 11 | from PIL import Image as pil_image 12 | except ImportError: 13 | pil_image = None 14 | 15 | if pil_image is not None: 16 | _PIL_INTERPOLATION_METHODS = { 17 | 'nearest': pil_image.NEAREST, 18 | 'bilinear': pil_image.BILINEAR, 19 | 'bicubic': pil_image.BICUBIC, 20 | } 21 | # These methods were only introduced in version 3.4.0 (2016). 22 | if hasattr(pil_image, 'HAMMING'): 23 | _PIL_INTERPOLATION_METHODS['hamming'] = pil_image.HAMMING 24 | if hasattr(pil_image, 'BOX'): 25 | _PIL_INTERPOLATION_METHODS['box'] = pil_image.BOX 26 | # This method is new in version 1.1.3 (2013). 27 | if hasattr(pil_image, 'LANCZOS'): 28 | _PIL_INTERPOLATION_METHODS['lanczos'] = pil_image.LANCZOS 29 | 30 | 31 | def load_img(path, grayscale=False, target_size=None, interpolation='nearest'): 32 | """Loads an image into PIL format. 33 | Arguments: 34 | path: Path to image file 35 | grayscale: Boolean, whether to load the image as grayscale. 36 | target_size: Either `None` (default to original size) 37 | or tuple of ints `(img_height, img_width)`. 38 | interpolation: Interpolation method used to resample the image if the 39 | target size is different from that of the loaded image. 40 | Supported methods are "nearest", "bilinear", and "bicubic". 41 | If PIL version 1.1.3 or newer is installed, "lanczos" is also 42 | supported. If PIL version 3.4.0 or newer is installed, "box" and 43 | "hamming" are also supported. By default, "nearest" is used. 44 | Returns: 45 | A PIL Image instance. 46 | Raises: 47 | ImportError: if PIL is not available. 48 | ValueError: if interpolation method is not supported. 49 | """ 50 | if pil_image is None: 51 | raise ImportError('Could not import PIL.Image. ' 52 | 'The use of `array_to_img` requires PIL.') 53 | img = pil_image.open(path) 54 | if grayscale: 55 | if img.mode != 'L': 56 | img = img.convert('L') 57 | else: 58 | if img.mode != 'RGB': 59 | img = img.convert('RGB') 60 | if target_size is not None: 61 | width_height_tuple = (target_size[1], target_size[0]) 62 | if img.size != width_height_tuple: 63 | if interpolation not in _PIL_INTERPOLATION_METHODS: 64 | raise ValueError('Invalid interpolation method {} specified. Supported ' 65 | 'methods are {}'.format(interpolation, ', '.join( 66 | _PIL_INTERPOLATION_METHODS.keys()))) 67 | resample = _PIL_INTERPOLATION_METHODS[interpolation] 68 | img = img.resize(width_height_tuple, resample) 69 | return img 70 | 71 | def img_to_array(img, data_format=None): 72 | """Converts a PIL Image instance to a Numpy array. 73 | Arguments: 74 | img: PIL Image instance. 75 | data_format: Image data format. 76 | Returns: 77 | A 3D Numpy array. 78 | Raises: 79 | ValueError: if invalid `img` or `data_format` is passed. 80 | """ 81 | if data_format is None: 82 | data_format = 'channels_last' 83 | if data_format not in {'channels_first', 'channels_last'}: 84 | raise ValueError('Unknown data_format: ', data_format) 85 | # Numpy array x has format (height, width, channel) 86 | # or (channel, height, width) 87 | # but original PIL image has format (width, height, channel) 88 | x = np.asarray(img) 89 | if len(x.shape) == 3: 90 | if data_format == 'channels_first': 91 | x = x.transpose(2, 0, 1) 92 | elif len(x.shape) == 2: 93 | if data_format == 'channels_first': 94 | x = x.reshape((1, x.shape[0], x.shape[1])) 95 | else: 96 | x = x.reshape((x.shape[0], x.shape[1], 1)) 97 | else: 98 | raise ValueError('Unsupported image shape: ', x.shape) 99 | return x 100 | 101 | # UNTIL HERE 102 | 103 | if not len(sys.argv)==4: 104 | print("Please run as RGB_to_txt.py ") 105 | sys.exit() 106 | 107 | path_image = './input_images_txt/' 108 | try: 109 | os.mkdir(path_image) 110 | except FileExistsError: 111 | pass 112 | 113 | 114 | 115 | img = load_img(sys.argv[1], target_size = (int(sys.argv[2]), int(sys.argv[3]))) 116 | img = img_to_array(img, data_format='channels_first') 117 | np.savetxt('{0}/{1}_0.txt'.format(path_image, os.path.basename(os.path.normpath(sys.argv[1])).split(".")[0]), img[0], fmt='%.8e') 118 | np.savetxt('{0}/{1}_1.txt'.format(path_image, os.path.basename(os.path.normpath(sys.argv[1])).split(".")[0]), img[1], fmt='%.8e') 119 | np.savetxt('{0}/{1}_2.txt'.format(path_image, os.path.basename(os.path.normpath(sys.argv[1])).split(".")[0]), img[2], fmt='%.8e') 120 | -------------------------------------------------------------------------------- /cnn_inference.h: -------------------------------------------------------------------------------- 1 | #ifndef CNN_INFERENCE 2 | #define CNN_INFERENCE 3 | #include 4 | #include 5 | #include 6 | 7 | /** 8 | * Padding mode enumeration. 9 | * VALID means no padding will be done on the input tensor before the following convolution operation. 10 | * SAME means the input tensor will be padded in such a way that the output of the following convolution operation will have the same height and width as the input tensor. 11 | */ 12 | typedef enum pm {VALID, SAME} padding_mode; 13 | 14 | 15 | /** 16 | * The structure representing a tensor. Basically a convenient way to have a 3D float array and its dimensions together. 17 | */ 18 | typedef struct { 19 | int dims[3]; /**< Dimensions of the 3D tensor [depth, height, width] */ 20 | float ***T; /**< The 3D float array representing the tensor */ 21 | } Tensor; 22 | 23 | 24 | /** 25 | * The structure representing a convolution layer. Each layer has a set of *kernel boxes* which is a tool for intuitively defining the weights. 26 | * Each *kernel box* holds **d** kernels, where **d** is the depth of the input tensor, meaning there is 1 kernel/filter for each input layer. 27 | */ 28 | typedef struct { 29 | int n_kb; /**< The number of kernel boxes(filters) in this layer. Also equal to the length of the *bias_array* and to the depth of the output tensor. */ 30 | int kernel_box_dims[3]; /**< Dimensions of the kernel box [depth, height, width] */ 31 | float ****kernel_box_group; /**< The array of kernel boxes which represents the weights of this convolution layer as described above. */ 32 | float *bias_array; /**< The bias array of this layer. The length of this array is n_kb. */ 33 | int stride_x; /**< The stride of the kernel window horizontally */ 34 | int stride_y; /**< The stride of the kernel window vertically */ 35 | padding_mode padding; /**< Padding option for this convolution layer as described in padding_mode */ 36 | } ConvLayer; 37 | 38 | 39 | /** 40 | * The structure representing a dense layer. Each layer has a set of *kernel boxes* which is a tool for intuitively defining the weights. 41 | * Each *kernel box* holds **d** kernels, where **d** is the depth of the input tensor, meaning there is 1 kernel/filter for each input layer. 42 | * Another name for dense layers are fully connected layers, therefore, naturally, the height and the width of the kernels in the dense layers must match those of the input layer. 43 | * Altough *kernel box groups* are used in this library to hold the weights of the dense layers for completeness, one could think of conventional dense layers as 44 | * layers whose kernel boxes have height and width 1. The number of kernel boxes in these layers may be thought of as the number of their units. 45 | */ 46 | typedef struct { 47 | int n_kb; /**< The number of kernel boxes(filters) in this layer. Also equal to the length of the *bias_array* and to the depth of the output tensor. This can also be thought of as the number of units this dense layer has.*/ 48 | int kernel_box_dims[3]; /**< Dimensions of the kernel box [depth, height, width] */ 49 | float ****kernel_box_group; /**< The array of kernel boxes which represents the weights of this convolution layer as described above. */ 50 | float *bias_array; /**< The bias array of this layer. The length of this array is n_kb. */ 51 | } DenseLayer; 52 | 53 | 54 | //Layer generators 55 | ConvLayer *empty_Conv(int n_kb, int d_kb, int h_kb, int w_kb, int stride_x, int stride_y, padding_mode padding); 56 | ConvLayer *new_Conv(int n_kb, int d_kb, int h_kb, int w_kb, float **** weights_array, float * biases_array, int stride_x, int stride_y, padding_mode padding); 57 | DenseLayer *empty_Dense(int n_kb, int d_kb, int h_kb, int w_kb); 58 | DenseLayer *new_Dense(int n_kb, int d_kb, int h_kb, int w_kb, float **** weights_array, float * biases_array); 59 | 60 | //Tensor operations 61 | Tensor *Conv(Tensor *input, ConvLayer *layer, Tensor *(*activation)(Tensor *,int), int free_input); 62 | Tensor *Dense(Tensor *input, DenseLayer *layer, Tensor *(*activation)(Tensor *,int), int free_input); 63 | Tensor *sigmoid_activation(Tensor *input, int free_input); 64 | Tensor *ReLU_activation(Tensor *input, int free_input); 65 | Tensor *ELU_activation(Tensor *input, int free_input); 66 | Tensor *linear_activation(Tensor *input, int free_input); 67 | Tensor *apply_padding(Tensor *input, int padding_x, int padding_y, int free_input); 68 | Tensor *MaxPool(Tensor *input, int height, int width, int stride_x, int stride_y, padding_mode padding, int free_input); 69 | Tensor *FlattenW(Tensor *input, int free_input); 70 | Tensor *FlattenH(Tensor *input, int free_input); 71 | Tensor *FlattenD(Tensor *input, int free_input); 72 | Tensor *Add(Tensor **input_tensors, int n_tensors, int free_inputs); 73 | Tensor *Average(Tensor **input_tensors, int n_tensors, int free_inputs); 74 | 75 | //utility functions 76 | void print_tensor(Tensor *t); 77 | float ****alloc_4D(int b, int d, int h, int w); 78 | float ***alloc_3D(int d, int h, int w); 79 | void print_conv_details(ConvLayer layer); 80 | void free_tensor(Tensor *t); 81 | Tensor *make_tensor(int d, int h, int w, float ***array); 82 | void free_ConvLayer(ConvLayer *layer); 83 | void free_DenseLayer(DenseLayer *layer); 84 | 85 | #endif -------------------------------------------------------------------------------- /generator.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import keras 3 | import sys 4 | import os 5 | from keras.preprocessing import image 6 | 7 | def generate(model): 8 | """ Generates the driver for the inference library """ 9 | 10 | weights = [] 11 | config = [] 12 | for layer in model.layers: 13 | weights.append(layer.get_weights()) 14 | config.append(layer.get_config()) 15 | 16 | f = open("model.c", "w+") 17 | f.write('#include "cnn_inference.h"\n#include "h5_format.h"\n#include "rgb_format.h"\n#include \n') 18 | f.write('\nint main(int argc, char *argv[]){\n\n') 19 | f.write('\tif(argc!=2){\n\t\tprintf("\\nPlease run as: model.c . Image name must be given without the 0,1,2 and without its extension.\\n");\n\t\texit(EXIT_FAILURE);\n\t}\n') 20 | f.write('\n\tclock_t start, end;\n\tdouble cpu_time_used;\n\n') 21 | 22 | f.write('\t//Prepare Input\n') 23 | f.write('\tfloat ***img;\n\timg = load_RGB(argv[1], {0}, {1});\n\n'.format(config[0]['batch_input_shape'][2], config[0]['batch_input_shape'][3])) 24 | f.write('\tTensor *t;\n\tt = make_tensor(3, {0}, {1}, img);\n\n'.format(config[0]['batch_input_shape'][2], config[0]['batch_input_shape'][3])) 25 | 26 | f.write('\t//Generate Layers\n') 27 | for layer in model.layers: 28 | if isinstance(layer, keras.layers.convolutional.Conv2D): 29 | f.write('\tConvLayer *_{0};\n\t_{0} = empty_Conv({1}, {2}, {3}, {4}, {5}, {6}, {7});\n'.format(layer.name, layer.filters, layer.input_shape[1], layer.kernel_size[0], layer.kernel_size[1], layer.strides[0], layer.strides[1], layer.padding.upper())) 30 | f.write('\tload_Conv(_{0}, "{0}");\n\n'.format(layer.name)) 31 | 32 | elif isinstance(layer, keras.layers.core.Dense): 33 | f.write('\tDenseLayer *_{0};\n\t_{0} = empty_Dense({1}, {2}, 1, 1);\n'.format(layer.name, layer.units, layer.input_shape[1])) 34 | f.write('\tload_Dense(_{0}, "{0}");\n\n'.format(layer.name)) 35 | 36 | 37 | f.write('\t//Inference\n') 38 | f.write('\tstart = clock();\n\n') 39 | for layer in model.layers: 40 | if isinstance(layer, keras.layers.convolutional.Conv2D): 41 | if layer.get_config()['activation'].upper() == "RELU": 42 | activation = "ReLU_activation" 43 | elif layer.get_config()['activation'].upper() == "LINEAR": 44 | activation = "linear_activation" 45 | elif layer.get_config()['activation'].upper() == "SIGMOID": 46 | activation = "sigmoid_activation" 47 | elif layer.get_config()['activation'].upper() == "ELU": 48 | activation = "ELU_activation" 49 | 50 | f.write('\tt = Conv(t, _{0}, {1}, 1);\n'.format(layer.name, activation)) 51 | 52 | elif isinstance(layer, keras.layers.core.Dense): 53 | if layer.get_config()['activation'].upper() == "RELU": 54 | activation = "ReLU_activation" 55 | elif layer.get_config()['activation'].upper() == "LINEAR": 56 | activation = "linear_activation" 57 | elif layer.get_config()['activation'].upper() == "SIGMOID": 58 | activation = "sigmoid_activation" 59 | elif layer.get_config()['activation'].upper() == "ELU": 60 | activation = "ELU_activation" 61 | 62 | f.write('\tt = Dense(t, _{0}, {1}, 1);\n'.format(layer.name, activation)) 63 | 64 | elif isinstance(layer, keras.layers.pooling.MaxPooling2D): 65 | f.write('\tt = MaxPool(t, {0}, {1}, {2}, {3}, {4}, 1);\n'.format(layer.pool_size[0], layer.pool_size[1], layer.strides[0], layer.strides[1], layer.padding.upper())) 66 | 67 | elif isinstance(layer, keras.layers.core.Flatten): 68 | f.write('\tt = FlattenD(t, 1);\n') 69 | 70 | elif isinstance(layer, keras.layers.core.Activation): 71 | if layer.get_config()['activation'].upper() == "RELU": 72 | f.write('\tt = ReLU_activation(t, 1);\n') 73 | elif layer.get_config()['activation'].upper() == "LINEAR": 74 | f.write('\tt = linear_activation(t, 1);\n') 75 | elif layer.get_config()['activation'].upper() == "SIGMOID": 76 | f.write('\tt = sigmoid_activation(t, 1);\n') 77 | elif layer.get_config()['activation'].upper() == "ELU": 78 | f.write('\tt = ELU_activation(t, 1);\n') 79 | 80 | f.write('\n\tend = clock();\n\n\tprint_tensor(t);\n\n\tcpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;\n\tprintf("\\nInference completed in: %f", cpu_time_used);\n\n') 81 | 82 | f.write("\t//Free Memory\n") 83 | for layer in model.layers: 84 | if isinstance(layer, keras.layers.convolutional.Conv2D): 85 | f.write("\tfree_ConvLayer(_{0});\n".format(layer.name)) 86 | 87 | elif isinstance(layer, keras.layers.core.Dense): 88 | f.write("\tfree_DenseLayer(_{0});\n".format(layer.name)) 89 | 90 | f.write('}') 91 | f.close() 92 | 93 | 94 | def extract_weights(model): 95 | """ Extracts the weights of the given model to .txt files to work with the C library """ 96 | 97 | path_weights = './model_weights_txt/' 98 | try: 99 | os.mkdir(path_weights) 100 | except FileExistsError: 101 | pass 102 | 103 | 104 | for layer in model.layers: 105 | if isinstance(layer, keras.layers.convolutional.Conv2D): 106 | fw = open("{0}/{1}_weights.txt".format(path_weights, layer.name), "w+") 107 | fb = open("{0}/{1}_biases.txt".format(path_weights, layer.name), "w+") 108 | weights = np.transpose(layer.get_weights()[0]) 109 | 110 | biases = layer.get_weights()[1] 111 | 112 | for n in range(layer.filters): 113 | fb.write(format(biases[n], ".10f") + " ") 114 | for d in range(layer.input_shape[1]): 115 | for h in range(layer.kernel_size[0]): 116 | for w in range(layer.kernel_size[1]): 117 | fw.write(format(weights[n][d][w][h], ".10f") + " ") 118 | 119 | fw.close() 120 | fb.close() 121 | 122 | elif isinstance(layer, keras.layers.core.Dense): 123 | fw = open("{0}/{1}_weights.txt".format(path_weights, layer.name), "w+") 124 | fb = open("{0}/{1}_biases.txt".format(path_weights, layer.name), "w+") 125 | weights = np.transpose(layer.get_weights()[0]) 126 | biases = layer.get_weights()[1] 127 | 128 | for n in range(layer.units): 129 | fb.write(format(biases[n], ".10f") + " ") 130 | for d in range(layer.input_shape[1]): 131 | fw.write(format(weights[n][d], ".10f") + " ") 132 | 133 | fw.close() 134 | fb.close() 135 | 136 | def main(): 137 | if not len(sys.argv)==2: 138 | print("Please run as: generator.py ") 139 | sys.exit() 140 | 141 | generate(keras.models.load_model(sys.argv[1])) 142 | extract_weights(keras.models.load_model(sys.argv[1])) 143 | 144 | if __name__ == "__main__": 145 | main() -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /cnn_inference.c: -------------------------------------------------------------------------------- 1 | #include "cnn_inference.h" 2 | 3 | /** \defgroup layergenerators Layer Generators */ 4 | 5 | /** \defgroup tensoroperations Tensor Operations */ 6 | 7 | /** \defgroup utilityfunctions Utility Functions */ 8 | 9 | /** @ingroup layergenerators 10 | * Creates a convolution layer without weights and returns a pointer to it. 11 | * 12 | * @param n_kb Number of kernel boxes, which is also the number of biases 13 | * @param d_kb Depth of kernel boxes 14 | * @param h_kb Height of kernel boxes 15 | * @param w_kb Width of kernel boxes 16 | * @param stride_x Stride of kernel window on the x axis(horizontal) 17 | * @param stride_y Stride of kernel window on the y axis(vertical) 18 | * @param padding Option from padding_mode (VALID or SAME). VALID means no padding will be done, 19 | * SAME means the input tensor will be padded in such a way that the output of the following convolution operation will 20 | * have the same height and width as the input tensor. 21 | * 22 | * @sa new_Conv(), padding_mode 23 | * 24 | * @return A pointer to the newly created convolution layer 25 | */ 26 | ConvLayer *empty_Conv(int n_kb, int d_kb, int h_kb, int w_kb, int stride_x, int stride_y, padding_mode padding){ 27 | ConvLayer *convolution_layer_pointer; 28 | convolution_layer_pointer = malloc(sizeof(ConvLayer)); 29 | if(convolution_layer_pointer==NULL){ 30 | fprintf(stderr, "Error: Unable to allocate memory to convolution_layer_pointer in new_Conv."); 31 | exit(EXIT_FAILURE); 32 | } 33 | 34 | convolution_layer_pointer->n_kb = n_kb; 35 | convolution_layer_pointer->kernel_box_dims[0]=d_kb; 36 | convolution_layer_pointer->kernel_box_dims[1]=h_kb; 37 | convolution_layer_pointer->kernel_box_dims[2]=w_kb; 38 | 39 | convolution_layer_pointer->kernel_box_group = alloc_4D(n_kb, d_kb, h_kb, w_kb); 40 | convolution_layer_pointer->bias_array = malloc(n_kb*sizeof(float)); 41 | 42 | convolution_layer_pointer->stride_x = stride_x; 43 | convolution_layer_pointer->stride_y = stride_y; 44 | convolution_layer_pointer->padding = padding; 45 | 46 | return convolution_layer_pointer; 47 | } 48 | 49 | /** @ingroup layergenerators 50 | * Creates a convolution layer with the given weights and returns a pointer to it. 51 | * 52 | * @param n_kb Number of kernel boxes, which is also the number of biases 53 | * @param d_kb Depth of kernel boxes 54 | * @param h_kb Height of kernel boxes 55 | * @param w_kb Width of kernel boxes 56 | * @param weights_array A 4D float array of dimensions (n_kb * d_kb * h_kb * w_kb) containing the kernel weights 57 | * @param biases_array A float array of length n_kb conraining the biases 58 | * @param stride_x Stride of kernel window on the x axis(horizontal) 59 | * @param stride_y Stride of kernel window on the y axis(vertical) 60 | * @param padding Option from padding_mode (VALID or SAME). VALID means no padding will be done, 61 | * SAME means the input tensor will be padded in such a way that the output of the following convolution operation will 62 | * have the same height and width as the input tensor. 63 | * 64 | * @sa empty_Conv() 65 | * 66 | * @return A pointer to the newly created convolution layer 67 | */ 68 | ConvLayer *new_Conv(int n_kb, int d_kb, int h_kb, int w_kb, float **** weights_array, float * biases_array, int stride_x, int stride_y, padding_mode padding){ 69 | ConvLayer *convolution_layer_pointer; 70 | convolution_layer_pointer = malloc(sizeof(ConvLayer)); //convolution_layer_pointer: Convolutional Layer Pointer 71 | if(convolution_layer_pointer==NULL){ 72 | fprintf(stderr, "Error: Unable to allocate memory to convolution_layer_pointer in new_Conv."); 73 | exit(EXIT_FAILURE); 74 | } 75 | 76 | convolution_layer_pointer->n_kb = n_kb; 77 | convolution_layer_pointer->kernel_box_dims[0]=d_kb; 78 | convolution_layer_pointer->kernel_box_dims[1]=h_kb; 79 | convolution_layer_pointer->kernel_box_dims[2]=w_kb; 80 | 81 | convolution_layer_pointer->kernel_box_group = weights_array; 82 | convolution_layer_pointer->bias_array = biases_array; 83 | 84 | convolution_layer_pointer->stride_x = stride_x; 85 | convolution_layer_pointer->stride_y = stride_y; 86 | convolution_layer_pointer->padding = padding; 87 | 88 | return convolution_layer_pointer; 89 | } 90 | 91 | 92 | /** @ingroup layergenerators 93 | * Creates a dense layer without weights and returns a pointer to it. 94 | * 95 | * @param n_kb Number of kernel boxes aka number of output neurons for dense layers 96 | * @param d_kb Depth of kernel boxes, this should match the depth of the expected input tensor 97 | * @param h_kb Height of kernel boxes, this should match the height of the expected input tensor 98 | * @param w_kb Width of the kernel boxes, this should match the width of the expected input tensor 99 | * 100 | * @return A pointer to the newly created dense layer 101 | */ 102 | DenseLayer *empty_Dense(int n_kb, int d_kb, int h_kb, int w_kb){ 103 | DenseLayer *dense_layer_pointer; 104 | dense_layer_pointer = malloc(sizeof(DenseLayer)); //dense_layer_pointer: Dense Layer Pointer 105 | if(dense_layer_pointer==NULL){ 106 | fprintf(stderr, "Error: Unable to allocate memory to dense_layer_pointer in new_Dense."); 107 | exit(EXIT_FAILURE); 108 | } 109 | 110 | dense_layer_pointer->n_kb = n_kb; 111 | dense_layer_pointer->kernel_box_dims[0]=d_kb; 112 | dense_layer_pointer->kernel_box_dims[1]=h_kb; 113 | dense_layer_pointer->kernel_box_dims[2]=w_kb; 114 | 115 | dense_layer_pointer->kernel_box_group = alloc_4D(n_kb, d_kb, h_kb, w_kb); 116 | dense_layer_pointer->bias_array = malloc(n_kb*sizeof(float)); 117 | 118 | return dense_layer_pointer; 119 | } 120 | 121 | 122 | /** @ingroup layergenerators 123 | * Creates a dense layer with the given weights and returns a pointer to it. 124 | * 125 | * @param n_kb Number of kernel boxes aka number of output neurons for dense layers 126 | * @param d_kb Depth of kernel boxes, this should match the depth of the expected input tensor 127 | * @param h_kb Height of kernel boxes, this should match the height of the expected input tensor 128 | * @param w_kb Width of the kernel boxes, this should match the width of the expected input tensor 129 | * @param weights_array A 4D float array of dimensions (n_kb * d_kb * h_kb * w_kb) containing the kernel weights 130 | * @param biases_array A float array of length n_kb conraining the biases 131 | * 132 | * @sa empty_Dense() 133 | * 134 | * @return A pointer to the newly created dense layer 135 | */ 136 | DenseLayer *new_Dense(int n_kb, int d_kb, int h_kb, int w_kb, float **** weights_array, float * biases_array){ 137 | DenseLayer *dense_layer_pointer; 138 | dense_layer_pointer = malloc(sizeof(DenseLayer)); //dense_layer_pointer: Dense Layer Pointer 139 | if(dense_layer_pointer==NULL){ 140 | fprintf(stderr, "Error: Unable to allocate memory to dense_layer_pointer in new_Dense."); 141 | exit(EXIT_FAILURE); 142 | } 143 | 144 | dense_layer_pointer->n_kb = n_kb; 145 | dense_layer_pointer->kernel_box_dims[0]=d_kb; 146 | dense_layer_pointer->kernel_box_dims[1]=h_kb; 147 | dense_layer_pointer->kernel_box_dims[2]=w_kb; 148 | 149 | dense_layer_pointer->kernel_box_group = weights_array; 150 | dense_layer_pointer->bias_array = biases_array; 151 | 152 | return dense_layer_pointer; 153 | } 154 | 155 | 156 | /** @ingroup tensoroperations 157 | * @brief Does a convolution operation 158 | * @details Takes the given tensor through the given convolution layer before applying the given activation function 159 | * 160 | * @param input Input tensor 161 | * @param layer The convolution layer 162 | * @param activation A function pointer to the activation function 163 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 164 | * 165 | * @sa Dense() 166 | * 167 | * @return The output tensor 168 | */ 169 | Tensor *Conv(Tensor *input, ConvLayer *layer, Tensor *(*activation)(Tensor *,int), int free_input){ 170 | if(input->dims[0]!=layer->kernel_box_dims[0]){ 171 | fprintf(stderr, "Error: The depth of the kernel boxes in this layer(%d) and that of its input tensor(%d) must match", layer->kernel_box_dims[0], input->dims[0]); 172 | exit(EXIT_FAILURE); 173 | } 174 | 175 | if(layer->padding==SAME){ 176 | int padding_x, padding_y; 177 | padding_x = layer->stride_x * (input->dims[2]-1) - input->dims[2] + layer->kernel_box_dims[2]; // left + right 178 | padding_y = layer->stride_y * (input->dims[1]-1) - input->dims[1] + layer->kernel_box_dims[1]; // top + bottom 179 | input = apply_padding(input, padding_x, padding_y, free_input); 180 | free_input = 1; // if the padding operation makes 'input' point to a copy of the original input then freeing 'input' is safe 181 | } 182 | 183 | int output_d = layer->n_kb; 184 | int output_w, output_h; 185 | 186 | // The padding terms in the formulas are omitted because the input tensor at this point has already been padded 187 | // And its dimensions have been updated accordingly 188 | output_h = ((input->dims[1] /*+ 2*layer->padding */ - layer->kernel_box_dims[1])/layer->stride_y)+1; 189 | output_w = ((input->dims[2] /*+ 2*layer->padding */ - layer->kernel_box_dims[2])/layer->stride_x)+1; 190 | 191 | float ***output_array = alloc_3D(output_d,output_h,output_w); 192 | 193 | int d,h,w,id,by,bx,i,j; 194 | 195 | // This thing goes over the output array and calculates each cell's value one by one 196 | for(d=0; ddims[0]; id++){ //input depth 201 | by = h*layer->stride_y; //"begin y" defines where the top edge of the kernel window is on the input layer 202 | bx = w*layer->stride_x; //"begin x" defines where the left edge of the kernel window is on the input layer 203 | for(i=0; i<(layer->kernel_box_dims[1]); i++){ //traverses the height of kernel window 204 | for(j=0; j<(layer->kernel_box_dims[2]); j++){ //traverses the width of kernel window 205 | output_array[d][h][w] += input->T[id][by+i][bx+j] * layer->kernel_box_group[d][id][i][j]; 206 | } 207 | } 208 | } 209 | 210 | //Add the bias 211 | output_array[d][h][w] += layer->bias_array[d]; 212 | } 213 | } 214 | } 215 | 216 | if(free_input) free_tensor(input); 217 | 218 | Tensor *output; 219 | output = make_tensor(output_d, output_h, output_w, output_array); 220 | 221 | return activation(output, 1); 222 | } 223 | 224 | 225 | /** @ingroup tensoroperations 226 | * @brief Does a dense operation 227 | * @details Takes the given tensor through the given dense layer before applying the given activation function 228 | * 229 | * @param input Input tensor 230 | * @param layer The dense layer 231 | * @param activation A function pointer to the activation function 232 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 233 | * 234 | * @sa Conv() 235 | * 236 | * @return The output tensor 237 | */ 238 | Tensor *Dense(Tensor *input, DenseLayer *layer, Tensor *(*activation)(Tensor *,int), int free_input){ 239 | if(input->dims[0]!=layer->kernel_box_dims[0] || input->dims[1]!=layer->kernel_box_dims[1] || input->dims[2]!=layer->kernel_box_dims[2]){ 240 | fprintf(stderr,"Error: The dimensions of the kernel boxes of the Dense layer must exactly match those of the input tensor.\n"); 241 | fprintf(stderr,"input has d:%d h:%d w:%d | kernel boxes have d:%d h:%d w:%d", input->dims[0], input->dims[1], input->dims[2], layer->kernel_box_dims[0], layer->kernel_box_dims[1], layer->kernel_box_dims[2]); 242 | exit(EXIT_FAILURE); 243 | } 244 | 245 | int output_d = layer->n_kb; 246 | int output_w =1, output_h = 1; 247 | 248 | float ***output_array = alloc_3D(output_d,output_h,output_w); 249 | 250 | int d,h,w,id,i,j; 251 | float result; 252 | 253 | // This thing goes over the output array and calculates each cell's value one by one 254 | for(d=0; ddims[0]; id++){ //input depth, usually 1 for Dense layers as they are usually preceded by a Flattening operation 259 | for(i=0; ikernel_box_dims[1]; i++){ //traverses the height of kernel window 260 | for(j=0; jkernel_box_dims[2]; j++){ //traverses the width of kernel window 261 | output_array[d][h][w] += input->T[id][i][j] * layer->kernel_box_group[d][id][i][j]; 262 | } //here by and bx are both 0 and they never change as the kernel dimensions are equal to the input tensor layer dimensions 263 | } 264 | } 265 | 266 | //Add the bias 267 | output_array[d][h][w] += layer->bias_array[d]; 268 | } 269 | } 270 | } 271 | 272 | if(free_input) free_tensor(input); 273 | 274 | Tensor *output; 275 | output = make_tensor(output_d, output_h, output_w, output_array); 276 | 277 | return activation(output, 1); 278 | } 279 | 280 | 281 | /** @ingroup tensoroperations 282 | * Carries out the sigmoid activation 283 | * 284 | * @param input Input tensor 285 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 286 | * 287 | * @sa linear_activation(), ReLU_activation(), ELU_activation() 288 | * 289 | * @return The output tensor 290 | */ 291 | Tensor *sigmoid_activation(Tensor *input, int free_input){ 292 | Tensor *output; 293 | int d,h,w; 294 | 295 | if(free_input){ 296 | output = input; 297 | } else { 298 | float ***output_array = alloc_3D(input->dims[0], input->dims[1], input->dims[2]); 299 | output = make_tensor(input->dims[0], input->dims[1], input->dims[2], output_array); 300 | } 301 | 302 | for(d=0; ddims[0]; d++){ 303 | for(h=0; hdims[1]; h++){ 304 | for(w=0; wdims[2]; w++){ 305 | output->T[d][h][w] = ((float) (1/(1+exp((double) -1*(input->T[d][h][w]))))); 306 | } 307 | } 308 | } 309 | 310 | return output; 311 | } 312 | 313 | 314 | /** @ingroup tensoroperations 315 | * Carries out the ReLU activation 316 | * 317 | * @param input Input tensor 318 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 319 | * 320 | * @sa sigmoid_activation(), linear_activation(), ELU_activation() 321 | * 322 | * @return The output tensor 323 | */ 324 | Tensor *ReLU_activation(Tensor *input, int free_input){ 325 | Tensor *output; 326 | int d,h,w; 327 | 328 | if(free_input){ 329 | output = input; 330 | } else { 331 | float ***output_array = alloc_3D(input->dims[0], input->dims[1], input->dims[2]); 332 | output = make_tensor(input->dims[0], input->dims[1], input->dims[2], output_array); 333 | } 334 | 335 | for(d=0; ddims[0]; d++){ 336 | for(h=0; hdims[1]; h++){ 337 | for(w=0; wdims[2]; w++){ 338 | output->T[d][h][w] = (input->T[d][h][w] < 0) ? 0 : input->T[d][h][w]; 339 | } 340 | } 341 | } 342 | 343 | return output; 344 | } 345 | 346 | /** @ingroup tensoroperations 347 | * Carries out the ELU activation 348 | * 349 | * @param input Input tensor 350 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 351 | * 352 | * @sa sigmoid_activation(), linear_activation(), ReLU_activation() 353 | * 354 | * @return The output tensor 355 | */ 356 | Tensor *ELU_activation(Tensor *input, int free_input){ 357 | Tensor *output; 358 | int d,h,w; 359 | 360 | if(free_input){ 361 | output = input; 362 | } else { 363 | float ***output_array = alloc_3D(input->dims[0], input->dims[1], input->dims[2]); 364 | output = make_tensor(input->dims[0], input->dims[1], input->dims[2], output_array); 365 | } 366 | 367 | for(d=0; ddims[0]; d++){ 368 | for(h=0; hdims[1]; h++){ 369 | for(w=0; wdims[2]; w++){ 370 | output->T[d][h][w] = (input->T[d][h][w] < 0) ? ((float) exp(input->T[d][h][w])-1) : input->T[d][h][w]; 371 | } 372 | } 373 | } 374 | 375 | return output; 376 | } 377 | 378 | 379 | /** @ingroup tensoroperations 380 | * Carries out the linear activation 381 | * 382 | * @param input Input tensor 383 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 384 | * 385 | * @sa sigmoid_activation(), ReLU_activation(), ELU_activation() 386 | * 387 | * @return The output tensor 388 | */ 389 | Tensor *linear_activation(Tensor *input, int free_input){ 390 | if(free_input) 391 | return input; 392 | 393 | Tensor *output; 394 | int d,h,w; 395 | 396 | float ***output_array = alloc_3D(input->dims[0], input->dims[1], input->dims[2]); 397 | output = make_tensor(input->dims[0], input->dims[1], input->dims[2], output_array); 398 | 399 | 400 | for(d=0; ddims[0]; d++){ 401 | for(h=0; hdims[1]; h++){ 402 | for(w=0; wdims[2]; w++){ 403 | output->T[d][h][w] = input->T[d][h][w]; 404 | } 405 | } 406 | } 407 | 408 | return output; 409 | } 410 | 411 | 412 | /** @ingroup tensoroperations 413 | * Applies padding to the input tensor. 414 | * 415 | * If SAME padding is desired but due to the operation parameters symmetric padding is not possible, 416 | * then this function will follow the tensorflow backend implementation and the bottom and the 417 | * right side of the tensor will get the additional padding. 418 | * 419 | * @param input Input tensor 420 | * @param padding_x Padding to the left + Padding to the right in pixels 421 | * @param padding_x Padding to the top + Padding to the bottom in pixels 422 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 423 | * 424 | * @sa padding_mode 425 | * 426 | * @return The output tensor 427 | */ 428 | Tensor *apply_padding(Tensor *input, int padding_x, int padding_y, int free_input){ 429 | int output_d = input->dims[0]; 430 | int output_h = input->dims[1] + padding_y; 431 | int output_w = input->dims[2] + padding_x; 432 | 433 | float ***output_array = alloc_3D(output_d,output_h,output_w); 434 | 435 | int d,x,y, squeeze_along_x, squeeze_along_y; 436 | 437 | for(d=0; dT[d][y-(padding_y/2)][x-(padding_x/2)]; 472 | } 473 | } 474 | } 475 | 476 | Tensor *output; 477 | output = make_tensor(output_d, output_h, output_w, output_array); 478 | 479 | if(free_input) free_tensor(input); 480 | 481 | return output; 482 | } 483 | 484 | 485 | 486 | /** @ingroup tensoroperations 487 | * Executes max pooling on the given input tensor 488 | * 489 | * @param input Input tensor 490 | * @param height Height of the pooling window 491 | * @param width Width of the pooling window 492 | * @param stride_x Stride of kernel window on the x axis(horizontal) 493 | * @param stride_y Stride of kernel window on the y axis(vertical) 494 | * @param padding Option from padding_mode (VALID or SAME). VALID means no padding will be done, 495 | * SAME means the input tensor will be padded in such a way that the output of the following pooling operation will 496 | * have the same height and width as the input tensor. 497 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 498 | * 499 | * @return The output tensor 500 | */ 501 | Tensor *MaxPool(Tensor *input, int height, int width, int stride_x, int stride_y, padding_mode padding, int free_input){ 502 | if(padding==SAME){ 503 | int padding_x, padding_y; 504 | padding_x = stride_x * (input->dims[2]-1) - input->dims[2] + width; // left + right 505 | padding_y = stride_y * (input->dims[1]-1) - input->dims[1] + height; // top + bottom 506 | input = apply_padding(input, padding_x, padding_y, free_input); 507 | free_input = 1; // if the padding operation makes 'input' point to a copy of the original input then freeing 'input' is safe 508 | } 509 | 510 | int output_d = input->dims[0]; 511 | int output_w, output_h; 512 | output_w = ((input->dims[1] - height)/stride_x)+1; // The same formula from the Conv layer 513 | output_h = ((input->dims[1] - height)/stride_y)+1; // The same formula from the Conv layer 514 | 515 | float ***output_array = alloc_3D(output_d,output_h,output_w); 516 | 517 | int d,h,w,i,j,by,bx; 518 | float max; 519 | 520 | // This thing goes over the output array and calculates each cell's value one by one 521 | for(d=0; dT[d][by][bx]; 527 | for(i=0; iT[d][by+i][bx+j])>max){ 530 | max = input->T[d][by+i][bx+j]; 531 | } 532 | } 533 | } 534 | output_array[d][h][w] = max; 535 | } 536 | } 537 | } 538 | 539 | Tensor *output; 540 | output = make_tensor(output_d, output_h, output_w, output_array); 541 | 542 | if(free_input) free_tensor(input); 543 | 544 | return output; 545 | } 546 | 547 | 548 | /** @ingroup tensoroperations 549 | * Flattens the input tensor into its width such that the output depth and height are 1. 550 | * 551 | * @param input Input tensor 552 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 553 | * 554 | * @sa FlattenH(), FlattenD() 555 | * 556 | * @return The output tensor 557 | */ 558 | Tensor *FlattenW(Tensor *input, int free_input){ 559 | int input_d = input->dims[0], input_h = input->dims[1], input_w = input->dims[2]; 560 | 561 | int output_d = 1, output_h = 1; 562 | int output_w = input_d*input_h*input_w; 563 | 564 | float ***output_array = alloc_3D(output_d,output_h,output_w); 565 | 566 | int w; 567 | 568 | for(w=0; wT[w/(input_h*input_w)][(w/input_w)%input_h][w%input_w]; 570 | } 571 | 572 | Tensor *output; 573 | output = make_tensor(output_d, output_h, output_w, output_array); 574 | 575 | if(free_input) free_tensor(input); 576 | 577 | return output; 578 | } 579 | 580 | 581 | /** @ingroup tensoroperations 582 | * Flattens the input tensor into its height such that the output depth and width are 1. 583 | * 584 | * @param input Input tensor 585 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 586 | * 587 | * @sa FlattenW(), FlattenD() 588 | * 589 | * @return The output tensor 590 | */ 591 | Tensor *FlattenH(Tensor *input, int free_input){ 592 | int input_d = input->dims[0], input_h = input->dims[1], input_w = input->dims[2]; 593 | 594 | int output_d = 1, output_w = 1; 595 | int output_h = input_d*input_h*input_w; 596 | 597 | float ***output_array = alloc_3D(output_d,output_h,output_w); 598 | 599 | int h; 600 | 601 | for(h=0; hT[h/(input_h*input_w)][(h/input_w)%input_h][h%input_w]; 603 | } 604 | 605 | Tensor *output; 606 | output = make_tensor(output_d, output_h, output_w, output_array); 607 | 608 | if(free_input) free_tensor(input); 609 | 610 | return output; 611 | } 612 | 613 | 614 | /** @ingroup tensoroperations 615 | * Flattens the input tensor into its depth such that the output height and width are 1. 616 | * 617 | * @param input Input tensor 618 | * @param free_input Whether to free or overwrite the input tensor, if free_input==1 then the input tensor is lost 619 | * 620 | * @sa FlattenW(), FlattenH() 621 | * 622 | * @return The output tensor 623 | */ 624 | Tensor *FlattenD(Tensor *input, int free_input){ 625 | int input_d = input->dims[0], input_h = input->dims[1], input_w = input->dims[2]; 626 | 627 | int output_w = 1, output_h = 1; 628 | int output_d = input_d*input_h*input_w; 629 | 630 | float ***output_array = alloc_3D(output_d,output_h,output_w); 631 | 632 | int d; 633 | 634 | for(d=0; dT[d/(input_h*input_w)][(d/input_w)%input_h][d%input_w]; 636 | } 637 | 638 | Tensor *output; 639 | output = make_tensor(output_d, output_h, output_w, output_array); 640 | 641 | if(free_input) free_tensor(input); 642 | 643 | return output; 644 | } 645 | 646 | 647 | /** @ingroup tensoroperations 648 | * Does an element-wise summation of the tensors in the array. 649 | * 650 | * @param input_tensors Array of tensors 651 | * @param n_tensors Number of tensors in the array 652 | * @param free_inputs Whether to free or overwrite the input tensors, if free_inputs==0 then the input tensors are lost 653 | * 654 | * @sa Average() 655 | * 656 | * @return The output tensor 657 | */ 658 | Tensor *Add(Tensor **input_tensors, int n_tensors, int free_inputs){ 659 | int i,j; 660 | for(i=1; idims[j] != input_tensors[i]->dims[j]){ 663 | fprintf(stderr, "Error: The input layers to Add() must have the same dimensions.\n"); 664 | fprintf(stderr, "input_tensor_%d has dim_%d=%d | input_tensor_%d has dim_%d=%d", i-1, j, input_tensors[i-1]->dims[j], i, j, input_tensors[i]->dims[j]); 665 | exit(EXIT_FAILURE); 666 | } 667 | } 668 | } 669 | 670 | Tensor *output; 671 | int d,h,w; 672 | float ***output_array = alloc_3D(input_tensors[0]->dims[0], input_tensors[0]->dims[1], input_tensors[0]->dims[2]); 673 | output = make_tensor(input_tensors[0]->dims[0], input_tensors[0]->dims[1], input_tensors[0]->dims[2], output_array); 674 | 675 | for(d=0; ddims[0]; d++){ 676 | for(h=0; hdims[1]; h++){ 677 | for(w=0; wdims[2]; w++){ 678 | output->T[d][h][w] = 0; 679 | for(i=0; iT[d][h][w] += input_tensors[i]->T[d][h][w]; 681 | } 682 | } 683 | } 684 | } 685 | 686 | if(free_inputs){ 687 | for(i=0; idims[j] != input_tensors[i]->dims[j]){ 714 | fprintf(stderr, "Error: The input layers to Average() must have the same dimensions.\n"); 715 | fprintf(stderr, "input_tensor_%d has dim_%d=%d | input_tensor_%d has dim_%d=%d", i-1, j, input_tensors[i-1]->dims[j], i, j, input_tensors[i]->dims[j]); 716 | exit(EXIT_FAILURE); 717 | } 718 | } 719 | } 720 | 721 | Tensor *output; 722 | int d,h,w; 723 | float ***output_array = alloc_3D(input_tensors[0]->dims[0], input_tensors[0]->dims[1], input_tensors[0]->dims[2]); 724 | output = make_tensor(input_tensors[0]->dims[0], input_tensors[0]->dims[1], input_tensors[0]->dims[2], output_array); 725 | 726 | for(d=0; ddims[0]; d++){ 727 | for(h=0; hdims[1]; h++){ 728 | for(w=0; wdims[2]; w++){ 729 | output->T[d][h][w] = 0; 730 | for(i=0; iT[d][h][w] += input_tensors[i]->T[d][h][w]; 732 | } 733 | output->T[d][h][w] /= n_tensors; 734 | } 735 | } 736 | } 737 | 738 | if(free_inputs){ 739 | for(i=0; idims[0]; i++){ 756 | printf("\nLayer %d:\n\n", i); 757 | for(j=0; jdims[1]; j++){ 758 | for(k=0; kdims[2]; k++){ 759 | printf("%f ", t->T[i][j][k]); 760 | } 761 | printf("\n"); 762 | } 763 | printf("\n\n"); 764 | } 765 | } 766 | 767 | /** @ingroup utilityfunctions 768 | * Allocates memory for a 4D float array with dimensions (b * d * h * w) and returns the pointer. 769 | * 770 | * @param b Dimension 0, size of float *** array 771 | * @param d Dimension 1, size of float ** array 772 | * @param h Dimension 2, size of float * array 773 | * @param w Dimension 3, size of float array 774 | * 775 | * @sa alloc_3D 776 | * 777 | * @return The pointer to the allocated memory 778 | */ 779 | float ****alloc_4D(int b, int d, int h, int w){ 780 | float **** new; 781 | new = malloc(b*sizeof(float***)); 782 | if(new==NULL){ 783 | fprintf(stderr, "Error: Unable to allocate memory to new in alloc_4D."); 784 | exit(EXIT_FAILURE); 785 | } 786 | 787 | int i,j,k; 788 | for(i=0; idims[0]; d++){ 888 | for(h=0; hdims[1]; h++){ 889 | free(t->T[d][h]); 890 | } 891 | free(t->T[d]); 892 | } 893 | free(t->dims); 894 | free(t); 895 | } 896 | 897 | 898 | /** @ingroup utilityfunctions 899 | * Creates and configures a new tensor of dimensions (d * h * w) 900 | * 901 | * @param d Depth of tensor 902 | * @param h Height of tensor 903 | * @param w Width of tensor 904 | * @param array The 3D float array with dimensions (d * h * w) from which the tensor is going to be built 905 | * 906 | * @return The newly created tensor 907 | */ 908 | Tensor *make_tensor(int d, int h, int w, float ***array){ 909 | Tensor *new_tensor; 910 | new_tensor = malloc(sizeof(Tensor)); 911 | new_tensor->T = array; 912 | new_tensor->dims[0] = d; 913 | new_tensor->dims[1] = h; 914 | new_tensor->dims[2] = w; 915 | 916 | return new_tensor; 917 | } 918 | 919 | /** @ingroup utilityfunctions 920 | * Frees memory space allocated to the given Convolution Layer 921 | * 922 | * @param layer Convolution Layer to be freed 923 | */ 924 | void free_ConvLayer(ConvLayer *layer){ 925 | int n,d,h; 926 | for(n=0; nn_kb; n++){ 927 | for(d=0; dkernel_box_dims[0]; d++){ 928 | for(h=0; hkernel_box_dims[1]; h++){ 929 | free(layer->kernel_box_group[n][d][h]); 930 | } 931 | free(layer->kernel_box_group[n][d]); 932 | } 933 | free(layer->kernel_box_group[n]); 934 | } 935 | free(layer->kernel_box_group); 936 | free(layer->bias_array); 937 | free(layer->kernel_box_dims); 938 | free(layer); 939 | } 940 | 941 | /** @ingroup utilityfunctions 942 | * Frees memory space allocated to the given Dense Layer 943 | * 944 | * @param layer Dense Layer to be freed 945 | */ 946 | void free_DenseLayer(DenseLayer *layer){ 947 | int n,d,h; 948 | for(n=0; nn_kb; n++){ 949 | for(d=0; dkernel_box_dims[0]; d++){ 950 | for(h=0; hkernel_box_dims[1]; h++){ 951 | free(layer->kernel_box_group[n][d][h]); 952 | } 953 | free(layer->kernel_box_group[n][d]); 954 | } 955 | free(layer->kernel_box_group[n]); 956 | } 957 | free(layer->kernel_box_group); 958 | free(layer->bias_array); 959 | free(layer->kernel_box_dims); 960 | free(layer); 961 | } -------------------------------------------------------------------------------- /Doxyfile: -------------------------------------------------------------------------------- 1 | # Doxyfile 1.8.16 2 | 3 | # This file describes the settings to be used by the documentation system 4 | # doxygen (www.doxygen.org) for a project. 5 | # 6 | # All text after a double hash (##) is considered a comment and is placed in 7 | # front of the TAG it is preceding. 8 | # 9 | # All text after a single hash (#) is considered a comment and will be ignored. 10 | # The format is: 11 | # TAG = value [value, ...] 12 | # For lists, items can also be appended using: 13 | # TAG += value [value, ...] 14 | # Values that contain spaces should be placed between quotes (\" \"). 15 | 16 | #--------------------------------------------------------------------------- 17 | # Project related configuration options 18 | #--------------------------------------------------------------------------- 19 | 20 | # This tag specifies the encoding used for all characters in the configuration 21 | # file that follow. The default is UTF-8 which is also the encoding used for all 22 | # text before the first occurrence of this tag. Doxygen uses libiconv (or the 23 | # iconv built into libc) for the transcoding. See 24 | # https://www.gnu.org/software/libiconv/ for the list of possible encodings. 25 | # The default value is: UTF-8. 26 | 27 | DOXYFILE_ENCODING = UTF-8 28 | 29 | # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by 30 | # double-quotes, unless you are using Doxywizard) that should identify the 31 | # project for which the documentation is generated. This name is used in the 32 | # title of most generated pages and in a few other places. 33 | # The default value is: My Project. 34 | 35 | PROJECT_NAME = "CNN-Inference-Didactic" 36 | 37 | # The PROJECT_NUMBER tag can be used to enter a project or revision number. This 38 | # could be handy for archiving the generated documentation or if some version 39 | # control system is used. 40 | 41 | PROJECT_NUMBER = 42 | 43 | # Using the PROJECT_BRIEF tag one can provide an optional one line description 44 | # for a project that appears at the top of each page and should give viewer a 45 | # quick idea about the purpose of the project. Keep the description short. 46 | 47 | PROJECT_BRIEF = 48 | 49 | # With the PROJECT_LOGO tag one can specify a logo or an icon that is included 50 | # in the documentation. The maximum height of the logo should not exceed 55 51 | # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy 52 | # the logo to the output directory. 53 | 54 | PROJECT_LOGO = 55 | 56 | # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path 57 | # into which the generated documentation will be written. If a relative path is 58 | # entered, it will be relative to the location where doxygen was started. If 59 | # left blank the current directory will be used. 60 | 61 | OUTPUT_DIRECTORY = 62 | 63 | # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- 64 | # directories (in 2 levels) under the output directory of each output format and 65 | # will distribute the generated files over these directories. Enabling this 66 | # option can be useful when feeding doxygen a huge amount of source files, where 67 | # putting all generated files in the same directory would otherwise causes 68 | # performance problems for the file system. 69 | # The default value is: NO. 70 | 71 | CREATE_SUBDIRS = NO 72 | 73 | # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII 74 | # characters to appear in the names of generated files. If set to NO, non-ASCII 75 | # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode 76 | # U+3044. 77 | # The default value is: NO. 78 | 79 | ALLOW_UNICODE_NAMES = NO 80 | 81 | # The OUTPUT_LANGUAGE tag is used to specify the language in which all 82 | # documentation generated by doxygen is written. Doxygen will use this 83 | # information to generate all constant output in the proper language. 84 | # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, 85 | # Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), 86 | # Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, 87 | # Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), 88 | # Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, 89 | # Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, 90 | # Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, 91 | # Ukrainian and Vietnamese. 92 | # The default value is: English. 93 | 94 | OUTPUT_LANGUAGE = English 95 | 96 | # The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all 97 | # documentation generated by doxygen is written. Doxygen will use this 98 | # information to generate all generated output in the proper direction. 99 | # Possible values are: None, LTR, RTL and Context. 100 | # The default value is: None. 101 | 102 | OUTPUT_TEXT_DIRECTION = None 103 | 104 | # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member 105 | # descriptions after the members that are listed in the file and class 106 | # documentation (similar to Javadoc). Set to NO to disable this. 107 | # The default value is: YES. 108 | 109 | BRIEF_MEMBER_DESC = YES 110 | 111 | # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief 112 | # description of a member or function before the detailed description 113 | # 114 | # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 115 | # brief descriptions will be completely suppressed. 116 | # The default value is: YES. 117 | 118 | REPEAT_BRIEF = YES 119 | 120 | # This tag implements a quasi-intelligent brief description abbreviator that is 121 | # used to form the text in various listings. Each string in this list, if found 122 | # as the leading text of the brief description, will be stripped from the text 123 | # and the result, after processing the whole list, is used as the annotated 124 | # text. Otherwise, the brief description is used as-is. If left blank, the 125 | # following values are used ($name is automatically replaced with the name of 126 | # the entity):The $name class, The $name widget, The $name file, is, provides, 127 | # specifies, contains, represents, a, an and the. 128 | 129 | ABBREVIATE_BRIEF = "The $name class" \ 130 | "The $name widget" \ 131 | "The $name file" \ 132 | is \ 133 | provides \ 134 | specifies \ 135 | contains \ 136 | represents \ 137 | a \ 138 | an \ 139 | the 140 | 141 | # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 142 | # doxygen will generate a detailed section even if there is only a brief 143 | # description. 144 | # The default value is: NO. 145 | 146 | ALWAYS_DETAILED_SEC = NO 147 | 148 | # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 149 | # inherited members of a class in the documentation of that class as if those 150 | # members were ordinary class members. Constructors, destructors and assignment 151 | # operators of the base classes will not be shown. 152 | # The default value is: NO. 153 | 154 | INLINE_INHERITED_MEMB = NO 155 | 156 | # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path 157 | # before files name in the file list and in the header files. If set to NO the 158 | # shortest path that makes the file name unique will be used 159 | # The default value is: YES. 160 | 161 | FULL_PATH_NAMES = YES 162 | 163 | # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. 164 | # Stripping is only done if one of the specified strings matches the left-hand 165 | # part of the path. The tag can be used to show relative paths in the file list. 166 | # If left blank the directory from which doxygen is run is used as the path to 167 | # strip. 168 | # 169 | # Note that you can specify absolute paths here, but also relative paths, which 170 | # will be relative from the directory where doxygen is started. 171 | # This tag requires that the tag FULL_PATH_NAMES is set to YES. 172 | 173 | STRIP_FROM_PATH = 174 | 175 | # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the 176 | # path mentioned in the documentation of a class, which tells the reader which 177 | # header file to include in order to use a class. If left blank only the name of 178 | # the header file containing the class definition is used. Otherwise one should 179 | # specify the list of include paths that are normally passed to the compiler 180 | # using the -I flag. 181 | 182 | STRIP_FROM_INC_PATH = 183 | 184 | # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but 185 | # less readable) file names. This can be useful is your file systems doesn't 186 | # support long names like on DOS, Mac, or CD-ROM. 187 | # The default value is: NO. 188 | 189 | SHORT_NAMES = NO 190 | 191 | # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the 192 | # first line (until the first dot) of a Javadoc-style comment as the brief 193 | # description. If set to NO, the Javadoc-style will behave just like regular Qt- 194 | # style comments (thus requiring an explicit @brief command for a brief 195 | # description.) 196 | # The default value is: NO. 197 | 198 | JAVADOC_AUTOBRIEF = NO 199 | 200 | # If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line 201 | # such as 202 | # /*************** 203 | # as being the beginning of a Javadoc-style comment "banner". If set to NO, the 204 | # Javadoc-style will behave just like regular comments and it will not be 205 | # interpreted by doxygen. 206 | # The default value is: NO. 207 | 208 | JAVADOC_BANNER = NO 209 | 210 | # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first 211 | # line (until the first dot) of a Qt-style comment as the brief description. If 212 | # set to NO, the Qt-style will behave just like regular Qt-style comments (thus 213 | # requiring an explicit \brief command for a brief description.) 214 | # The default value is: NO. 215 | 216 | QT_AUTOBRIEF = NO 217 | 218 | # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a 219 | # multi-line C++ special comment block (i.e. a block of //! or /// comments) as 220 | # a brief description. This used to be the default behavior. The new default is 221 | # to treat a multi-line C++ comment block as a detailed description. Set this 222 | # tag to YES if you prefer the old behavior instead. 223 | # 224 | # Note that setting this tag to YES also means that rational rose comments are 225 | # not recognized any more. 226 | # The default value is: NO. 227 | 228 | MULTILINE_CPP_IS_BRIEF = NO 229 | 230 | # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the 231 | # documentation from any documented member that it re-implements. 232 | # The default value is: YES. 233 | 234 | INHERIT_DOCS = YES 235 | 236 | # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new 237 | # page for each member. If set to NO, the documentation of a member will be part 238 | # of the file/class/namespace that contains it. 239 | # The default value is: NO. 240 | 241 | SEPARATE_MEMBER_PAGES = NO 242 | 243 | # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen 244 | # uses this value to replace tabs by spaces in code fragments. 245 | # Minimum value: 1, maximum value: 16, default value: 4. 246 | 247 | TAB_SIZE = 4 248 | 249 | # This tag can be used to specify a number of aliases that act as commands in 250 | # the documentation. An alias has the form: 251 | # name=value 252 | # For example adding 253 | # "sideeffect=@par Side Effects:\n" 254 | # will allow you to put the command \sideeffect (or @sideeffect) in the 255 | # documentation, which will result in a user-defined paragraph with heading 256 | # "Side Effects:". You can put \n's in the value part of an alias to insert 257 | # newlines (in the resulting output). You can put ^^ in the value part of an 258 | # alias to insert a newline as if a physical newline was in the original file. 259 | # When you need a literal { or } or , in the value part of an alias you have to 260 | # escape them by means of a backslash (\), this can lead to conflicts with the 261 | # commands \{ and \} for these it is advised to use the version @{ and @} or use 262 | # a double escape (\\{ and \\}) 263 | 264 | ALIASES = 265 | 266 | # This tag can be used to specify a number of word-keyword mappings (TCL only). 267 | # A mapping has the form "name=value". For example adding "class=itcl::class" 268 | # will allow you to use the command class in the itcl::class meaning. 269 | 270 | TCL_SUBST = 271 | 272 | # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 273 | # only. Doxygen will then generate output that is more tailored for C. For 274 | # instance, some of the names that are used will be different. The list of all 275 | # members will be omitted, etc. 276 | # The default value is: NO. 277 | 278 | OPTIMIZE_OUTPUT_FOR_C = YES 279 | 280 | # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or 281 | # Python sources only. Doxygen will then generate output that is more tailored 282 | # for that language. For instance, namespaces will be presented as packages, 283 | # qualified scopes will look different, etc. 284 | # The default value is: NO. 285 | 286 | OPTIMIZE_OUTPUT_JAVA = NO 287 | 288 | # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 289 | # sources. Doxygen will then generate output that is tailored for Fortran. 290 | # The default value is: NO. 291 | 292 | OPTIMIZE_FOR_FORTRAN = NO 293 | 294 | # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 295 | # sources. Doxygen will then generate output that is tailored for VHDL. 296 | # The default value is: NO. 297 | 298 | OPTIMIZE_OUTPUT_VHDL = NO 299 | 300 | # Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice 301 | # sources only. Doxygen will then generate output that is more tailored for that 302 | # language. For instance, namespaces will be presented as modules, types will be 303 | # separated into more groups, etc. 304 | # The default value is: NO. 305 | 306 | OPTIMIZE_OUTPUT_SLICE = NO 307 | 308 | # Doxygen selects the parser to use depending on the extension of the files it 309 | # parses. With this tag you can assign which parser to use for a given 310 | # extension. Doxygen has a built-in mapping, but you can override or extend it 311 | # using this tag. The format is ext=language, where ext is a file extension, and 312 | # language is one of the parsers supported by doxygen: IDL, Java, Javascript, 313 | # Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, 314 | # Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: 315 | # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser 316 | # tries to guess whether the code is fixed or free formatted code, this is the 317 | # default for Fortran type files), VHDL, tcl. For instance to make doxygen treat 318 | # .inc files as Fortran files (default is PHP), and .f files as C (default is 319 | # Fortran), use: inc=Fortran f=C. 320 | # 321 | # Note: For files without extension you can use no_extension as a placeholder. 322 | # 323 | # Note that for custom extensions you also need to set FILE_PATTERNS otherwise 324 | # the files are not read by doxygen. 325 | 326 | EXTENSION_MAPPING = 327 | 328 | # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments 329 | # according to the Markdown format, which allows for more readable 330 | # documentation. See https://daringfireball.net/projects/markdown/ for details. 331 | # The output of markdown processing is further processed by doxygen, so you can 332 | # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in 333 | # case of backward compatibilities issues. 334 | # The default value is: YES. 335 | 336 | MARKDOWN_SUPPORT = YES 337 | 338 | # When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up 339 | # to that level are automatically included in the table of contents, even if 340 | # they do not have an id attribute. 341 | # Note: This feature currently applies only to Markdown headings. 342 | # Minimum value: 0, maximum value: 99, default value: 5. 343 | # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. 344 | 345 | TOC_INCLUDE_HEADINGS = 5 346 | 347 | # When enabled doxygen tries to link words that correspond to documented 348 | # classes, or namespaces to their corresponding documentation. Such a link can 349 | # be prevented in individual cases by putting a % sign in front of the word or 350 | # globally by setting AUTOLINK_SUPPORT to NO. 351 | # The default value is: YES. 352 | 353 | AUTOLINK_SUPPORT = YES 354 | 355 | # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 356 | # to include (a tag file for) the STL sources as input, then you should set this 357 | # tag to YES in order to let doxygen match functions declarations and 358 | # definitions whose arguments contain STL classes (e.g. func(std::string); 359 | # versus func(std::string) {}). This also make the inheritance and collaboration 360 | # diagrams that involve STL classes more complete and accurate. 361 | # The default value is: NO. 362 | 363 | BUILTIN_STL_SUPPORT = NO 364 | 365 | # If you use Microsoft's C++/CLI language, you should set this option to YES to 366 | # enable parsing support. 367 | # The default value is: NO. 368 | 369 | CPP_CLI_SUPPORT = NO 370 | 371 | # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: 372 | # https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen 373 | # will parse them like normal C++ but will assume all classes use public instead 374 | # of private inheritance when no explicit protection keyword is present. 375 | # The default value is: NO. 376 | 377 | SIP_SUPPORT = NO 378 | 379 | # For Microsoft's IDL there are propget and propput attributes to indicate 380 | # getter and setter methods for a property. Setting this option to YES will make 381 | # doxygen to replace the get and set methods by a property in the documentation. 382 | # This will only work if the methods are indeed getting or setting a simple 383 | # type. If this is not the case, or you want to show the methods anyway, you 384 | # should set this option to NO. 385 | # The default value is: YES. 386 | 387 | IDL_PROPERTY_SUPPORT = YES 388 | 389 | # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 390 | # tag is set to YES then doxygen will reuse the documentation of the first 391 | # member in the group (if any) for the other members of the group. By default 392 | # all members of a group must be documented explicitly. 393 | # The default value is: NO. 394 | 395 | DISTRIBUTE_GROUP_DOC = NO 396 | 397 | # If one adds a struct or class to a group and this option is enabled, then also 398 | # any nested class or struct is added to the same group. By default this option 399 | # is disabled and one has to add nested compounds explicitly via \ingroup. 400 | # The default value is: NO. 401 | 402 | GROUP_NESTED_COMPOUNDS = NO 403 | 404 | # Set the SUBGROUPING tag to YES to allow class member groups of the same type 405 | # (for instance a group of public functions) to be put as a subgroup of that 406 | # type (e.g. under the Public Functions section). Set it to NO to prevent 407 | # subgrouping. Alternatively, this can be done per class using the 408 | # \nosubgrouping command. 409 | # The default value is: YES. 410 | 411 | SUBGROUPING = YES 412 | 413 | # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions 414 | # are shown inside the group in which they are included (e.g. using \ingroup) 415 | # instead of on a separate page (for HTML and Man pages) or section (for LaTeX 416 | # and RTF). 417 | # 418 | # Note that this feature does not work in combination with 419 | # SEPARATE_MEMBER_PAGES. 420 | # The default value is: NO. 421 | 422 | INLINE_GROUPED_CLASSES = NO 423 | 424 | # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions 425 | # with only public data fields or simple typedef fields will be shown inline in 426 | # the documentation of the scope in which they are defined (i.e. file, 427 | # namespace, or group documentation), provided this scope is documented. If set 428 | # to NO, structs, classes, and unions are shown on a separate page (for HTML and 429 | # Man pages) or section (for LaTeX and RTF). 430 | # The default value is: NO. 431 | 432 | INLINE_SIMPLE_STRUCTS = NO 433 | 434 | # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or 435 | # enum is documented as struct, union, or enum with the name of the typedef. So 436 | # typedef struct TypeS {} TypeT, will appear in the documentation as a struct 437 | # with name TypeT. When disabled the typedef will appear as a member of a file, 438 | # namespace, or class. And the struct will be named TypeS. This can typically be 439 | # useful for C code in case the coding convention dictates that all compound 440 | # types are typedef'ed and only the typedef is referenced, never the tag name. 441 | # The default value is: NO. 442 | 443 | TYPEDEF_HIDES_STRUCT = NO 444 | 445 | # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This 446 | # cache is used to resolve symbols given their name and scope. Since this can be 447 | # an expensive process and often the same symbol appears multiple times in the 448 | # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small 449 | # doxygen will become slower. If the cache is too large, memory is wasted. The 450 | # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range 451 | # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 452 | # symbols. At the end of a run doxygen will report the cache usage and suggest 453 | # the optimal cache size from a speed point of view. 454 | # Minimum value: 0, maximum value: 9, default value: 0. 455 | 456 | LOOKUP_CACHE_SIZE = 0 457 | 458 | #--------------------------------------------------------------------------- 459 | # Build related configuration options 460 | #--------------------------------------------------------------------------- 461 | 462 | # If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in 463 | # documentation are documented, even if no documentation was available. Private 464 | # class members and static file members will be hidden unless the 465 | # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. 466 | # Note: This will also disable the warnings about undocumented members that are 467 | # normally produced when WARNINGS is set to YES. 468 | # The default value is: NO. 469 | 470 | EXTRACT_ALL = NO 471 | 472 | # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will 473 | # be included in the documentation. 474 | # The default value is: NO. 475 | 476 | EXTRACT_PRIVATE = NO 477 | 478 | # If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual 479 | # methods of a class will be included in the documentation. 480 | # The default value is: NO. 481 | 482 | EXTRACT_PRIV_VIRTUAL = NO 483 | 484 | # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal 485 | # scope will be included in the documentation. 486 | # The default value is: NO. 487 | 488 | EXTRACT_PACKAGE = NO 489 | 490 | # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be 491 | # included in the documentation. 492 | # The default value is: NO. 493 | 494 | EXTRACT_STATIC = NO 495 | 496 | # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined 497 | # locally in source files will be included in the documentation. If set to NO, 498 | # only classes defined in header files are included. Does not have any effect 499 | # for Java sources. 500 | # The default value is: YES. 501 | 502 | EXTRACT_LOCAL_CLASSES = YES 503 | 504 | # This flag is only useful for Objective-C code. If set to YES, local methods, 505 | # which are defined in the implementation section but not in the interface are 506 | # included in the documentation. If set to NO, only methods in the interface are 507 | # included. 508 | # The default value is: NO. 509 | 510 | EXTRACT_LOCAL_METHODS = NO 511 | 512 | # If this flag is set to YES, the members of anonymous namespaces will be 513 | # extracted and appear in the documentation as a namespace called 514 | # 'anonymous_namespace{file}', where file will be replaced with the base name of 515 | # the file that contains the anonymous namespace. By default anonymous namespace 516 | # are hidden. 517 | # The default value is: NO. 518 | 519 | EXTRACT_ANON_NSPACES = NO 520 | 521 | # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all 522 | # undocumented members inside documented classes or files. If set to NO these 523 | # members will be included in the various overviews, but no documentation 524 | # section is generated. This option has no effect if EXTRACT_ALL is enabled. 525 | # The default value is: NO. 526 | 527 | HIDE_UNDOC_MEMBERS = NO 528 | 529 | # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all 530 | # undocumented classes that are normally visible in the class hierarchy. If set 531 | # to NO, these classes will be included in the various overviews. This option 532 | # has no effect if EXTRACT_ALL is enabled. 533 | # The default value is: NO. 534 | 535 | HIDE_UNDOC_CLASSES = NO 536 | 537 | # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend 538 | # (class|struct|union) declarations. If set to NO, these declarations will be 539 | # included in the documentation. 540 | # The default value is: NO. 541 | 542 | HIDE_FRIEND_COMPOUNDS = NO 543 | 544 | # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any 545 | # documentation blocks found inside the body of a function. If set to NO, these 546 | # blocks will be appended to the function's detailed documentation block. 547 | # The default value is: NO. 548 | 549 | HIDE_IN_BODY_DOCS = NO 550 | 551 | # The INTERNAL_DOCS tag determines if documentation that is typed after a 552 | # \internal command is included. If the tag is set to NO then the documentation 553 | # will be excluded. Set it to YES to include the internal documentation. 554 | # The default value is: NO. 555 | 556 | INTERNAL_DOCS = NO 557 | 558 | # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file 559 | # names in lower-case letters. If set to YES, upper-case letters are also 560 | # allowed. This is useful if you have classes or files whose names only differ 561 | # in case and if your file system supports case sensitive file names. Windows 562 | # (including Cygwin) ands Mac users are advised to set this option to NO. 563 | # The default value is: system dependent. 564 | 565 | CASE_SENSE_NAMES = NO 566 | 567 | # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with 568 | # their full class and namespace scopes in the documentation. If set to YES, the 569 | # scope will be hidden. 570 | # The default value is: NO. 571 | 572 | HIDE_SCOPE_NAMES = NO 573 | 574 | # If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will 575 | # append additional text to a page's title, such as Class Reference. If set to 576 | # YES the compound reference will be hidden. 577 | # The default value is: NO. 578 | 579 | HIDE_COMPOUND_REFERENCE= NO 580 | 581 | # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of 582 | # the files that are included by a file in the documentation of that file. 583 | # The default value is: YES. 584 | 585 | SHOW_INCLUDE_FILES = YES 586 | 587 | # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each 588 | # grouped member an include statement to the documentation, telling the reader 589 | # which file to include in order to use the member. 590 | # The default value is: NO. 591 | 592 | SHOW_GROUPED_MEMB_INC = NO 593 | 594 | # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include 595 | # files with double quotes in the documentation rather than with sharp brackets. 596 | # The default value is: NO. 597 | 598 | FORCE_LOCAL_INCLUDES = NO 599 | 600 | # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the 601 | # documentation for inline members. 602 | # The default value is: YES. 603 | 604 | INLINE_INFO = YES 605 | 606 | # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the 607 | # (detailed) documentation of file and class members alphabetically by member 608 | # name. If set to NO, the members will appear in declaration order. 609 | # The default value is: YES. 610 | 611 | SORT_MEMBER_DOCS = YES 612 | 613 | # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief 614 | # descriptions of file, namespace and class members alphabetically by member 615 | # name. If set to NO, the members will appear in declaration order. Note that 616 | # this will also influence the order of the classes in the class list. 617 | # The default value is: NO. 618 | 619 | SORT_BRIEF_DOCS = NO 620 | 621 | # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the 622 | # (brief and detailed) documentation of class members so that constructors and 623 | # destructors are listed first. If set to NO the constructors will appear in the 624 | # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. 625 | # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief 626 | # member documentation. 627 | # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting 628 | # detailed member documentation. 629 | # The default value is: NO. 630 | 631 | SORT_MEMBERS_CTORS_1ST = NO 632 | 633 | # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy 634 | # of group names into alphabetical order. If set to NO the group names will 635 | # appear in their defined order. 636 | # The default value is: NO. 637 | 638 | SORT_GROUP_NAMES = NO 639 | 640 | # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by 641 | # fully-qualified names, including namespaces. If set to NO, the class list will 642 | # be sorted only by class name, not including the namespace part. 643 | # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 644 | # Note: This option applies only to the class list, not to the alphabetical 645 | # list. 646 | # The default value is: NO. 647 | 648 | SORT_BY_SCOPE_NAME = NO 649 | 650 | # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper 651 | # type resolution of all parameters of a function it will reject a match between 652 | # the prototype and the implementation of a member function even if there is 653 | # only one candidate or it is obvious which candidate to choose by doing a 654 | # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still 655 | # accept a match between prototype and implementation in such cases. 656 | # The default value is: NO. 657 | 658 | STRICT_PROTO_MATCHING = NO 659 | 660 | # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo 661 | # list. This list is created by putting \todo commands in the documentation. 662 | # The default value is: YES. 663 | 664 | GENERATE_TODOLIST = YES 665 | 666 | # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test 667 | # list. This list is created by putting \test commands in the documentation. 668 | # The default value is: YES. 669 | 670 | GENERATE_TESTLIST = YES 671 | 672 | # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug 673 | # list. This list is created by putting \bug commands in the documentation. 674 | # The default value is: YES. 675 | 676 | GENERATE_BUGLIST = YES 677 | 678 | # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) 679 | # the deprecated list. This list is created by putting \deprecated commands in 680 | # the documentation. 681 | # The default value is: YES. 682 | 683 | GENERATE_DEPRECATEDLIST= YES 684 | 685 | # The ENABLED_SECTIONS tag can be used to enable conditional documentation 686 | # sections, marked by \if ... \endif and \cond 687 | # ... \endcond blocks. 688 | 689 | ENABLED_SECTIONS = 690 | 691 | # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the 692 | # initial value of a variable or macro / define can have for it to appear in the 693 | # documentation. If the initializer consists of more lines than specified here 694 | # it will be hidden. Use a value of 0 to hide initializers completely. The 695 | # appearance of the value of individual variables and macros / defines can be 696 | # controlled using \showinitializer or \hideinitializer command in the 697 | # documentation regardless of this setting. 698 | # Minimum value: 0, maximum value: 10000, default value: 30. 699 | 700 | MAX_INITIALIZER_LINES = 30 701 | 702 | # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at 703 | # the bottom of the documentation of classes and structs. If set to YES, the 704 | # list will mention the files that were used to generate the documentation. 705 | # The default value is: YES. 706 | 707 | SHOW_USED_FILES = YES 708 | 709 | # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This 710 | # will remove the Files entry from the Quick Index and from the Folder Tree View 711 | # (if specified). 712 | # The default value is: YES. 713 | 714 | SHOW_FILES = YES 715 | 716 | # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces 717 | # page. This will remove the Namespaces entry from the Quick Index and from the 718 | # Folder Tree View (if specified). 719 | # The default value is: YES. 720 | 721 | SHOW_NAMESPACES = YES 722 | 723 | # The FILE_VERSION_FILTER tag can be used to specify a program or script that 724 | # doxygen should invoke to get the current version for each file (typically from 725 | # the version control system). Doxygen will invoke the program by executing (via 726 | # popen()) the command command input-file, where command is the value of the 727 | # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided 728 | # by doxygen. Whatever the program writes to standard output is used as the file 729 | # version. For an example see the documentation. 730 | 731 | FILE_VERSION_FILTER = 732 | 733 | # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed 734 | # by doxygen. The layout file controls the global structure of the generated 735 | # output files in an output format independent way. To create the layout file 736 | # that represents doxygen's defaults, run doxygen with the -l option. You can 737 | # optionally specify a file name after the option, if omitted DoxygenLayout.xml 738 | # will be used as the name of the layout file. 739 | # 740 | # Note that if you run doxygen from a directory containing a file called 741 | # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE 742 | # tag is left empty. 743 | 744 | LAYOUT_FILE = 745 | 746 | # The CITE_BIB_FILES tag can be used to specify one or more bib files containing 747 | # the reference definitions. This must be a list of .bib files. The .bib 748 | # extension is automatically appended if omitted. This requires the bibtex tool 749 | # to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. 750 | # For LaTeX the style of the bibliography can be controlled using 751 | # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the 752 | # search path. See also \cite for info how to create references. 753 | 754 | CITE_BIB_FILES = 755 | 756 | #--------------------------------------------------------------------------- 757 | # Configuration options related to warning and progress messages 758 | #--------------------------------------------------------------------------- 759 | 760 | # The QUIET tag can be used to turn on/off the messages that are generated to 761 | # standard output by doxygen. If QUIET is set to YES this implies that the 762 | # messages are off. 763 | # The default value is: NO. 764 | 765 | QUIET = NO 766 | 767 | # The WARNINGS tag can be used to turn on/off the warning messages that are 768 | # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES 769 | # this implies that the warnings are on. 770 | # 771 | # Tip: Turn warnings on while writing the documentation. 772 | # The default value is: YES. 773 | 774 | WARNINGS = YES 775 | 776 | # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate 777 | # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag 778 | # will automatically be disabled. 779 | # The default value is: YES. 780 | 781 | WARN_IF_UNDOCUMENTED = YES 782 | 783 | # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for 784 | # potential errors in the documentation, such as not documenting some parameters 785 | # in a documented function, or documenting parameters that don't exist or using 786 | # markup commands wrongly. 787 | # The default value is: YES. 788 | 789 | WARN_IF_DOC_ERROR = YES 790 | 791 | # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that 792 | # are documented, but have no documentation for their parameters or return 793 | # value. If set to NO, doxygen will only warn about wrong or incomplete 794 | # parameter documentation, but not about the absence of documentation. If 795 | # EXTRACT_ALL is set to YES then this flag will automatically be disabled. 796 | # The default value is: NO. 797 | 798 | WARN_NO_PARAMDOC = NO 799 | 800 | # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when 801 | # a warning is encountered. 802 | # The default value is: NO. 803 | 804 | WARN_AS_ERROR = NO 805 | 806 | # The WARN_FORMAT tag determines the format of the warning messages that doxygen 807 | # can produce. The string should contain the $file, $line, and $text tags, which 808 | # will be replaced by the file and line number from which the warning originated 809 | # and the warning text. Optionally the format may contain $version, which will 810 | # be replaced by the version of the file (if it could be obtained via 811 | # FILE_VERSION_FILTER) 812 | # The default value is: $file:$line: $text. 813 | 814 | WARN_FORMAT = "$file:$line: $text" 815 | 816 | # The WARN_LOGFILE tag can be used to specify a file to which warning and error 817 | # messages should be written. If left blank the output is written to standard 818 | # error (stderr). 819 | 820 | WARN_LOGFILE = 821 | 822 | #--------------------------------------------------------------------------- 823 | # Configuration options related to the input files 824 | #--------------------------------------------------------------------------- 825 | 826 | # The INPUT tag is used to specify the files and/or directories that contain 827 | # documented source files. You may enter file names like myfile.cpp or 828 | # directories like /usr/src/myproject. Separate the files or directories with 829 | # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING 830 | # Note: If this tag is empty the current directory is searched. 831 | 832 | INPUT = 833 | 834 | # This tag can be used to specify the character encoding of the source files 835 | # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses 836 | # libiconv (or the iconv built into libc) for the transcoding. See the libiconv 837 | # documentation (see: https://www.gnu.org/software/libiconv/) for the list of 838 | # possible encodings. 839 | # The default value is: UTF-8. 840 | 841 | INPUT_ENCODING = UTF-8 842 | 843 | # If the value of the INPUT tag contains directories, you can use the 844 | # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and 845 | # *.h) to filter out the source-files in the directories. 846 | # 847 | # Note that for custom extensions or not directly supported extensions you also 848 | # need to set EXTENSION_MAPPING for the extension otherwise the files are not 849 | # read by doxygen. 850 | # 851 | # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, 852 | # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, 853 | # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, 854 | # *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, 855 | # *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. 856 | 857 | FILE_PATTERNS = *.c \ 858 | *.cc \ 859 | *.cxx \ 860 | *.cpp \ 861 | *.c++ \ 862 | *.java \ 863 | *.ii \ 864 | *.ixx \ 865 | *.ipp \ 866 | *.i++ \ 867 | *.inl \ 868 | *.idl \ 869 | *.ddl \ 870 | *.odl \ 871 | *.h \ 872 | *.hh \ 873 | *.hxx \ 874 | *.hpp \ 875 | *.h++ \ 876 | *.cs \ 877 | *.d \ 878 | *.php \ 879 | *.php4 \ 880 | *.php5 \ 881 | *.phtml \ 882 | *.inc \ 883 | *.m \ 884 | *.markdown \ 885 | *.md \ 886 | *.mm \ 887 | *.dox \ 888 | *.py \ 889 | *.pyw \ 890 | *.f90 \ 891 | *.f95 \ 892 | *.f03 \ 893 | *.f08 \ 894 | *.f \ 895 | *.for \ 896 | *.tcl \ 897 | *.vhd \ 898 | *.vhdl \ 899 | *.ucf \ 900 | *.qsf \ 901 | *.ice 902 | 903 | # The RECURSIVE tag can be used to specify whether or not subdirectories should 904 | # be searched for input files as well. 905 | # The default value is: NO. 906 | 907 | RECURSIVE = NO 908 | 909 | # The EXCLUDE tag can be used to specify files and/or directories that should be 910 | # excluded from the INPUT source files. This way you can easily exclude a 911 | # subdirectory from a directory tree whose root is specified with the INPUT tag. 912 | # 913 | # Note that relative paths are relative to the directory from which doxygen is 914 | # run. 915 | 916 | EXCLUDE = 917 | 918 | # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or 919 | # directories that are symbolic links (a Unix file system feature) are excluded 920 | # from the input. 921 | # The default value is: NO. 922 | 923 | EXCLUDE_SYMLINKS = NO 924 | 925 | # If the value of the INPUT tag contains directories, you can use the 926 | # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 927 | # certain files from those directories. 928 | # 929 | # Note that the wildcards are matched against the file with absolute path, so to 930 | # exclude all test directories for example use the pattern */test/* 931 | 932 | EXCLUDE_PATTERNS = 933 | 934 | # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 935 | # (namespaces, classes, functions, etc.) that should be excluded from the 936 | # output. The symbol name can be a fully qualified name, a word, or if the 937 | # wildcard * is used, a substring. Examples: ANamespace, AClass, 938 | # AClass::ANamespace, ANamespace::*Test 939 | # 940 | # Note that the wildcards are matched against the file with absolute path, so to 941 | # exclude all test directories use the pattern */test/* 942 | 943 | EXCLUDE_SYMBOLS = 944 | 945 | # The EXAMPLE_PATH tag can be used to specify one or more files or directories 946 | # that contain example code fragments that are included (see the \include 947 | # command). 948 | 949 | EXAMPLE_PATH = 950 | 951 | # If the value of the EXAMPLE_PATH tag contains directories, you can use the 952 | # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and 953 | # *.h) to filter out the source-files in the directories. If left blank all 954 | # files are included. 955 | 956 | EXAMPLE_PATTERNS = * 957 | 958 | # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 959 | # searched for input files to be used with the \include or \dontinclude commands 960 | # irrespective of the value of the RECURSIVE tag. 961 | # The default value is: NO. 962 | 963 | EXAMPLE_RECURSIVE = NO 964 | 965 | # The IMAGE_PATH tag can be used to specify one or more files or directories 966 | # that contain images that are to be included in the documentation (see the 967 | # \image command). 968 | 969 | IMAGE_PATH = 970 | 971 | # The INPUT_FILTER tag can be used to specify a program that doxygen should 972 | # invoke to filter for each input file. Doxygen will invoke the filter program 973 | # by executing (via popen()) the command: 974 | # 975 | # 976 | # 977 | # where is the value of the INPUT_FILTER tag, and is the 978 | # name of an input file. Doxygen will then use the output that the filter 979 | # program writes to standard output. If FILTER_PATTERNS is specified, this tag 980 | # will be ignored. 981 | # 982 | # Note that the filter must not add or remove lines; it is applied before the 983 | # code is scanned, but not when the output code is generated. If lines are added 984 | # or removed, the anchors will not be placed correctly. 985 | # 986 | # Note that for custom extensions or not directly supported extensions you also 987 | # need to set EXTENSION_MAPPING for the extension otherwise the files are not 988 | # properly processed by doxygen. 989 | 990 | INPUT_FILTER = 991 | 992 | # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 993 | # basis. Doxygen will compare the file name with each pattern and apply the 994 | # filter if there is a match. The filters are a list of the form: pattern=filter 995 | # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how 996 | # filters are used. If the FILTER_PATTERNS tag is empty or if none of the 997 | # patterns match the file name, INPUT_FILTER is applied. 998 | # 999 | # Note that for custom extensions or not directly supported extensions you also 1000 | # need to set EXTENSION_MAPPING for the extension otherwise the files are not 1001 | # properly processed by doxygen. 1002 | 1003 | FILTER_PATTERNS = 1004 | 1005 | # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 1006 | # INPUT_FILTER) will also be used to filter the input files that are used for 1007 | # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). 1008 | # The default value is: NO. 1009 | 1010 | FILTER_SOURCE_FILES = NO 1011 | 1012 | # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file 1013 | # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and 1014 | # it is also possible to disable source filtering for a specific pattern using 1015 | # *.ext= (so without naming a filter). 1016 | # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. 1017 | 1018 | FILTER_SOURCE_PATTERNS = 1019 | 1020 | # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that 1021 | # is part of the input, its contents will be placed on the main page 1022 | # (index.html). This can be useful if you have a project on for instance GitHub 1023 | # and want to reuse the introduction page also for the doxygen output. 1024 | 1025 | USE_MDFILE_AS_MAINPAGE = 1026 | 1027 | #--------------------------------------------------------------------------- 1028 | # Configuration options related to source browsing 1029 | #--------------------------------------------------------------------------- 1030 | 1031 | # If the SOURCE_BROWSER tag is set to YES then a list of source files will be 1032 | # generated. Documented entities will be cross-referenced with these sources. 1033 | # 1034 | # Note: To get rid of all source code in the generated output, make sure that 1035 | # also VERBATIM_HEADERS is set to NO. 1036 | # The default value is: NO. 1037 | 1038 | SOURCE_BROWSER = NO 1039 | 1040 | # Setting the INLINE_SOURCES tag to YES will include the body of functions, 1041 | # classes and enums directly into the documentation. 1042 | # The default value is: NO. 1043 | 1044 | INLINE_SOURCES = NO 1045 | 1046 | # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any 1047 | # special comment blocks from generated source code fragments. Normal C, C++ and 1048 | # Fortran comments will always remain visible. 1049 | # The default value is: YES. 1050 | 1051 | STRIP_CODE_COMMENTS = YES 1052 | 1053 | # If the REFERENCED_BY_RELATION tag is set to YES then for each documented 1054 | # entity all documented functions referencing it will be listed. 1055 | # The default value is: NO. 1056 | 1057 | REFERENCED_BY_RELATION = NO 1058 | 1059 | # If the REFERENCES_RELATION tag is set to YES then for each documented function 1060 | # all documented entities called/used by that function will be listed. 1061 | # The default value is: NO. 1062 | 1063 | REFERENCES_RELATION = NO 1064 | 1065 | # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set 1066 | # to YES then the hyperlinks from functions in REFERENCES_RELATION and 1067 | # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will 1068 | # link to the documentation. 1069 | # The default value is: YES. 1070 | 1071 | REFERENCES_LINK_SOURCE = YES 1072 | 1073 | # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the 1074 | # source code will show a tooltip with additional information such as prototype, 1075 | # brief description and links to the definition and documentation. Since this 1076 | # will make the HTML file larger and loading of large files a bit slower, you 1077 | # can opt to disable this feature. 1078 | # The default value is: YES. 1079 | # This tag requires that the tag SOURCE_BROWSER is set to YES. 1080 | 1081 | SOURCE_TOOLTIPS = YES 1082 | 1083 | # If the USE_HTAGS tag is set to YES then the references to source code will 1084 | # point to the HTML generated by the htags(1) tool instead of doxygen built-in 1085 | # source browser. The htags tool is part of GNU's global source tagging system 1086 | # (see https://www.gnu.org/software/global/global.html). You will need version 1087 | # 4.8.6 or higher. 1088 | # 1089 | # To use it do the following: 1090 | # - Install the latest version of global 1091 | # - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file 1092 | # - Make sure the INPUT points to the root of the source tree 1093 | # - Run doxygen as normal 1094 | # 1095 | # Doxygen will invoke htags (and that will in turn invoke gtags), so these 1096 | # tools must be available from the command line (i.e. in the search path). 1097 | # 1098 | # The result: instead of the source browser generated by doxygen, the links to 1099 | # source code will now point to the output of htags. 1100 | # The default value is: NO. 1101 | # This tag requires that the tag SOURCE_BROWSER is set to YES. 1102 | 1103 | USE_HTAGS = NO 1104 | 1105 | # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a 1106 | # verbatim copy of the header file for each class for which an include is 1107 | # specified. Set to NO to disable this. 1108 | # See also: Section \class. 1109 | # The default value is: YES. 1110 | 1111 | VERBATIM_HEADERS = YES 1112 | 1113 | # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the 1114 | # clang parser (see: http://clang.llvm.org/) for more accurate parsing at the 1115 | # cost of reduced performance. This can be particularly helpful with template 1116 | # rich C++ code for which doxygen's built-in parser lacks the necessary type 1117 | # information. 1118 | # Note: The availability of this option depends on whether or not doxygen was 1119 | # generated with the -Duse_libclang=ON option for CMake. 1120 | # The default value is: NO. 1121 | 1122 | CLANG_ASSISTED_PARSING = NO 1123 | 1124 | # If clang assisted parsing is enabled you can provide the compiler with command 1125 | # line options that you would normally use when invoking the compiler. Note that 1126 | # the include paths will already be set by doxygen for the files and directories 1127 | # specified with INPUT and INCLUDE_PATH. 1128 | # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. 1129 | 1130 | CLANG_OPTIONS = 1131 | 1132 | # If clang assisted parsing is enabled you can provide the clang parser with the 1133 | # path to the compilation database (see: 1134 | # http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files 1135 | # were built. This is equivalent to specifying the "-p" option to a clang tool, 1136 | # such as clang-check. These options will then be passed to the parser. 1137 | # Note: The availability of this option depends on whether or not doxygen was 1138 | # generated with the -Duse_libclang=ON option for CMake. 1139 | 1140 | CLANG_DATABASE_PATH = 1141 | 1142 | #--------------------------------------------------------------------------- 1143 | # Configuration options related to the alphabetical class index 1144 | #--------------------------------------------------------------------------- 1145 | 1146 | # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all 1147 | # compounds will be generated. Enable this if the project contains a lot of 1148 | # classes, structs, unions or interfaces. 1149 | # The default value is: YES. 1150 | 1151 | ALPHABETICAL_INDEX = YES 1152 | 1153 | # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in 1154 | # which the alphabetical index list will be split. 1155 | # Minimum value: 1, maximum value: 20, default value: 5. 1156 | # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. 1157 | 1158 | COLS_IN_ALPHA_INDEX = 5 1159 | 1160 | # In case all classes in a project start with a common prefix, all classes will 1161 | # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag 1162 | # can be used to specify a prefix (or a list of prefixes) that should be ignored 1163 | # while generating the index headers. 1164 | # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. 1165 | 1166 | IGNORE_PREFIX = 1167 | 1168 | #--------------------------------------------------------------------------- 1169 | # Configuration options related to the HTML output 1170 | #--------------------------------------------------------------------------- 1171 | 1172 | # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output 1173 | # The default value is: YES. 1174 | 1175 | GENERATE_HTML = YES 1176 | 1177 | # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a 1178 | # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of 1179 | # it. 1180 | # The default directory is: html. 1181 | # This tag requires that the tag GENERATE_HTML is set to YES. 1182 | 1183 | HTML_OUTPUT = html 1184 | 1185 | # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each 1186 | # generated HTML page (for example: .htm, .php, .asp). 1187 | # The default value is: .html. 1188 | # This tag requires that the tag GENERATE_HTML is set to YES. 1189 | 1190 | HTML_FILE_EXTENSION = .html 1191 | 1192 | # The HTML_HEADER tag can be used to specify a user-defined HTML header file for 1193 | # each generated HTML page. If the tag is left blank doxygen will generate a 1194 | # standard header. 1195 | # 1196 | # To get valid HTML the header file that includes any scripts and style sheets 1197 | # that doxygen needs, which is dependent on the configuration options used (e.g. 1198 | # the setting GENERATE_TREEVIEW). It is highly recommended to start with a 1199 | # default header using 1200 | # doxygen -w html new_header.html new_footer.html new_stylesheet.css 1201 | # YourConfigFile 1202 | # and then modify the file new_header.html. See also section "Doxygen usage" 1203 | # for information on how to generate the default header that doxygen normally 1204 | # uses. 1205 | # Note: The header is subject to change so you typically have to regenerate the 1206 | # default header when upgrading to a newer version of doxygen. For a description 1207 | # of the possible markers and block names see the documentation. 1208 | # This tag requires that the tag GENERATE_HTML is set to YES. 1209 | 1210 | HTML_HEADER = 1211 | 1212 | # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each 1213 | # generated HTML page. If the tag is left blank doxygen will generate a standard 1214 | # footer. See HTML_HEADER for more information on how to generate a default 1215 | # footer and what special commands can be used inside the footer. See also 1216 | # section "Doxygen usage" for information on how to generate the default footer 1217 | # that doxygen normally uses. 1218 | # This tag requires that the tag GENERATE_HTML is set to YES. 1219 | 1220 | HTML_FOOTER = 1221 | 1222 | # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style 1223 | # sheet that is used by each HTML page. It can be used to fine-tune the look of 1224 | # the HTML output. If left blank doxygen will generate a default style sheet. 1225 | # See also section "Doxygen usage" for information on how to generate the style 1226 | # sheet that doxygen normally uses. 1227 | # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as 1228 | # it is more robust and this tag (HTML_STYLESHEET) will in the future become 1229 | # obsolete. 1230 | # This tag requires that the tag GENERATE_HTML is set to YES. 1231 | 1232 | HTML_STYLESHEET = 1233 | 1234 | # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined 1235 | # cascading style sheets that are included after the standard style sheets 1236 | # created by doxygen. Using this option one can overrule certain style aspects. 1237 | # This is preferred over using HTML_STYLESHEET since it does not replace the 1238 | # standard style sheet and is therefore more robust against future updates. 1239 | # Doxygen will copy the style sheet files to the output directory. 1240 | # Note: The order of the extra style sheet files is of importance (e.g. the last 1241 | # style sheet in the list overrules the setting of the previous ones in the 1242 | # list). For an example see the documentation. 1243 | # This tag requires that the tag GENERATE_HTML is set to YES. 1244 | 1245 | HTML_EXTRA_STYLESHEET = 1246 | 1247 | # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or 1248 | # other source files which should be copied to the HTML output directory. Note 1249 | # that these files will be copied to the base HTML output directory. Use the 1250 | # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these 1251 | # files. In the HTML_STYLESHEET file, use the file name only. Also note that the 1252 | # files will be copied as-is; there are no commands or markers available. 1253 | # This tag requires that the tag GENERATE_HTML is set to YES. 1254 | 1255 | HTML_EXTRA_FILES = 1256 | 1257 | # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen 1258 | # will adjust the colors in the style sheet and background images according to 1259 | # this color. Hue is specified as an angle on a colorwheel, see 1260 | # https://en.wikipedia.org/wiki/Hue for more information. For instance the value 1261 | # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 1262 | # purple, and 360 is red again. 1263 | # Minimum value: 0, maximum value: 359, default value: 220. 1264 | # This tag requires that the tag GENERATE_HTML is set to YES. 1265 | 1266 | HTML_COLORSTYLE_HUE = 220 1267 | 1268 | # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors 1269 | # in the HTML output. For a value of 0 the output will use grayscales only. A 1270 | # value of 255 will produce the most vivid colors. 1271 | # Minimum value: 0, maximum value: 255, default value: 100. 1272 | # This tag requires that the tag GENERATE_HTML is set to YES. 1273 | 1274 | HTML_COLORSTYLE_SAT = 100 1275 | 1276 | # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the 1277 | # luminance component of the colors in the HTML output. Values below 100 1278 | # gradually make the output lighter, whereas values above 100 make the output 1279 | # darker. The value divided by 100 is the actual gamma applied, so 80 represents 1280 | # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not 1281 | # change the gamma. 1282 | # Minimum value: 40, maximum value: 240, default value: 80. 1283 | # This tag requires that the tag GENERATE_HTML is set to YES. 1284 | 1285 | HTML_COLORSTYLE_GAMMA = 80 1286 | 1287 | # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML 1288 | # page will contain the date and time when the page was generated. Setting this 1289 | # to YES can help to show when doxygen was last run and thus if the 1290 | # documentation is up to date. 1291 | # The default value is: NO. 1292 | # This tag requires that the tag GENERATE_HTML is set to YES. 1293 | 1294 | HTML_TIMESTAMP = NO 1295 | 1296 | # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML 1297 | # documentation will contain a main index with vertical navigation menus that 1298 | # are dynamically created via Javascript. If disabled, the navigation index will 1299 | # consists of multiple levels of tabs that are statically embedded in every HTML 1300 | # page. Disable this option to support browsers that do not have Javascript, 1301 | # like the Qt help browser. 1302 | # The default value is: YES. 1303 | # This tag requires that the tag GENERATE_HTML is set to YES. 1304 | 1305 | HTML_DYNAMIC_MENUS = YES 1306 | 1307 | # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 1308 | # documentation will contain sections that can be hidden and shown after the 1309 | # page has loaded. 1310 | # The default value is: NO. 1311 | # This tag requires that the tag GENERATE_HTML is set to YES. 1312 | 1313 | HTML_DYNAMIC_SECTIONS = NO 1314 | 1315 | # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries 1316 | # shown in the various tree structured indices initially; the user can expand 1317 | # and collapse entries dynamically later on. Doxygen will expand the tree to 1318 | # such a level that at most the specified number of entries are visible (unless 1319 | # a fully collapsed tree already exceeds this amount). So setting the number of 1320 | # entries 1 will produce a full collapsed tree by default. 0 is a special value 1321 | # representing an infinite number of entries and will result in a full expanded 1322 | # tree by default. 1323 | # Minimum value: 0, maximum value: 9999, default value: 100. 1324 | # This tag requires that the tag GENERATE_HTML is set to YES. 1325 | 1326 | HTML_INDEX_NUM_ENTRIES = 100 1327 | 1328 | # If the GENERATE_DOCSET tag is set to YES, additional index files will be 1329 | # generated that can be used as input for Apple's Xcode 3 integrated development 1330 | # environment (see: https://developer.apple.com/xcode/), introduced with OSX 1331 | # 10.5 (Leopard). To create a documentation set, doxygen will generate a 1332 | # Makefile in the HTML output directory. Running make will produce the docset in 1333 | # that directory and running make install will install the docset in 1334 | # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at 1335 | # startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy 1336 | # genXcode/_index.html for more information. 1337 | # The default value is: NO. 1338 | # This tag requires that the tag GENERATE_HTML is set to YES. 1339 | 1340 | GENERATE_DOCSET = NO 1341 | 1342 | # This tag determines the name of the docset feed. A documentation feed provides 1343 | # an umbrella under which multiple documentation sets from a single provider 1344 | # (such as a company or product suite) can be grouped. 1345 | # The default value is: Doxygen generated docs. 1346 | # This tag requires that the tag GENERATE_DOCSET is set to YES. 1347 | 1348 | DOCSET_FEEDNAME = "Doxygen generated docs" 1349 | 1350 | # This tag specifies a string that should uniquely identify the documentation 1351 | # set bundle. This should be a reverse domain-name style string, e.g. 1352 | # com.mycompany.MyDocSet. Doxygen will append .docset to the name. 1353 | # The default value is: org.doxygen.Project. 1354 | # This tag requires that the tag GENERATE_DOCSET is set to YES. 1355 | 1356 | DOCSET_BUNDLE_ID = org.doxygen.Project 1357 | 1358 | # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify 1359 | # the documentation publisher. This should be a reverse domain-name style 1360 | # string, e.g. com.mycompany.MyDocSet.documentation. 1361 | # The default value is: org.doxygen.Publisher. 1362 | # This tag requires that the tag GENERATE_DOCSET is set to YES. 1363 | 1364 | DOCSET_PUBLISHER_ID = org.doxygen.Publisher 1365 | 1366 | # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. 1367 | # The default value is: Publisher. 1368 | # This tag requires that the tag GENERATE_DOCSET is set to YES. 1369 | 1370 | DOCSET_PUBLISHER_NAME = Publisher 1371 | 1372 | # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three 1373 | # additional HTML index files: index.hhp, index.hhc, and index.hhk. The 1374 | # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop 1375 | # (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on 1376 | # Windows. 1377 | # 1378 | # The HTML Help Workshop contains a compiler that can convert all HTML output 1379 | # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML 1380 | # files are now used as the Windows 98 help format, and will replace the old 1381 | # Windows help format (.hlp) on all Windows platforms in the future. Compressed 1382 | # HTML files also contain an index, a table of contents, and you can search for 1383 | # words in the documentation. The HTML workshop also contains a viewer for 1384 | # compressed HTML files. 1385 | # The default value is: NO. 1386 | # This tag requires that the tag GENERATE_HTML is set to YES. 1387 | 1388 | GENERATE_HTMLHELP = NO 1389 | 1390 | # The CHM_FILE tag can be used to specify the file name of the resulting .chm 1391 | # file. You can add a path in front of the file if the result should not be 1392 | # written to the html output directory. 1393 | # This tag requires that the tag GENERATE_HTMLHELP is set to YES. 1394 | 1395 | CHM_FILE = 1396 | 1397 | # The HHC_LOCATION tag can be used to specify the location (absolute path 1398 | # including file name) of the HTML help compiler (hhc.exe). If non-empty, 1399 | # doxygen will try to run the HTML help compiler on the generated index.hhp. 1400 | # The file has to be specified with full path. 1401 | # This tag requires that the tag GENERATE_HTMLHELP is set to YES. 1402 | 1403 | HHC_LOCATION = 1404 | 1405 | # The GENERATE_CHI flag controls if a separate .chi index file is generated 1406 | # (YES) or that it should be included in the master .chm file (NO). 1407 | # The default value is: NO. 1408 | # This tag requires that the tag GENERATE_HTMLHELP is set to YES. 1409 | 1410 | GENERATE_CHI = NO 1411 | 1412 | # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) 1413 | # and project file content. 1414 | # This tag requires that the tag GENERATE_HTMLHELP is set to YES. 1415 | 1416 | CHM_INDEX_ENCODING = 1417 | 1418 | # The BINARY_TOC flag controls whether a binary table of contents is generated 1419 | # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it 1420 | # enables the Previous and Next buttons. 1421 | # The default value is: NO. 1422 | # This tag requires that the tag GENERATE_HTMLHELP is set to YES. 1423 | 1424 | BINARY_TOC = NO 1425 | 1426 | # The TOC_EXPAND flag can be set to YES to add extra items for group members to 1427 | # the table of contents of the HTML help documentation and to the tree view. 1428 | # The default value is: NO. 1429 | # This tag requires that the tag GENERATE_HTMLHELP is set to YES. 1430 | 1431 | TOC_EXPAND = NO 1432 | 1433 | # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and 1434 | # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that 1435 | # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help 1436 | # (.qch) of the generated HTML documentation. 1437 | # The default value is: NO. 1438 | # This tag requires that the tag GENERATE_HTML is set to YES. 1439 | 1440 | GENERATE_QHP = NO 1441 | 1442 | # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify 1443 | # the file name of the resulting .qch file. The path specified is relative to 1444 | # the HTML output folder. 1445 | # This tag requires that the tag GENERATE_QHP is set to YES. 1446 | 1447 | QCH_FILE = 1448 | 1449 | # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help 1450 | # Project output. For more information please see Qt Help Project / Namespace 1451 | # (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). 1452 | # The default value is: org.doxygen.Project. 1453 | # This tag requires that the tag GENERATE_QHP is set to YES. 1454 | 1455 | QHP_NAMESPACE = org.doxygen.Project 1456 | 1457 | # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt 1458 | # Help Project output. For more information please see Qt Help Project / Virtual 1459 | # Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- 1460 | # folders). 1461 | # The default value is: doc. 1462 | # This tag requires that the tag GENERATE_QHP is set to YES. 1463 | 1464 | QHP_VIRTUAL_FOLDER = doc 1465 | 1466 | # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom 1467 | # filter to add. For more information please see Qt Help Project / Custom 1468 | # Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- 1469 | # filters). 1470 | # This tag requires that the tag GENERATE_QHP is set to YES. 1471 | 1472 | QHP_CUST_FILTER_NAME = 1473 | 1474 | # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the 1475 | # custom filter to add. For more information please see Qt Help Project / Custom 1476 | # Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- 1477 | # filters). 1478 | # This tag requires that the tag GENERATE_QHP is set to YES. 1479 | 1480 | QHP_CUST_FILTER_ATTRS = 1481 | 1482 | # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this 1483 | # project's filter section matches. Qt Help Project / Filter Attributes (see: 1484 | # https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). 1485 | # This tag requires that the tag GENERATE_QHP is set to YES. 1486 | 1487 | QHP_SECT_FILTER_ATTRS = 1488 | 1489 | # The QHG_LOCATION tag can be used to specify the location of Qt's 1490 | # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the 1491 | # generated .qhp file. 1492 | # This tag requires that the tag GENERATE_QHP is set to YES. 1493 | 1494 | QHG_LOCATION = 1495 | 1496 | # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be 1497 | # generated, together with the HTML files, they form an Eclipse help plugin. To 1498 | # install this plugin and make it available under the help contents menu in 1499 | # Eclipse, the contents of the directory containing the HTML and XML files needs 1500 | # to be copied into the plugins directory of eclipse. The name of the directory 1501 | # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. 1502 | # After copying Eclipse needs to be restarted before the help appears. 1503 | # The default value is: NO. 1504 | # This tag requires that the tag GENERATE_HTML is set to YES. 1505 | 1506 | GENERATE_ECLIPSEHELP = NO 1507 | 1508 | # A unique identifier for the Eclipse help plugin. When installing the plugin 1509 | # the directory name containing the HTML and XML files should also have this 1510 | # name. Each documentation set should have its own identifier. 1511 | # The default value is: org.doxygen.Project. 1512 | # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. 1513 | 1514 | ECLIPSE_DOC_ID = org.doxygen.Project 1515 | 1516 | # If you want full control over the layout of the generated HTML pages it might 1517 | # be necessary to disable the index and replace it with your own. The 1518 | # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top 1519 | # of each HTML page. A value of NO enables the index and the value YES disables 1520 | # it. Since the tabs in the index contain the same information as the navigation 1521 | # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. 1522 | # The default value is: NO. 1523 | # This tag requires that the tag GENERATE_HTML is set to YES. 1524 | 1525 | DISABLE_INDEX = NO 1526 | 1527 | # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 1528 | # structure should be generated to display hierarchical information. If the tag 1529 | # value is set to YES, a side panel will be generated containing a tree-like 1530 | # index structure (just like the one that is generated for HTML Help). For this 1531 | # to work a browser that supports JavaScript, DHTML, CSS and frames is required 1532 | # (i.e. any modern browser). Windows users are probably better off using the 1533 | # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can 1534 | # further fine-tune the look of the index. As an example, the default style 1535 | # sheet generated by doxygen has an example that shows how to put an image at 1536 | # the root of the tree instead of the PROJECT_NAME. Since the tree basically has 1537 | # the same information as the tab index, you could consider setting 1538 | # DISABLE_INDEX to YES when enabling this option. 1539 | # The default value is: NO. 1540 | # This tag requires that the tag GENERATE_HTML is set to YES. 1541 | 1542 | GENERATE_TREEVIEW = NO 1543 | 1544 | # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that 1545 | # doxygen will group on one line in the generated HTML documentation. 1546 | # 1547 | # Note that a value of 0 will completely suppress the enum values from appearing 1548 | # in the overview section. 1549 | # Minimum value: 0, maximum value: 20, default value: 4. 1550 | # This tag requires that the tag GENERATE_HTML is set to YES. 1551 | 1552 | ENUM_VALUES_PER_LINE = 4 1553 | 1554 | # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used 1555 | # to set the initial width (in pixels) of the frame in which the tree is shown. 1556 | # Minimum value: 0, maximum value: 1500, default value: 250. 1557 | # This tag requires that the tag GENERATE_HTML is set to YES. 1558 | 1559 | TREEVIEW_WIDTH = 250 1560 | 1561 | # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to 1562 | # external symbols imported via tag files in a separate window. 1563 | # The default value is: NO. 1564 | # This tag requires that the tag GENERATE_HTML is set to YES. 1565 | 1566 | EXT_LINKS_IN_WINDOW = NO 1567 | 1568 | # Use this tag to change the font size of LaTeX formulas included as images in 1569 | # the HTML documentation. When you change the font size after a successful 1570 | # doxygen run you need to manually remove any form_*.png images from the HTML 1571 | # output directory to force them to be regenerated. 1572 | # Minimum value: 8, maximum value: 50, default value: 10. 1573 | # This tag requires that the tag GENERATE_HTML is set to YES. 1574 | 1575 | FORMULA_FONTSIZE = 10 1576 | 1577 | # Use the FORMULA_TRANSPARENT tag to determine whether or not the images 1578 | # generated for formulas are transparent PNGs. Transparent PNGs are not 1579 | # supported properly for IE 6.0, but are supported on all modern browsers. 1580 | # 1581 | # Note that when changing this option you need to delete any form_*.png files in 1582 | # the HTML output directory before the changes have effect. 1583 | # The default value is: YES. 1584 | # This tag requires that the tag GENERATE_HTML is set to YES. 1585 | 1586 | FORMULA_TRANSPARENT = YES 1587 | 1588 | # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see 1589 | # https://www.mathjax.org) which uses client side Javascript for the rendering 1590 | # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX 1591 | # installed or if you want to formulas look prettier in the HTML output. When 1592 | # enabled you may also need to install MathJax separately and configure the path 1593 | # to it using the MATHJAX_RELPATH option. 1594 | # The default value is: NO. 1595 | # This tag requires that the tag GENERATE_HTML is set to YES. 1596 | 1597 | USE_MATHJAX = NO 1598 | 1599 | # When MathJax is enabled you can set the default output format to be used for 1600 | # the MathJax output. See the MathJax site (see: 1601 | # http://docs.mathjax.org/en/latest/output.html) for more details. 1602 | # Possible values are: HTML-CSS (which is slower, but has the best 1603 | # compatibility), NativeMML (i.e. MathML) and SVG. 1604 | # The default value is: HTML-CSS. 1605 | # This tag requires that the tag USE_MATHJAX is set to YES. 1606 | 1607 | MATHJAX_FORMAT = HTML-CSS 1608 | 1609 | # When MathJax is enabled you need to specify the location relative to the HTML 1610 | # output directory using the MATHJAX_RELPATH option. The destination directory 1611 | # should contain the MathJax.js script. For instance, if the mathjax directory 1612 | # is located at the same level as the HTML output directory, then 1613 | # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax 1614 | # Content Delivery Network so you can quickly see the result without installing 1615 | # MathJax. However, it is strongly recommended to install a local copy of 1616 | # MathJax from https://www.mathjax.org before deployment. 1617 | # The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. 1618 | # This tag requires that the tag USE_MATHJAX is set to YES. 1619 | 1620 | MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ 1621 | 1622 | # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax 1623 | # extension names that should be enabled during MathJax rendering. For example 1624 | # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols 1625 | # This tag requires that the tag USE_MATHJAX is set to YES. 1626 | 1627 | MATHJAX_EXTENSIONS = 1628 | 1629 | # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces 1630 | # of code that will be used on startup of the MathJax code. See the MathJax site 1631 | # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an 1632 | # example see the documentation. 1633 | # This tag requires that the tag USE_MATHJAX is set to YES. 1634 | 1635 | MATHJAX_CODEFILE = 1636 | 1637 | # When the SEARCHENGINE tag is enabled doxygen will generate a search box for 1638 | # the HTML output. The underlying search engine uses javascript and DHTML and 1639 | # should work on any modern browser. Note that when using HTML help 1640 | # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) 1641 | # there is already a search function so this one should typically be disabled. 1642 | # For large projects the javascript based search engine can be slow, then 1643 | # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to 1644 | # search using the keyboard; to jump to the search box use + S 1645 | # (what the is depends on the OS and browser, but it is typically 1646 | # , /