From 621ad5a5bbcebe81eac1b7d621b5f423a56c7f36 Mon Sep 17 00:00:00 2001 From: Sioni Summers <14807534+thesps@users.noreply.github.com> Date: Mon, 18 Mar 2024 09:01:38 +0100 Subject: [PATCH 1/2] First commit adding namespace protection to different model versions. Compiles, not yet tested. --- AXOL1TL_v1/GTADModel_emulator_v1.cpp | 2 ++ AXOL1TL_v1/NN/GTADModel_v1.cpp | 2 ++ AXOL1TL_v1/NN/GTADModel_v1.h | 4 ++-- AXOL1TL_v1/NN/defines.h | 11 ++++++----- AXOL1TL_v1/NN/parameters.h | 3 ++- AXOL1TL_v1/NN/weights/b2.h | 3 ++- AXOL1TL_v1/NN/weights/b4.h | 3 ++- AXOL1TL_v1/NN/weights/b6.h | 3 ++- AXOL1TL_v1/NN/weights/w2.h | 3 ++- AXOL1TL_v1/NN/weights/w4.h | 3 ++- AXOL1TL_v1/NN/weights/w6.h | 3 ++- AXOL1TL_v3/GTADModel_emulator_v3.cpp | 4 ++-- AXOL1TL_v3/NN/GTADModel_v3.cpp | 2 ++ AXOL1TL_v3/NN/GTADModel_v3.h | 4 ++-- AXOL1TL_v3/NN/defines.h | 11 ++++++----- AXOL1TL_v3/NN/parameters.h | 2 ++ AXOL1TL_v3/NN/weights.h | 3 ++- AXOL1TL_v3/scales.h | 3 ++- 18 files changed, 44 insertions(+), 25 deletions(-) diff --git a/AXOL1TL_v1/GTADModel_emulator_v1.cpp b/AXOL1TL_v1/GTADModel_emulator_v1.cpp index 8eb9cb4..e39bbde 100644 --- a/AXOL1TL_v1/GTADModel_emulator_v1.cpp +++ b/AXOL1TL_v1/GTADModel_emulator_v1.cpp @@ -8,6 +8,8 @@ #include "ap_int.h" #include "scales.h" +using namespace hls4ml_axol1tl_v1; + class GTADModel_emulator_v1 : public hls4mlEmulator::Model { private: diff --git a/AXOL1TL_v1/NN/GTADModel_v1.cpp b/AXOL1TL_v1/NN/GTADModel_v1.cpp index 3eab8b1..f74706a 100644 --- a/AXOL1TL_v1/NN/GTADModel_v1.cpp +++ b/AXOL1TL_v1/NN/GTADModel_v1.cpp @@ -21,6 +21,8 @@ #include "GTADModel_v1.h" #include "parameters.h" +using namespace hls4ml_axol1tl_v1; + void GTADModel_v1( input_t input_1[N_INPUT_1_1], result_t layer7_out[N_LAYER_6] diff --git a/AXOL1TL_v1/NN/GTADModel_v1.h b/AXOL1TL_v1/NN/GTADModel_v1.h index b3836b5..f740076 100644 --- a/AXOL1TL_v1/NN/GTADModel_v1.h +++ b/AXOL1TL_v1/NN/GTADModel_v1.h @@ -28,8 +28,8 @@ // Prototype of top level function for C-synthesis void GTADModel_v1( - input_t input_1[N_INPUT_1_1], - result_t layer7_out[N_LAYER_6] + hls4ml_axol1tl_v1::input_t input_1[hls4ml_axol1tl_v1::N_INPUT_1_1], + hls4ml_axol1tl_v1::result_t layer7_out[hls4ml_axol1tl_v1::N_LAYER_6] ); #endif diff --git a/AXOL1TL_v1/NN/defines.h b/AXOL1TL_v1/NN/defines.h index ac94ba5..4f068f4 100644 --- a/AXOL1TL_v1/NN/defines.h +++ b/AXOL1TL_v1/NN/defines.h @@ -7,11 +7,12 @@ #include #include +namespace hls4ml_axol1tl_v1{ // hls-fpga-machine-learning insert numbers -#define N_INPUT_1_1 57 -#define N_LAYER_2 32 -#define N_LAYER_4 16 -#define N_LAYER_6 13 +static const int N_INPUT_1_1 = 57; +static const int N_LAYER_2 = 32; +static const int N_LAYER_4 = 16; +static const int N_LAYER_6 = 13; //hls-fpga-machine-learning insert layer-precision typedef ap_fixed<11,6> input_1_accum_t; @@ -40,5 +41,5 @@ typedef ap_fixed<10,7> result_t; typedef ap_fixed<18,8> mu_quantized_bits_table_t; typedef ap_ufixed<18,14> resultsq_t; typedef ap_fixed<18,13> unscaled_t; - +} #endif diff --git a/AXOL1TL_v1/NN/parameters.h b/AXOL1TL_v1/NN/parameters.h index 2a89478..7df3333 100644 --- a/AXOL1TL_v1/NN/parameters.h +++ b/AXOL1TL_v1/NN/parameters.h @@ -17,6 +17,7 @@ #include "weights/w6.h" #include "weights/b6.h" +namespace hls4ml_axol1tl_v1{ //hls-fpga-machine-learning insert layer-config // q_dense struct config2 : nnet::dense_config { @@ -98,6 +99,6 @@ struct linear_config7 : nnet::activ_config { static const unsigned reuse_factor = 1; typedef mu_quantized_bits_table_t table_t; }; - +} // namespace hls4ml_axol1tl_v1 #endif diff --git a/AXOL1TL_v1/NN/weights/b2.h b/AXOL1TL_v1/NN/weights/b2.h index ff9f0d7..c01c742 100644 --- a/AXOL1TL_v1/NN/weights/b2.h +++ b/AXOL1TL_v1/NN/weights/b2.h @@ -6,10 +6,11 @@ #ifndef B2_H_ #define B2_H_ +namespace hls4ml_axol1tl_v1{ #ifdef LOAD_WEIGHTS_FROM_TXT bias2_t b2[32]; #else bias2_t b2[32] = {-1.750, -5.750, -6.000, -9.000, -5.875, -6.750, -4.000, -8.125, -10.250, -1.250, -0.750, 2.500, -1.375, -1.375, -8.250, -1.125, -5.750, -7.750, -1.875, -10.875, -10.625, -2.000, -5.125, -4.000, -1.875, -2.375, -2.000, -3.000, -5.500, -2.875, -2.875, -8.000}; #endif - +} #endif diff --git a/AXOL1TL_v1/NN/weights/b4.h b/AXOL1TL_v1/NN/weights/b4.h index 08dd5cc..a749f4f 100644 --- a/AXOL1TL_v1/NN/weights/b4.h +++ b/AXOL1TL_v1/NN/weights/b4.h @@ -6,10 +6,11 @@ #ifndef B4_H_ #define B4_H_ +namespace hls4ml_axol1tl_v1{ #ifdef LOAD_WEIGHTS_FROM_TXT bias4_t b4[16]; #else bias4_t b4[16] = {0.250, 0.000, 0.125, 4.125, 0.625, 2.500, 1.125, 0.250, 0.375, 0.375, 0.000, -0.500, 2.750, 1.625, 0.250, -1.625}; #endif - +} #endif diff --git a/AXOL1TL_v1/NN/weights/b6.h b/AXOL1TL_v1/NN/weights/b6.h index c0943e9..fbc7197 100644 --- a/AXOL1TL_v1/NN/weights/b6.h +++ b/AXOL1TL_v1/NN/weights/b6.h @@ -6,10 +6,11 @@ #ifndef B6_H_ #define B6_H_ +namespace hls4ml_axol1tl_v1{ #ifdef LOAD_WEIGHTS_FROM_TXT bias6_t b6[13]; #else bias6_t b6[13] = {0.250, 1.625, -0.125, 0.000, 0.250, 0.375, 0.000, 0.000, 0.500, 2.125, 0.125, -0.750, 0.000}; #endif - +} #endif diff --git a/AXOL1TL_v1/NN/weights/w2.h b/AXOL1TL_v1/NN/weights/w2.h index c884b9b..bb1e2a8 100644 --- a/AXOL1TL_v1/NN/weights/w2.h +++ b/AXOL1TL_v1/NN/weights/w2.h @@ -6,10 +6,11 @@ #ifndef W2_H_ #define W2_H_ +namespace hls4ml_axol1tl_v1{ #ifdef LOAD_WEIGHTS_FROM_TXT weight2_t w2[1824]; #else weight2_t w2[1824] = {0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 1.125, 1.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, -0.250, 0.000, 0.000, 0.125, 0.125, 0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, -2.875, 2.625, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 1.125, 0.000, 0.000, 0.750, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, -0.250, 0.000, 0.000, 0.000, -3.000, -0.375, 0.000, 2.375, -0.125, 0.000, 0.000, 0.125, 0.125, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.875, -0.125, 0.000, -0.125, -0.125, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.875, 0.000, 0.000, 0.000, 0.000, 0.000, -0.250, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 3.875, 0.000, 0.000, -0.625, 0.000, 0.000, 0.125, 0.000, -0.500, 0.000, 0.000, -0.125, 0.125, -3.500, 0.000, -0.125, 0.000, -0.125, 0.000, 0.375, 0.375, 0.000, 0.125, 0.000, 0.000, 0.125, -0.125, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.125, 0.125, 0.000, 0.125, 0.000, -0.125, -0.125, 0.125, 0.000, -0.125, 0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.125, 0.250, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.250, 0.000, 0.125, 0.000, 0.000, 0.000, 0.125, 2.125, -0.125, -0.125, -0.125, 0.000, -0.125, 0.000, 0.000, 0.125, 0.125, 0.000, -0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.375, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, 0.750, -0.125, 0.000, -0.250, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.125, 0.000, 0.875, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -2.875, 0.250, -0.125, -0.250, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, 3.000, 0.000, 0.000, 0.125, -0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.125, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.375, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, -0.250, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.375, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.250, 0.000, 0.000, 0.250, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, -0.250, -0.375, 0.000, 0.250, 0.000, 0.125, -0.125, -0.125, 0.000, 0.125, 0.125, 0.250, 0.000, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.125, 0.125, 0.000, -0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 1.000, 0.000, 0.375, 1.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 1.125, 0.125, 0.000, 0.375, -0.375, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.875, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -4.000, 0.125, 0.000, -3.000, 0.000, 0.125, 0.125, 0.000, 0.000, 0.000, 0.000, 3.375, -0.125, -0.125, 0.125, -0.375, 0.000, 0.000, 0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 3.875, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, -0.125, 0.000, -0.125, 0.125, 0.000, -0.125, 1.125, 0.125, 0.000, -0.125, 0.000, -0.250, 0.000, 0.000, 0.375, 0.125, -0.125, 0.000, 1.375, 0.250, 0.000, 0.750, 0.000, -0.125, 0.125, 0.000, 0.500, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 1.625, 0.125, 0.000, 0.000, 0.000, 0.250, 0.000, 0.125, 3.875, 0.000, -0.125, 0.000, -3.875, -4.000, 0.000, 3.875, 0.000, 0.000, 0.000, -0.250, -4.000, 0.375, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.250, 0.125, 0.000, -0.125, 0.000, 0.875, 0.000, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, -0.250, 0.000, -0.125, -0.125, 0.000, 0.875, 0.000, 0.375, 1.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.125, -1.000, 0.000, 0.000, 0.000, 0.000, -4.000, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.875, 1.000, 0.125, 0.500, 0.000, 0.000, 3.875, -0.250, -1.500, -4.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.125, 0.000, 0.000, -0.125, -0.125, -0.125, 0.000, 1.500, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 1.500, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -2.750, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 2.625, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, -0.250, -0.125, -0.125, 0.000, 0.000, 2.000, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 2.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 3.250, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -3.375, 0.000, -0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 1.500, 0.125, -0.125, 1.625, 0.000, 0.125, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.125, 0.000, 0.000, 0.125, -0.125, 0.000, 0.000, -0.125, 0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.125, 0.000, -0.125, 3.625, 0.000, 0.000, -3.875, 0.000, 0.000, 0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.125, 0.000, 0.000, 0.125, -0.125, 0.000, 0.000, -0.125, 0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 1.375, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 1.375, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.125, 0.000, 0.000, 0.125, 0.000, 1.625, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -1.750, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, 0.000, -0.125, 0.000, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, 0.625, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, -1.000, -0.500, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -0.625, -0.375, 0.000, 0.500, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, -0.250, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -1.625, 0.750, -0.125, 0.000, 0.375, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.250, -0.250, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.500, 0.000, 0.000, -0.500, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.250, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000}; #endif - +} #endif diff --git a/AXOL1TL_v1/NN/weights/w4.h b/AXOL1TL_v1/NN/weights/w4.h index 19f4367..5601dd5 100644 --- a/AXOL1TL_v1/NN/weights/w4.h +++ b/AXOL1TL_v1/NN/weights/w4.h @@ -6,10 +6,11 @@ #ifndef W4_H_ #define W4_H_ +namespace hls4ml_axol1tl_v1{ #ifdef LOAD_WEIGHTS_FROM_TXT weight4_t w4[512]; #else weight4_t w4[512] = {-0.125, 0.750, 0.000, 0.000, 0.000, 0.000, 0.000, -0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, -0.125, 0.000, 0.000, 0.000, -0.250, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.625, 0.375, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.375, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.750, -0.125, 0.000, 0.000, 0.000, 0.000, 0.875, 0.000, 0.625, 0.000, -0.125, 0.000, -0.250, 0.000, 0.000, 0.750, -0.125, -0.125, -0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.375, 0.000, 0.500, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.500, 0.000, 0.000, -0.125, 0.000, 0.625, -0.125, 0.500, 0.000, 0.000, 0.000, 0.000, 0.000, -1.750, 0.000, 0.000, 0.000, 0.000, 0.000, 1.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 1.375, 0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -2.125, -0.125, 0.000, 0.500, 0.000, -0.250, 0.125, 0.625, 0.000, -0.250, 0.000, 0.000, -0.500, 0.625, 0.500, -0.125, -0.125, 0.000, 0.250, 0.000, 0.000, -0.125, -0.125, 0.000, 0.375, 0.000, -0.125, -0.250, 0.000, 0.000, 0.125, 0.000, -0.125, -0.625, 0.000, 0.000, 0.000, 0.000, 0.875, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -1.000, -0.125, 0.000, 0.000, 0.000, -0.625, -0.125, -0.375, 0.000, 0.000, -0.125, 0.000, 0.375, 0.250, -0.375, 0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.250, 0.000, 0.000, 0.000, -0.125, 0.000, 0.625, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.875, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.625, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, -1.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.250, 0.000, 0.000, 0.000, 0.125, 0.000, 0.500, 0.000, 0.000, 0.000, 0.000, 0.000, -0.625, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.375, 0.000, 0.000, -0.125, -0.125, 0.625, 0.000, -0.125, 0.000, 0.000, -0.125, -0.125, 0.000, -0.125, 0.125, 0.000, 0.000, 0.875, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, -0.250, 0.000, 0.000, -0.125, 0.000, -1.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.875, 0.000, 0.000, -0.750, 0.000, -0.250, 0.000, 0.500, 0.000, 1.125, 0.000, 0.000, -0.500, 0.500, 0.500, 0.750, 0.000, -0.125, 0.000, -0.375, 0.000, 0.625, -0.125, -0.250, 0.000, 0.625, -0.125, 0.000, 0.750, -0.250, -0.125, 0.375, 0.125, 0.000, -0.250, 0.000, 0.000, 0.000, -0.125, 0.000, -0.625, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.750, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.625, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, 0.125, 0.375, 0.000, 0.000, 1.000, 0.000, 0.000, 0.000, 0.000, 0.000, -3.375, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.750, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.625, 0.000, 0.000, 0.000, 0.125, 0.125, -0.500, -0.125, 0.000, 0.000, 0.000, 0.500, 0.000, 0.500, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.625, 0.000, -0.125, -0.125, 0.000, -0.125, 0.375, -0.375, 0.125, 0.000, -0.125, -1.625, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 1.250, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.125, 0.000, 0.250, 0.000, -0.125, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.500, 0.000, 0.000, 0.000, 0.375, 0.000, 0.000, -0.125, 0.000, 0.125, -0.500, 0.000, 0.000, -0.250, -0.125, 0.000, 0.000, 0.000, 0.000, 0.625, 0.750, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, -0.125, 0.000, -1.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -1.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.750, 0.000}; #endif - +} #endif diff --git a/AXOL1TL_v1/NN/weights/w6.h b/AXOL1TL_v1/NN/weights/w6.h index 29828e2..2e85a4a 100644 --- a/AXOL1TL_v1/NN/weights/w6.h +++ b/AXOL1TL_v1/NN/weights/w6.h @@ -6,10 +6,11 @@ #ifndef W6_H_ #define W6_H_ +namespace hls4ml_axol1tl_v1{ #ifdef LOAD_WEIGHTS_FROM_TXT weight6_t w6[208]; #else weight6_t w6[208] = {0.500, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.375, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.750, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.750, 0.000, 0.000, 0.000, -0.500, -0.125, 0.000, 0.625, -0.125, 0.000, 0.000, -0.125, -0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.500, 0.000, -0.250, 0.750, 0.000, -0.375, 0.000, 0.000, 0.000, -0.375, 0.125, 0.125, 0.000, 0.000, -0.375, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.500, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.500, 0.000, 0.000, 0.000, 0.375, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.625, 0.000, 0.000, -0.500, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.375, 0.000, 0.000, 0.375, -0.375, 0.000, 0.125, 0.000, 0.000, 0.000, -0.500, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.250, 0.000, 0.250, 0.000, 0.000, 0.000, 0.625, 0.125, 0.000, 0.000, 0.000, 0.000, -0.375, -0.500, 0.000, -0.625, 0.000, 0.000, 0.000, 0.250, -0.125, -0.125, 0.000, 0.000, 0.000, 0.125, 0.250, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, -0.875, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.625, 0.250, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.375, 0.000}; #endif - +} #endif diff --git a/AXOL1TL_v3/GTADModel_emulator_v3.cpp b/AXOL1TL_v3/GTADModel_emulator_v3.cpp index e64a5e0..8ef9361 100644 --- a/AXOL1TL_v3/GTADModel_emulator_v3.cpp +++ b/AXOL1TL_v3/GTADModel_emulator_v3.cpp @@ -8,6 +8,8 @@ #include "ap_int.h" #include "scales.h" +using namespace hls4ml_axol1tl_v3; + class GTADModel_emulator_v3 : public hls4mlEmulator::Model { private: @@ -74,7 +76,6 @@ class GTADModel_emulator_v3 : public hls4mlEmulator::Model { } result_p->second = _loss; } - }; extern "C" hls4mlEmulator::Model* create_model() { @@ -84,4 +85,3 @@ extern "C" hls4mlEmulator::Model* create_model() { extern "C" void destroy_model(hls4mlEmulator::Model* m) { delete m; } - diff --git a/AXOL1TL_v3/NN/GTADModel_v3.cpp b/AXOL1TL_v3/NN/GTADModel_v3.cpp index 09e53b6..667045c 100644 --- a/AXOL1TL_v3/NN/GTADModel_v3.cpp +++ b/AXOL1TL_v3/NN/GTADModel_v3.cpp @@ -24,6 +24,8 @@ //from https://gitlab.cern.ch/ssummers/run3_ugt_ml/-/blob/axol1tl_v3/ugt_hls/src/anomaly_detection/Axol1tl_v3.h +using namespace hls4ml_axol1tl_v3; + void GTADModel_v3( input_t input_3[N_INPUT_1_1], result_t layer7_out[N_LAYER_6] diff --git a/AXOL1TL_v3/NN/GTADModel_v3.h b/AXOL1TL_v3/NN/GTADModel_v3.h index 7ebc611..915e3e3 100644 --- a/AXOL1TL_v3/NN/GTADModel_v3.h +++ b/AXOL1TL_v3/NN/GTADModel_v3.h @@ -30,8 +30,8 @@ //from https://gitlab.cern.ch/ssummers/run3_ugt_ml/-/blob/axol1tl_v3/ugt_hls/src/anomaly_detection/Axol1tl_v3.h void GTADModel_v3( - input_t input_3[N_INPUT_1_1], - result_t layer7_out[N_LAYER_6] + hls4ml_axol1tl_v3::input_t input_3[hls4ml_axol1tl_v3::N_INPUT_1_1], + hls4ml_axol1tl_v3::result_t layer7_out[hls4ml_axol1tl_v3::N_LAYER_6] ); #endif diff --git a/AXOL1TL_v3/NN/defines.h b/AXOL1TL_v3/NN/defines.h index 07cfd4f..35bfa7e 100644 --- a/AXOL1TL_v3/NN/defines.h +++ b/AXOL1TL_v3/NN/defines.h @@ -7,13 +7,13 @@ #include #include - +namespace hls4ml_axol1tl_v3 { // hls-fpga-machine-learning insert numbers //copied from https://gitlab.cern.ch/ssummers/run3_ugt_ml/-/blob/axol1tl_v3/ugt_hls/src/anomaly_detection/Axol1tl_v3.h -#define N_INPUT_1_1 57 -#define N_LAYER_2 32 -#define N_LAYER_4 16 -#define N_LAYER_6 8 //changed v3 +static const int N_INPUT_1_1 = 57; +static const int N_LAYER_2 = 32; +static const int N_LAYER_4 = 16; +static const int N_LAYER_6 = 8; //changed v3 //hls-fpga-machine-learning insert layer-precision //copied from https://gitlab.cern.ch/ssummers/run3_ugt_ml/-/blob/axol1tl_v3/ugt_hls/src/anomaly_detection/Axol1tl_v3.h @@ -54,4 +54,5 @@ extern bias4_t b4[16]; extern weight6_t w6[128]; extern bias6_t b6[8]; +} // namespace hls4ml_axol1tl_v3 #endif diff --git a/AXOL1TL_v3/NN/parameters.h b/AXOL1TL_v3/NN/parameters.h index 9c47f43..aa9355b 100644 --- a/AXOL1TL_v3/NN/parameters.h +++ b/AXOL1TL_v3/NN/parameters.h @@ -16,6 +16,7 @@ #include "defines.h" #include "weights.h" +namespace hls4ml_axol1tl_v3 { //from https://gitlab.cern.ch/ssummers/run3_ugt_ml/-/blob/axol1tl_v3/ugt_hls/src/anomaly_detection/Axol1tl_v3.h //hls-fpga-machine-learning insert layer-config @@ -106,5 +107,6 @@ struct linear_config7 : nnet::activ_config { typedef mu_quantized_bits_table_t table_t; }; +} // namespace hls4ml_axol1tl_v3 #endif diff --git a/AXOL1TL_v3/NN/weights.h b/AXOL1TL_v3/NN/weights.h index 4fc2f12..9d98737 100644 --- a/AXOL1TL_v3/NN/weights.h +++ b/AXOL1TL_v3/NN/weights.h @@ -2,11 +2,12 @@ #define AXOL1TL_V3_WEIGHTS_H_ #include "defines.h" +namespace hls4ml_axol1tl_v3 { weight2_t w2[1824] = {0.125, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.125, -0.125, 0.125, 0.125, -0.125, 0.000, 0.000, -0.125, 0.125, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.250, 0.000, -0.125, -0.250, 0.125, -0.125, 0.125, 0.125, -0.250, 0.000, -0.125, 0.000, 0.250, 0.000, 0.000, -0.125, -0.250, 0.125, 0.000, 0.000, -0.250, -0.250, 0.125, 0.250, 0.000, -0.125, -0.250, -0.250, 0.125, 0.125, -0.125, 0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.125, 0.000, 0.250, 0.125, 0.000, 0.125, -0.125, 0.125, -0.250, 0.375, 0.500, 0.125, -0.125, 0.000, -0.250, 0.375, 0.250, -0.125, -0.125, 0.000, -0.250, 0.125, 0.000, 0.250, 0.000, 0.000, 0.250, -0.125, 0.500, -0.125, 0.250, -0.250, 0.125, 0.000, -0.125, 0.250, 0.375, -0.375, -0.125, 0.125, -0.375, -1.125, -0.875, 0.000, -0.250, 0.250, 0.125, -0.375, -0.250, 0.250, 0.000, -0.125, 0.125, 0.000, 0.000, 0.500, -0.250, -0.125, 0.375, 0.000, 0.875, 0.125, 0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, -0.125, -0.375, -0.125, -0.125, 0.125, -0.125, 0.000, 0.125, -0.125, -0.125, 0.750, -0.125, 0.000, 0.000, -0.250, -0.125, 0.000, 0.000, -0.500, -0.250, 0.125, 0.375, -0.125, 0.375, 0.125, -0.125, -0.125, 0.000, 0.000, 0.125, -0.625, 0.125, 0.000, 0.875, -0.750, 0.250, 0.250, 0.125, 0.125, -0.125, 0.000, 0.000, -1.625, 0.250, -0.125, -0.125, 0.250, 0.125, 0.125, -0.375, 0.000, 0.250, 0.125, 1.125, 0.125, 1.000, -0.375, -0.625, 0.125, 0.000, 0.250, 0.500, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, -0.125, 0.000, 0.000, -0.125, 0.125, 0.000, 0.000, 0.000, 0.125, 0.000, 0.375, -0.250, -1.000, -0.750, -0.125, -0.750, 0.000, -0.375, -0.125, 0.125, 0.000, -0.125, 0.125, -0.500, 0.125, -0.625, -1.125, -0.375, 0.250, 0.000, -0.375, -0.625, 0.375, 0.125, -0.500, -0.125, 0.250, 0.000, 0.125, 0.250, -1.125, 0.375, -1.125, 0.125, 0.000, -0.125, -0.250, -0.250, 0.250, -0.125, -0.125, -0.125, 0.125, -0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, -0.250, -0.125, -0.500, 0.000, 0.250, 1.250, 0.000, 0.000, -0.125, 0.375, 0.250, 0.000, 0.125, 0.000, 0.125, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, -0.125, 0.125, 0.250, 0.000, 0.000, -0.125, 0.000, 0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.125, 0.125, 0.000, 0.250, 0.000, 0.125, 0.125, -0.125, 0.125, 0.375, 0.000, 0.125, 0.125, -0.125, 0.500, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, -0.125, -0.250, 0.000, 0.000, 0.250, 0.750, -0.125, 0.125, -0.250, -0.250, 0.125, 0.000, 0.000, 0.375, 0.000, -0.125, 0.000, 0.000, -0.125, -0.625, 0.000, -0.125, 0.000, 0.000, -2.500, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.375, -0.125, -0.125, 0.000, 0.000, 0.000, 2.875, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.375, 0.125, 0.000, 0.250, 0.125, 0.000, 0.250, 0.000, 0.125, 0.125, 0.000, 0.125, -0.125, -0.125, 0.125, -0.125, 0.250, 0.250, 0.125, 0.000, -0.125, 0.000, 0.125, -0.125, 0.000, 0.000, 0.000, 0.125, 0.125, -0.125, -0.125, 0.375, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, -0.250, 0.000, 0.625, 0.000, 0.250, -0.250, 0.000, -0.125, -0.125, 0.000, 0.000, -0.250, -0.125, -0.125, -0.125, -0.125, 0.875, 0.125, -0.125, -0.125, 0.000, 0.000, -0.125, 0.000, -0.125, -0.250, 0.250, 0.000, 0.000, 0.000, 0.125, -0.250, 0.500, 0.000, -2.750, 0.000, 0.250, -0.250, 0.000, 0.000, -0.375, 0.125, -0.125, -0.125, 0.000, 0.000, 0.125, 0.000, 2.500, 0.375, 0.000, -0.125, 0.000, -0.125, -0.125, -0.125, 0.000, 0.000, -0.375, 0.125, 0.125, 0.375, 0.375, 0.125, 0.500, -0.125, 0.000, 0.125, 0.000, 0.125, 0.125, 0.000, 0.250, -0.250, 0.375, 0.625, 0.250, -0.125, -0.125, 0.000, 0.000, -0.250, 0.000, 0.250, 0.250, 0.000, 0.000, -0.125, 0.000, 0.625, -0.125, 0.375, 0.000, 0.000, 0.000, 1.125, 0.000, -0.125, 0.125, 0.000, 0.500, -0.250, 0.000, -0.125, 0.000, 0.125, 0.000, -0.250, 0.000, -0.125, 0.125, 0.625, 0.000, 0.250, -0.500, 0.000, -0.250, 0.250, -0.125, -0.125, 0.125, -0.125, -0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.250, 0.000, -0.125, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, -0.125, 0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, -0.250, 0.000, 0.000, 0.000, -0.125, 0.125, -0.625, -0.500, 0.000, -0.375, 1.125, -0.250, -0.125, 0.125, -0.250, -0.625, -0.750, -2.125, -0.375, -0.375, -0.250, -0.125, 0.125, -0.375, -0.125, -0.375, -0.375, 0.375, -0.375, 1.250, -0.125, 0.125, -0.375, -0.125, 0.750, -0.125, -0.125, 0.875, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.250, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.375, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, 0.125, -0.125, 0.000, 0.125, 0.000, 0.000, -0.125, 0.000, -0.125, 0.000, -1.500, 0.000, 0.000, 0.000, 0.000, -0.125, -3.000, 0.000, -0.125, 0.000, -0.125, 0.000, -0.250, 0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.125, 0.250, 0.250, 0.375, 0.125, -0.250, -0.125, 0.250, -4.000, -4.000, -3.375, 0.250, 0.125, -2.250, -4.000, -4.000, 0.125, 0.375, -0.125, 0.125, -2.125, 0.125, -0.125, 0.125, -3.625, 0.250, 0.125, 0.125, 0.250, -0.375, 0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.250, -0.500, 0.750, 0.000, 0.000, -0.750, -0.500, -1.625, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.125, -0.125, 0.125, 0.000, 0.000, 0.000, 0.000, 0.375, -2.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.125, 0.000, -0.125, -4.000, -4.000, -3.125, 0.000, 0.000, -2.375, -4.000, -4.000, 0.000, -0.250, 0.125, 0.000, -3.250, 0.000, 0.125, 0.000, -3.250, 0.000, 0.000, 0.000, 0.000, -0.250, 0.000, -0.125, -0.125, -0.250, -0.125, -0.250, 0.000, -0.250, 1.000, -0.500, 0.500, -0.125, 0.000, -0.125, 0.625, -0.250, -0.125, 0.625, 0.000, -0.125, -0.250, -0.375, 0.500, -0.125, -0.125, -0.125, 0.000, -0.125, 0.375, -0.125, -0.250, 0.250, 0.250, 0.375, 0.250, -0.125, -0.375, 0.250, 0.125, 0.125, 3.875, 0.375, -1.500, 0.000, 0.125, 0.250, -2.000, 1.375, 0.000, -4.000, 0.500, 0.000, 0.000, 0.250, -1.250, 0.125, 0.000, -0.125, 0.125, 0.250, 1.500, -0.250, 0.000, -0.750, 0.125, 0.000, -0.125, -0.125, -0.125, 0.000, -0.125, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.875, -0.125, -0.250, -0.250, -0.250, 0.000, -0.125, 0.000, -0.375, 0.000, -0.125, 0.125, -0.125, 0.375, 0.375, -0.125, -0.125, 0.125, 0.000, -0.250, -0.125, 0.000, -0.250, 0.000, -0.125, -0.125, 0.000, 0.125, 0.500, -0.250, 0.125, 0.000, -3.375, 0.000, -0.125, -0.125, 0.125, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, -0.375, 1.125, 3.250, 0.125, -0.125, 0.000, -0.125, 0.125, 0.000, -1.375, 0.000, 0.125, 0.000, 0.000, -0.125, 0.000, 1.750, 0.000, 0.375, 0.125, 0.000, -0.125, 0.000, -0.125, -0.125, -0.125, 0.250, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.125, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.125, -0.125, -0.125, 0.000, 0.125, -0.375, 0.000, -0.250, 0.875, -0.125, -0.375, -0.125, -0.250, 0.125, 0.000, 0.000, 1.000, -0.125, -0.250, -0.625, -0.125, 0.125, 0.750, -0.250, -0.625, 0.000, -0.125, -0.125, 0.000, 0.000, -0.250, 0.250, 0.375, -0.375, 0.125, 0.000, 0.500, 0.000, -0.500, 0.250, 3.375, 0.000, -0.125, -0.125, 0.250, -0.375, 0.000, 0.000, -3.250, 0.625, 0.500, -0.500, -0.125, -0.125, 1.375, -0.125, 0.375, -0.625, 0.000, 0.000, 0.000, -0.250, -0.125, 0.500, -1.375, -0.125, 0.750, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, -0.125, 1.250, -0.375, -0.375, -0.125, -0.500, 0.000, -0.250, -0.125, 0.000, 0.625, 0.000, 0.125, -0.125, 1.375, 0.000, -0.125, 0.625, -0.250, -0.500, 0.000, -0.500, 0.125, 0.000, -0.250, 0.500, 0.000, 0.000, -0.375, 0.125, 0.125, -0.125, 0.000, -1.875, 0.125, -0.250, -0.125, 0.000, 0.125, 0.125, 0.000, 0.000, -0.750, 0.000, -0.125, -0.125, 2.125, 0.000, -0.125, 0.875, 0.125, -0.125, 0.125, -0.250, -0.125, 0.000, 0.125, 0.500, -0.250, 0.250, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.000, 0.125, 0.000, 0.125, -0.125, 0.000, -0.125, -0.125, -0.250, 0.000, 1.125, -0.125, -0.250, 0.000, 0.000, -0.125, 0.000, -0.250, 0.000, 0.000, 0.250, 0.000, 0.000, 0.000, 0.125, 0.000, 0.125, 0.125, -0.250, -0.250, 0.000, -0.250, 0.000, 0.125, -0.250, 0.125, 0.000, 0.000, 1.250, 0.000, 0.125, -0.125, 0.875, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.875, 0.000, 0.000, 0.000, -0.125, 0.000, 0.125, 0.125, 0.000, 0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.125, 0.125, 0.000, -0.125, 0.125, 0.375, 0.000, 0.000, 0.125, 0.125, 0.000, 0.125, 0.000, 0.000, -0.125, -0.125, -0.125, 0.125, 0.125, 0.000, -0.625, 0.125, 0.000, 0.250, 0.125, -0.125, 0.125, 0.125, 0.000, 0.125, 0.000, 0.250, 0.125, 0.125, 0.125, 0.000, -0.125, 0.375, -0.250, -0.125, 0.125, 0.125, -0.125, 0.250, -0.125, -0.125, 0.125, -0.250, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, -0.375, 0.000, -0.125, 0.000, -2.250, 0.000, 0.375, -0.375, 0.000, -0.250, -0.125, -0.750, 0.125, 0.000, 0.000, 0.000, -0.125, -0.125, 0.375, 0.000, -0.375, -0.750, 0.125, -1.125, -0.875, -0.250, -0.750, 0.375, 0.000, 0.125, 0.000, 0.125, 0.000, -0.125, 0.000, 0.000, -0.125, 0.000, -0.375, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, -0.625, 0.000, 0.000, 0.125, -1.500, 0.125, 0.125, -0.125, -0.750, -0.125, -0.125, -0.250, -0.125, 0.000, -0.625, 0.000, 0.000, -0.375, 0.000, 0.000, -0.125, -1.750, 0.375, 0.000, -1.000, 0.625, -3.375, 0.125, -0.125, 0.125, 0.000, 0.000, 0.125, 0.125, 0.125, 0.000, 0.500, -0.125, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.125, 0.000, 0.000, 0.000, 0.125, 0.000, -0.250, -0.375, 0.250, 0.000, 0.500, 0.125, -0.125, 0.000, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.125, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, 0.000, -0.125, 0.000, 0.000, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, -0.250, 0.000, -0.375, 0.000, 0.000, -3.750, 0.125, -0.125, 0.000, 0.000, 0.000, -4.000, 0.125, 0.125, 0.125, -4.000, 0.000, 0.000, -4.000, -0.375, 0.750, -0.625, -4.000, -4.000, 0.000, -0.375, -0.625, 0.000, -3.875, 0.125, 0.000, 0.000, -1.250, 0.000, -4.000, -2.375, 0.125, -4.000, 0.250, 0.500, 0.250, 0.000, -1.000, -0.625, 0.000, 0.000, 0.000, -0.875, 0.000, 0.000, -0.625, 0.000, -0.625, 0.375, 0.000, -0.375, 0.000, -0.125, -0.125, -0.125, -0.250, 0.125, 0.125, 0.000, 0.375, -0.125, 1.000, -0.125, -0.125, -2.625, 0.125, 0.625, 0.250, -0.125, -0.250, -4.000, 0.000, -0.125, 0.000, -3.875, 0.000, 0.000, -4.000, 0.000, -0.125, -0.125, -4.000, -4.000, 0.000, 0.000, 0.125, 0.000, -4.000, 0.000, 0.000, 0.000, -0.625, 0.000, -4.000, -2.125, 0.000, -4.000, 0.125, -0.125, 0.000, -0.125, -1.500, -4.000, -0.125, 0.000, 0.125, -4.000, 0.125, 0.125, -4.000, -3.125, 0.000, -3.875, -4.000, -4.000, 0.000, -1.375, -0.750, -1.875, -4.000, 0.250, -0.250, 1.000, -4.000, 0.125, -3.875, -2.750, 0.250, 3.875, 0.625, -0.125, 0.125, 0.000, -4.000, 3.000, 0.000, 0.000, 0.375, 3.875, -0.125, 0.000, 1.750, 0.500, 0.125, -0.750, 3.875, 0.875, 0.000, -0.500, 0.000, 0.375, -0.125, -0.125, -0.125, 0.625, -1.125, -0.125, 3.500, 2.375, -0.125, 3.875, -0.125, 0.000, -0.125, 0.000, 1.125, -4.000, 0.000, -0.125, 0.000, -4.000, 0.000, 0.000, -4.000, -3.250, 0.000, -3.875, -4.000, -4.000, -0.125, -1.375, 0.000, 0.125, -4.000, 0.000, -0.125, 0.000, -4.000, 0.000, -4.000, -2.375, 0.000, -4.000, 0.000, 0.000, 0.000, 0.000, -4.000}; bias2_t b2[32] = {0.750, -1.375, -1.375, -1.250, 0.625, -1.625, -0.375, -1.875, -2.000, 0.000, 0.125, -0.375, -0.875, -2.250, -0.875, -1.125, -0.875, -1.750, -0.250, -1.125, 0.125, -0.500, -0.875, 0.000, -0.750, 0.375, 1.000, -0.250, -0.625, -1.250, -1.750, -0.250}; weight4_t w4[512] = {0.125, -4.000, -4.000, 0.000, 0.000, -0.125, -0.125, 0.375, 0.125, 0.000, -0.125, -0.125, 0.500, -0.125, -0.125, -4.000, 0.125, -4.000, -3.125, 0.000, 0.125, 0.750, -0.875, 0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, -4.000, 0.250, -4.000, -4.000, -0.125, 0.125, 0.000, -0.125, -0.125, 0.000, 0.125, 0.000, 0.125, -0.375, 0.375, -0.125, -4.000, -0.125, -4.000, -4.000, 0.375, 0.250, 0.000, 0.000, 0.000, 0.000, 0.125, -0.125, 0.375, -0.125, 0.000, -0.250, -4.000, 0.000, -4.000, -4.000, -0.250, 0.000, 0.000, 0.000, -0.125, -0.125, 0.000, 0.000, 0.375, 0.250, -0.500, -0.500, -4.000, 0.125, -4.000, -4.000, 0.125, 0.000, -0.125, 0.000, 0.250, 0.125, -0.375, -0.125, 0.250, -0.125, 0.125, -0.250, -4.000, 0.000, -4.000, -4.000, 0.000, 0.000, -0.125, 0.000, -0.125, 0.375, -0.125, 0.000, -0.125, -0.125, 0.125, 0.000, -4.000, -0.125, -4.000, -4.000, -0.125, 0.250, -0.125, 0.000, 0.250, 0.250, -0.625, 0.000, 0.500, -0.125, 0.250, -0.250, -1.000, 0.500, -4.000, -1.375, 0.250, 0.625, -0.250, -0.125, -0.375, -0.125, 0.000, 0.000, -0.125, 0.375, -0.625, 0.125, -4.000, -0.250, -4.000, -3.125, -0.250, 0.375, -0.250, 0.000, 0.250, 0.000, 0.125, 0.000, 0.000, 0.000, 0.125, 0.250, -4.000, -0.250, -4.000, -4.000, -0.125, 0.250, -0.250, 0.000, 0.250, 0.000, 0.250, -0.125, -0.125, -0.125, -0.125, 0.000, -4.000, 0.000, -4.000, -1.125, 0.000, 0.000, 0.000, -0.125, -0.250, 0.625, -0.125, 0.000, 0.000, 0.250, -0.125, -0.125, 0.125, 0.125, -4.000, 0.625, 0.125, 0.125, -0.125, -0.125, 0.125, 0.125, 0.250, -0.375, 0.250, 0.250, -0.125, -0.250, -4.000, -0.125, -4.000, -3.250, 0.125, 0.000, 0.125, -0.125, -0.125, 0.000, 0.625, -0.125, -0.375, 0.250, -0.250, 0.250, -4.000, 0.000, -4.000, -4.000, 0.000, -0.250, -0.250, 0.250, 0.250, 0.125, 0.125, 0.000, 0.125, 0.000, 0.125, -0.125, -4.000, 0.000, -4.000, -1.000, 0.125, -0.125, -0.625, 0.625, -0.125, 0.000, 0.000, 0.000, 0.000, 0.000, -0.125, -0.125, -4.000, 0.250, -4.000, -2.625, -0.250, -0.125, 0.000, 0.000, 0.125, 0.125, 0.000, 0.000, -0.375, 0.000, -0.125, 0.250, -4.000, -0.250, -4.000, -4.000, -0.375, -0.250, 0.000, 0.000, 0.625, 0.250, 0.250, 0.125, 0.125, -0.125, 0.125, -0.375, -4.000, 0.125, -4.000, -3.625, 0.125, 0.125, 0.000, 0.000, 0.250, -0.250, 0.125, -0.125, -0.125, -0.250, 0.125, 0.000, -3.250, 0.375, -4.000, -4.000, 0.000, 0.000, 0.000, 0.000, 0.250, 0.125, 0.000, -0.125, 0.125, 0.125, -0.125, 0.125, -4.000, -0.125, -4.000, -2.250, 0.375, 0.125, 0.000, -0.250, -0.125, -0.125, -0.125, 0.500, 0.000, 0.125, 0.125, -0.250, -4.000, 0.000, -4.000, -1.375, -0.125, -0.125, 0.125, -0.250, -0.250, 0.000, 0.500, 0.250, -0.125, 0.000, -0.250, -0.125, -4.000, 0.000, -4.000, -4.000, 0.000, 0.000, 0.250, -0.125, 0.250, 0.125, 0.125, 0.000, 0.000, 0.125, 0.250, 0.125, -4.000, 0.250, -4.000, -4.000, -0.250, -0.125, 0.000, 0.000, 0.125, 0.000, -0.125, 0.375, -0.250, 0.125, -0.125, 0.375, -4.000, 0.125, -4.000, -4.000, -0.125, 0.000, 0.000, -0.125, 0.250, -0.625, 0.125, 0.000, 0.000, 0.000, -0.125, 0.000, -1.125, 0.125, -4.000, -4.000, 0.125, 0.250, -0.125, 0.000, -0.125, 0.000, -0.125, 0.125, -0.250, -0.375, 0.125, 0.250, -3.375, 0.500, -4.000, -3.000, -0.250, 0.125, -0.125, -0.250, -0.125, 0.125, 0.375, 0.000, 0.375, -0.125, -0.875, -0.375, -4.000, 0.125, -4.000, -1.125, 0.125, 0.000, 0.000, 0.000, 0.000, 0.250, 0.125, -0.375, -0.250, -0.250, 0.125, 0.125, -4.000, 0.250, -4.000, -4.000, 0.375, -0.125, 0.125, -0.250, 0.000, 0.125, 0.000, 0.125, 0.125, 0.125, 0.000, -0.125, -4.000, 0.000, -4.000, -4.000, 0.125, -0.125, -0.375, 0.500, 0.000, 0.125, 0.125, 0.000, 0.000, 0.125, 0.125, 0.125, -4.000, -0.125, -4.000, -4.000, 0.375, -0.125, 0.000, 0.000, 0.375, 0.000, -0.125, -0.125, -0.250, 0.375, -0.375, 0.250, -4.000, 0.125, -4.000, -2.625, 0.000, 0.125, -0.250, 0.250, 0.250, 0.125, 0.125, 0.250, 0.125, -0.125, 0.000, 0.000, -4.000}; bias4_t b4[16] = {0.500, 0.250, 0.750, 1.750, 0.625, -1.125, -0.875, 1.250, 1.250, 0.875, 0.750, -0.125, 0.750, 0.250, 0.750, -0.125}; weight6_t w6[128] = {-0.250, -0.500, 0.500, 0.000, 0.250, 0.000, -0.125, 0.000, 3.125, 3.250, 3.250, -3.250, 3.250, -4.000, 3.250, 3.875, 0.500, -0.625, 0.500, -0.125, -0.125, -1.250, 0.625, 0.625, 0.000, 0.500, 0.250, 0.250, -0.125, -0.250, 0.000, -0.125, 0.250, 0.000, 0.125, -0.375, 0.000, -0.250, 0.250, 0.000, 0.125, -0.250, -0.125, -0.625, -0.125, -0.250, -0.125, 0.000, -0.125, 0.125, 0.125, 0.500, 0.125, 0.375, 0.125, 0.125, -0.375, 0.250, -0.250, -0.250, 0.250, 0.000, -0.125, 0.000, 0.250, -0.125, -0.375, 0.250, 0.000, -0.125, -0.125, -0.500, -0.375, -0.250, 0.000, 0.125, -0.625, 0.250, 0.125, 0.125, 0.125, -0.125, -0.125, -0.125, 0.375, 0.500, 0.125, 0.125, -0.125, -0.125, -0.250, 0.250, 0.250, -0.500, 0.250, 0.250, 0.125, -0.125, 0.000, 0.250, -0.250, -0.125, -0.625, 0.375, 0.000, 0.000, 0.125, -0.125, 0.125, 0.125, 0.625, -0.125, 0.250, 0.000, 0.125, -0.250, -0.125, 0.500, -0.375, -0.250, 1.375, -1.375, -0.625, -0.500, 1.000, 2.500, 1.875, 0.625}; bias6_t b6[8] = {0.750, 1.500, 0.500, -0.375, 0.250, 0.375, 0.875, -0.125}; - +} // namespace hls4ml_axol1tl_v3 #endif \ No newline at end of file diff --git a/AXOL1TL_v3/scales.h b/AXOL1TL_v3/scales.h index f806232..a6b06b7 100644 --- a/AXOL1TL_v3/scales.h +++ b/AXOL1TL_v3/scales.h @@ -3,11 +3,12 @@ #include "NN/GTADModel_v3.h" +namespace hls4ml_axol1tl_v3{ //N_INPUT_1_1=AD_NNNINPUTS typedef ap_fixed<4,4> ad_shift_t; typedef ap_fixed<10,9> ad_offset_t; static const ad_shift_t ad_shift[N_INPUT_1_1] = {3., 0., 6., 2., 5., 6., 1., 5., 6., 1., 5., 6., 0., 5., 6., 1., 7., 7., -1., 0., 0., -1., 0., 0., -1., 0., 0., 4., 6., 6., 3., 5., 6., 3., 5., 5., 3., 4., 5., 2., 2., 5., 1., 0., 3., -1., 0., 0., -1., 0., 0., -1., 0., 0., -1., 0., 0.}; static const ad_offset_t ad_offsets[N_INPUT_1_1] = {18., 0., 72., 7., 0., 70., 3., 0., 68., 2., 0., 68., 2., 0., 66., 2., 0., 212., 0., 0., 0., 0., 0., 0., 0., 0., 0., 23., 0., 68., 15.5, 0., 66., 11.5, 0., 64., 9., 0., 58., 6., 1., 44., 3., 0., 14., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}; - +} #endif From f3e3cb253db6f49a8c5f85a59ff9f6b84cf4babd Mon Sep 17 00:00:00 2001 From: Javier Duarte Date: Thu, 21 Mar 2024 16:44:34 -0700 Subject: [PATCH 2/2] protect top-level function as well --- AXOL1TL_v1/NN/GTADModel_v1.cpp | 4 +++- AXOL1TL_v1/NN/GTADModel_v1.h | 4 ++++ AXOL1TL_v3/NN/GTADModel_v3.cpp | 3 ++- AXOL1TL_v3/NN/GTADModel_v3.h | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/AXOL1TL_v1/NN/GTADModel_v1.cpp b/AXOL1TL_v1/NN/GTADModel_v1.cpp index f74706a..dfacd51 100644 --- a/AXOL1TL_v1/NN/GTADModel_v1.cpp +++ b/AXOL1TL_v1/NN/GTADModel_v1.cpp @@ -21,7 +21,7 @@ #include "GTADModel_v1.h" #include "parameters.h" -using namespace hls4ml_axol1tl_v1; +namespace hls4ml_axol1tl_v1 { void GTADModel_v1( input_t input_1[N_INPUT_1_1], @@ -76,4 +76,6 @@ void GTADModel_v1( nnet::linear(layer6_out, layer7_out); // mu_quantized_bits +} // hls4ml_axol1tl_v1 + } diff --git a/AXOL1TL_v1/NN/GTADModel_v1.h b/AXOL1TL_v1/NN/GTADModel_v1.h index f740076..38206f4 100644 --- a/AXOL1TL_v1/NN/GTADModel_v1.h +++ b/AXOL1TL_v1/NN/GTADModel_v1.h @@ -26,10 +26,14 @@ #include "defines.h" +namespace hls4ml_axol1tl_v1 { + // Prototype of top level function for C-synthesis void GTADModel_v1( hls4ml_axol1tl_v1::input_t input_1[hls4ml_axol1tl_v1::N_INPUT_1_1], hls4ml_axol1tl_v1::result_t layer7_out[hls4ml_axol1tl_v1::N_LAYER_6] ); +} // namespace hls4ml_axol1tl_v1 + #endif diff --git a/AXOL1TL_v3/NN/GTADModel_v3.cpp b/AXOL1TL_v3/NN/GTADModel_v3.cpp index 667045c..dbaeb55 100644 --- a/AXOL1TL_v3/NN/GTADModel_v3.cpp +++ b/AXOL1TL_v3/NN/GTADModel_v3.cpp @@ -24,7 +24,7 @@ //from https://gitlab.cern.ch/ssummers/run3_ugt_ml/-/blob/axol1tl_v3/ugt_hls/src/anomaly_detection/Axol1tl_v3.h -using namespace hls4ml_axol1tl_v3; +namespace hls4ml_axol1tl_v3 { void GTADModel_v3( input_t input_3[N_INPUT_1_1], @@ -84,5 +84,6 @@ void GTADModel_v3( nnet::linear(layer6_out, layer7_out); // mu_quantized_bits +} // namespace hls4ml_axol1tl_v3 } diff --git a/AXOL1TL_v3/NN/GTADModel_v3.h b/AXOL1TL_v3/NN/GTADModel_v3.h index 915e3e3..9ba4403 100644 --- a/AXOL1TL_v3/NN/GTADModel_v3.h +++ b/AXOL1TL_v3/NN/GTADModel_v3.h @@ -28,10 +28,14 @@ #include "defines.h" +namespace hls4ml_axol1tl_v3 { + //from https://gitlab.cern.ch/ssummers/run3_ugt_ml/-/blob/axol1tl_v3/ugt_hls/src/anomaly_detection/Axol1tl_v3.h void GTADModel_v3( hls4ml_axol1tl_v3::input_t input_3[hls4ml_axol1tl_v3::N_INPUT_1_1], hls4ml_axol1tl_v3::result_t layer7_out[hls4ml_axol1tl_v3::N_LAYER_6] ); +} // namespace hls4ml_axol1tl_v3 + #endif