-
Notifications
You must be signed in to change notification settings - Fork 2
How to add a new layer or implementation?
yaitaissa edited this page Aug 23, 2024
·
1 revision
Here are exposed the few steps to implement a new layer in ACETONE:
- Create a script
layer_name.pyin the layers folder - Create the class
layer_namewith at least the following methods:-
__init__: Create the object -
forward_path_layer: The Python implementation of the layer -
generate_inference_code_layer: The function generating a string corresponding to the C code of the layer
-
- Create the corresponding template
template_layer_name.c.tplin the templates/layers folder - Add to the parser(s) (depending on if the layer is implemented on the corresponding format) the function to read and create the layer (in the file
create_layers.pyfor ONNX, or directly in the parser file for other formats) in the format_importer folder.
Here are exposed the few steps to implement a new implementation of a pre-existing layer in ACETONE:
- Create a folder in the layers folder
- Move the pre-existing implementation of the layer to this folder
- Transforme the layer in an "empty" version (
forward_path_layerandgenerate_inference_code_layerare left as abstract methods) and put the pre-existing verions in a new class inheriting from the "empty" version. - Create your new implementation by inheriting from the "empty" version and adding your
forward_path_layerandgenerate_inference_code_layermethods (don't forget to add a corresponding template and to join all the templates for the layer in a same sub-folder). - Add a default version in the
create_dict_versionmethod of theCodeGeneratorclass (in theneura_network.pyfile) - Add a
layer_implementation.pyfile in theversioning/version_implementationfolder and creates one instantiation function per version and one global - Add the global function in
versioning'simplementeddictionary.