Skip to content

Usage of the GCC backend_utils

Christoph edited this page Feb 6, 2020 · 14 revisions

The GCC backend_utils provide a set of commonly needed functions for the GCC backend. Although those functionality was created for the use in the GCC backend, it can also be used in other backends using a similiar structure as the GCC backend.
The range of functions reaches from simple IO Tasks to the provision of specific information contained in the intermediate format.

Currently available functions

The parameter input in the table below references always to a valid network model in the intermediate format.

Method name Parameters Functionality
replace_markers file, markers Replaces all given markes in the given file with their respective value.
read_marker_file filename Reads the file with given filename.
write_header_and_c_file out_dir, h_file, h_file_name, c_file_source, c_file_name, exec_file Writes header- (h_file and h_file) and c-file (c_file_source, c_file_name) into given output directory (out_dir). Optionally an executable file (exec_file) is copied into the given output directory.
convert_array_to_string array Returns a string representation of the given array with surrounding curly brackets.
get_number_of_layers input Returns the number of layers in the given network model.
get_layer_types_string input, layer_types Returns a string containing an array of indices representing the layer type of each layer. Indices are taken from the given layer_types dictionary of the form {<layer_name>:<index>}.
get_output_dimensions input Returns an array with height values, an array with width values and an array with depth values of the given network model.
get_pool_size_strings input Returns an array with pool height values and an array with pool width values of the given network model.
get_strides_strings input Returns an array with stride height values and an array with stride width values of the given network model.
get_padding_string input, padding_types Returns an array with the padding values of the given network model.
get_activation_function_string input, activation_functions Returns a string containing an array of indices representing the activation function for each layer. Indices are taken from the given dictionary of the form {<activation_function>:<index>}.
get_bias_information input Returns a string containing an array of bools indicating the usage of biases, a string containing an array of indices indicating the start position of bias values for each layer, and a flattened array of weights values.
get_weight_information input, layerOutputHeight Returns a string containing an array of indices indicating the start position of weight values for each layer, and a flattened array of weights values.
Clone this wiki locally