@@ -49,23 +49,16 @@ extern const w_type _W L1_conv_bias_buf[];
4949extern const w_type _W L2_conv_wt_buf [];
5050extern const w_type _W L2_conv_bias_buf [];
5151
52- extern const w_type _W2 L3_conv_wt_buf [];
53- extern const w_type _W2 L3_conv_bias_buf [];
5452
55- extern const w_type _W2 L4_fc_wt_buf [];
56- extern const w_type _W2 L4_fc_bias_buf [];
53+ extern const w_type _W2 L3_fc_wt_buf [];
54+ extern const w_type _W2 L3_fc_bias_buf [];
5755
58- #if defined(MODEL_BIG )
59- extern const w_type _W2 L5_fc_wt_buf [];
60- extern const w_type _W2 L5_fc_bias_buf [];
61- #endif
6256
6357//======================================================
6458//
6559// Tensor's Integer bits per layer definitions
6660//
6761//======================================================
68- #if !defined(MODEL_BIG ) // Small Model
6962#if (MODEL_BIT_DEPTH == MODEL_FX_16 )
7063
7164#define CONV1_W_INT (-1)
@@ -76,13 +69,10 @@ extern const w_type _W2 L5_fc_bias_buf[];
7669#define CONV2_B_INT (-1)
7770#define CONV2_OUT_INT (5)
7871
79- #define CONV3_W_INT (-1)
80- #define CONV3_B_INT (-2)
81- #define CONV3_OUT_INT (6)
8272
83- #define FC4_W_INT (-1)
84- #define FC4_B_INT (-2)
85- #define FC4_OUT_INT (5)
73+ #define FC3_W_INT (-1)
74+ #define FC3_B_INT (-2)
75+ #define FC3_OUT_INT (5)
8676
8777#else //(MODEL_BIT_DEPTH == MODEL_FX_8 or MODEL_FX_8W16D)
8878
@@ -94,65 +84,13 @@ extern const w_type _W2 L5_fc_bias_buf[];
9484#define CONV2_B_INT (-1)
9585#define CONV2_OUT_INT (5)
9686
97- #define CONV3_W_INT (-1)
98- #define CONV3_B_INT (-2)
99- #define CONV3_OUT_INT (5)
10087
101- #define FC4_W_INT (-1)
102- #define FC4_B_INT (-2)
103- #define FC4_OUT_INT (5)
88+ #define FC3_W_INT (-1)
89+ #define FC3_B_INT (-2)
90+ #define FC3_OUT_INT (5)
10491
10592#endif
10693
107- #else // Big Model
108- #if (MODEL_BIT_DEPTH == MODEL_FX_16 )
109-
110- #define CONV1_W_INT (0)
111- #define CONV1_B_INT (0)
112- #define CONV1_OUT_INT (5)
113-
114- #define CONV2_W_INT (-1)
115- #define CONV2_B_INT (-1)
116- #define CONV2_OUT_INT (6)
117-
118- #define CONV3_W_INT (-2)
119- #define CONV3_B_INT (-2)
120- #define CONV3_OUT_INT (5)
121-
122- #define FC4_W_INT (-1)
123- #define FC4_B_INT (-3)
124- #define FC4_OUT_INT (3)
125-
126- #define FC5_W_INT (0)
127- #define FC5_B_INT (-2)
128- #define FC5_OUT_INT (5)
129-
130-
131- #else //(MODEL_BIT_DEPTH == MODEL_FX_8 or MODEL_FX_8W16D)
132-
133- #define CONV1_W_INT (0)
134- #define CONV1_B_INT (0)
135- #define CONV1_OUT_INT (4)
136-
137- #define CONV2_W_INT (-1)
138- #define CONV2_B_INT (-1)
139- #define CONV2_OUT_INT (5)
140-
141- #define CONV3_W_INT (-2)
142- #define CONV3_B_INT (-2)
143- #define CONV3_OUT_INT (4)
144-
145- #define FC4_W_INT (-2)
146- #define FC4_B_INT (-3)
147- #define FC4_OUT_INT (3)
148-
149- #define FC5_W_INT (0)
150- #define FC5_B_INT (-2)
151- #define FC5_OUT_INT (5)
152-
153- #endif
154- #endif
155-
15694//======================================================
15795//
15896// Shape and Fractional bits per layer definitions
@@ -161,15 +99,15 @@ extern const w_type _W2 L5_fc_bias_buf[];
16199
162100// CONV1
163101//================================================
164- #define CONV1_W_SHAPE {32,3 ,5,5}
165- #define CONV1_W_ELEMENTS (32*3 *5*5)
102+ #define CONV1_W_SHAPE {4,1 ,5,5}
103+ #define CONV1_W_ELEMENTS (4*1 *5*5)
166104#define CONV1_W_RANK (4)
167105
168106#define CONV1_W_FRAQ (FRQ_BITS(CONV1_W_INT, w_type))
169107#define L1_WQ (val ) QMN(w_type, CONV1_W_FRAQ, val)
170108
171- #define CONV1_B_ELEMENTS (32 )
172- #define CONV1_B_SHAPE {32 }
109+ #define CONV1_B_ELEMENTS (4 )
110+ #define CONV1_B_SHAPE {4 }
173111#define CONV1_B_RANK (1)
174112
175113#define CONV1_B_FRAQ (FRQ_BITS(CONV1_B_INT, w_type))
@@ -179,17 +117,10 @@ extern const w_type _W2 L5_fc_bias_buf[];
179117
180118// CONV2
181119//================================================
182- #if defined(MODEL_BIG )
183- #define CONV2_W_SHAPE {32,32,5,5}
184- #define CONV2_W_ELEMENTS (32*32*5*5)
185- #define CONV2_B_SHAPE {32}
186- #define CONV2_B_ELEMENTS (32)
187- #else // Small Model
188- #define CONV2_W_SHAPE {16,32,5,5}
189- #define CONV2_W_ELEMENTS (16*32*5*5)
190- #define CONV2_B_SHAPE {16}
191- #define CONV2_B_ELEMENTS (16)
192- #endif
120+ #define CONV2_W_SHAPE {2,4,5,5}
121+ #define CONV2_W_ELEMENTS (2*4*5*5)
122+ #define CONV2_B_SHAPE {2}
123+ #define CONV2_B_ELEMENTS (2)
193124
194125#define CONV2_W_RANK (4)
195126#define CONV2_B_RANK (1)
@@ -200,51 +131,21 @@ extern const w_type _W2 L5_fc_bias_buf[];
200131#define L2_BQ (val ) QMN(w_type, CONV2_B_FRAQ, val)
201132#define CONV2_OUT_FRAQ (FRQ_BITS(CONV2_OUT_INT, d_type))
202133
203- // CONV3
204- //================================================
205- #if defined(MODEL_BIG )
206- #define CONV3_W_SHAPE {64,32,5,5}
207- #define CONV3_W_ELEMENTS (64*32*5*5)
208- #define CONV3_B_SHAPE {64}
209- #define CONV3_B_ELEMENTS (64)
210- #else // Small Model
211- #define CONV3_W_SHAPE {32,16,5,5}
212- #define CONV3_W_ELEMENTS (32*16*5*5)
213- #define CONV3_B_SHAPE {32}
214- #define CONV3_B_ELEMENTS (32)
215- #endif
216- #define CONV3_W_RANK (4)
217- #define CONV3_B_RANK (1)
218-
219- #define CONV3_W_FRAQ (FRQ_BITS(CONV2_W_INT, w_type))
220- #define L3_WQ (val ) QMN(w_type, CONV2_W_FRAQ, val)
221- #define CONV3_B_FRAQ (FRQ_BITS(CONV2_B_INT, w_type))
222- #define L3_BQ (val ) QMN(w_type, CONV2_B_FRAQ, val)
223- #define CONV3_OUT_FRAQ (FRQ_BITS(CONV2_OUT_INT, d_type))
224134
225- // FC4
135+ // FC3
226136//================================================
227- #if defined(MODEL_BIG )
228- #define FC4_W_SHAPE {64,(64*16)}
229- #define FC4_W_ELEMENTS (64*(64*16))
230- #define FC4_B_SHAPE {64}
231- #define FC4_B_ELEMENTS (64)
232- #else // Small Model
233- #define FC4_W_SHAPE {10,(32*16)}
234- #define FC4_W_ELEMENTS (10*(32*16))
235- #define FC4_B_SHAPE {10}
236- #define FC4_B_ELEMENTS (10)
237- #endif
238- #define FC4_W_RANK (2)
239- #define FC4_B_RANK (1)
240-
241- #define FC4_W_FRAQ (FRQ_BITS(FC4_W_INT, w_type))
242- #define L4_WQ (val ) QMN(w_type, FC4_W_FRAQ, val)
243- #define FC4_B_FRAQ (FRQ_BITS(FC4_B_INT, w_type))
244- #define L4_BQ (val ) QMN(w_type, FC4_B_FRAQ, val)
245- #define FC4_OUT_FRAQ (FRQ_BITS(FC4_OUT_INT, d_type))
246-
247-
137+ #define FC3_W_SHAPE {6,(7*7*4)}
138+ #define FC3_W_ELEMENTS (6*(7*7*4))
139+ #define FC3_B_SHAPE {6}
140+ #define FC3_B_ELEMENTS (6)
141+ #define FC3_W_RANK (2)
142+ #define FC3_B_RANK (1)
143+
144+ #define FC3_W_FRAQ (FRQ_BITS(FC3_W_INT, w_type))
145+ #define L3_WQ (val ) QMN(w_type, FC3_W_FRAQ, val)
146+ #define FC3_B_FRAQ (FRQ_BITS(FC3_B_INT, w_type))
147+ #define L3_BQ (val ) QMN(w_type, FC3_B_FRAQ, val)
148+ #define FC3_OUT_FRAQ (FRQ_BITS(FC3_OUT_INT, d_type))
248149
249150
250151
0 commit comments