Skip to content
Snippets Groups Projects
Commit e73291d9 authored by Thibault Allenet's avatar Thibault Allenet
Browse files

Add jinja templates

parent dfef8d16
No related branches found
No related tags found
No related merge requests found
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
#ifndef {{ name|upper }}_LAYER_H #ifndef {{ name|upper }}_LAYER_H
#define {{ name|upper }}_LAYER_H #define {{ name|upper }}_LAYER_H
#include "typedefs.h" #include "kernels/nn_scaling_functions.hpp"
#include "nn_scaling_functions.hpp"
{% include "./_def_io.jinja" %} {% include "./_def_io.jinja" %}
{% include "./_meminfo.jinja" %} {% include "./_meminfo.jinja" %}
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
#ifndef {{ name|upper }}_LAYER_H #ifndef {{ name|upper }}_LAYER_H
#define {{ name|upper }}_LAYER_H #define {{ name|upper }}_LAYER_H
#include "typedefs.h" #include "kernels/nn_scaling_functions.hpp"
#include "nn_scaling_functions.hpp"
{# For layer configuration -#} {# For layer configuration -#}
{% include "./_def_io.jinja" %} {% include "./_def_io.jinja" %}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#ifndef {{ name|upper }}_LAYER_H #ifndef {{ name|upper }}_LAYER_H
#define {{ name|upper }}_LAYER_H #define {{ name|upper }}_LAYER_H
#include "typedefs.h" {# #include "typedefs.h" #}
{# For layer configuration -#} {# For layer configuration -#}
{% include "./_def_io.jinja" %} {% include "./_def_io.jinja" %}
......
{% filter indent(width=4, first=False) %}
{% include "./_mem_offset.jinja" %}
N2D2_Export::customconvcellPropagate<{{ in_name[0]|upper }}_NB_CHANNELS,
{{ in_name[0]|upper }}_IN_HEIGHT,
{{ in_name[0]|upper }}_IN_WIDTH,
{{ out_name[0]|upper }}_NB_OUTPUTS,
{{ out_name[0]|upper }}_OUT_HEIGHT,
{{ out_name[0]|upper }}_OUT_WIDTH,
{{ name|upper }}_PADDING_Y,
{{ name|upper }}_PADDING_X,
{{ name|upper }}_STRIDE_Y,
{{ name|upper }}_STRIDE_X,
{{ name|upper }}_KERNEL_HEIGHT,
{{ name|upper }}_KERNEL_WIDTH,
{{ name|upper }}_ACTIVATION, data<32>>
({{in_name[0]}}, {{out_name[0]}}, {{in_name[2]}}, {{in_name[1]}}, {{ name|upper }}_SCALING);
{% endfilter %}
{% filter indent(width=4, first=False) %}
{% include "./_mem_offset.jinja" %}
N2D2_Export::fccellPropagate<{{ in_name[0] | upper }}_NB_CHANNELS,
{{ in_name[0] | upper }}_IN_HEIGHT,
{{ in_name[0] | upper }}_IN_WIDTH,
{{ out_name[0] | upper }}_NB_OUTPUTS,
{{ out_name[0] | upper }}_OUT_HEIGHT,
{{ out_name[0] | upper }}_OUT_WIDTH,
{{name|upper}}_ACTIVATION,
data<32>>
({{ in_name[0] }}, {{ out_name[0] }}, {{ in_name[2] }}, {{ in_name[1] }}, {{ name | upper }}_SCALING);
{% endfilter %}
\ No newline at end of file
{% filter indent(width=4, first=False) %}
{% include "./_mem_offset.jinja" %}
N2D2_Export::custompoolcellPropagate<{{ in_name[0]|upper }}_NB_CHANNELS,
{{ in_name[0]|upper }}_IN_HEIGHT,
{{ in_name[0]|upper }}_IN_WIDTH,
{{ out_name[0]|upper }}_NB_OUTPUTS,
{{ out_name[0]|upper }}_OUT_HEIGHT,
{{ out_name[0]|upper }}_OUT_WIDTH,
{{ name|upper }}_PADDING_Y,
{{ name|upper }}_PADDING_X,
{{ name|upper }}_STRIDE_Y,
{{ name|upper }}_STRIDE_X,
{{ name|upper }}_KERNEL_HEIGHT,
{{ name|upper }}_KERNEL_WIDTH,
{{ name|upper }}_POOLING_TYPE,
{{ name|upper }}_ACTIVATION>
({{in_name[0]}}, {{out_name[0]}});
{% endfilter %}
#include <stdint.h>
#ifdef SAVE_OUTPUTS
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include "include/forward.hpp"
// Layer & memory configurations
{%- for header in headers %}
#include "{{ header }}"
{%- endfor %}
// blabla
// Memory block
{%- if mem_section == None %}
static {{mem_ctype}} mem[{{peak_mem}}];
{%- else %}
static {{mem_ctype}} mem[{{peak_mem}}] __attribute__((section("{{ mem_section }}")));
{%- endif %}
{# Forward function #}
{#- Support multiple inputs with different datatypes and multiple outputs with different datatypes -#}
void {{ func_name }} (
{%- for i in range(inputs_name | length) -%}
const {{ inputs_dtype[i] }}* {{ inputs_name[i] }},
{%- endfor -%}
{%- for o in range(outputs_name | length) -%}
{{ outputs_dtype[o] }}** {{ outputs_name[o] }}_ptr{% if not loop.last %}, {% endif %}
{%- endfor -%})
{
{%- for action in actions %}
{{ action }}
{%- endfor %}
{%- for output_name in outputs_name %}
*{{ output_name }}_ptr = {{ output_name }};
{%- endfor %}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment