23
23
typedef {bias_t.name} bias_t;
24
24
typedef {weight_t.name} weight_t;
25
25
template<class data_T, class res_T, class CONFIG_T>
26
- using kernel = nnet:: {dense_function}<data_T, res_T, CONFIG_T>;
26
+ using kernel = {dense_function}<data_T, res_T, CONFIG_T>;
27
27
template<class x_T, class y_T>
28
28
using product = nnet::product::{product_type}<x_T, y_T>;
29
29
}};\n """
53
53
static const unsigned n_partitions = {n_partitions};
54
54
static const unsigned n_pixels = out_width / n_partitions;
55
55
template<class data_T, class CONFIG_T>
56
- using fill_buffer = nnet:: {fill_fn}<data_T, CONFIG_T>;
56
+ using fill_buffer = {fill_fn}<data_T, CONFIG_T>;
57
57
typedef {accum_t.name} accum_t;
58
58
typedef {bias_t.name} bias_t;
59
59
typedef {weight_t.name} weight_t;
@@ -89,9 +89,10 @@ def format(self, node):
89
89
params ['scale_index_type' ] = 'scale_index_regular'
90
90
91
91
if node .model .config .get_config_value ('IOType' ) == 'io_parallel' :
92
- params ['fill_fn' ] = f'fill_buffer_{ node .index } '
92
+ namespace = params ['namespace' ]
93
+ params ['fill_fn' ] = f'{ namespace } ::fill_buffer_{ node .index } '
93
94
else :
94
- params ['fill_fn' ] = 'FillConv1DBuffer'
95
+ params ['fill_fn' ] = 'nnet:: FillConv1DBuffer'
95
96
96
97
conv_config = self .template .format (** params )
97
98
@@ -103,16 +104,18 @@ def format(self, node):
103
104
node .get_input_variable ().type .precision , node .get_weights ('weight' ).type .precision
104
105
)
105
106
107
+ namespace = params ['namespace' ]
108
+
106
109
if node .get_attr ('strategy' ).lower () == 'latency' :
107
- mult_params ['dense_function' ] = 'DenseLatency'
110
+ mult_params ['dense_function' ] = 'nnet:: DenseLatency'
108
111
elif node .get_attr ('strategy' ).lower () == 'resource' :
109
112
if int (mult_params ['reuse_factor' ]) <= int (mult_params ['n_in' ]):
110
- mult_params ['dense_function' ] = 'DenseResource_rf_leq_nin'
113
+ mult_params ['dense_function' ] = 'nnet:: DenseResource_rf_leq_nin'
111
114
else :
112
- mult_params ['dense_function' ] = 'DenseResource_rf_gt_nin_rem0'
115
+ mult_params ['dense_function' ] = 'nnet:: DenseResource_rf_gt_nin_rem0'
113
116
# The 3rd case is never used
114
117
elif node .get_attr ('strategy' ).lower () == 'resource_unrolled' :
115
- mult_params ['dense_function' ] = f'dense_resource_unrolled_{ node .index } '
118
+ mult_params ['dense_function' ] = f'{ namespace } :: dense_resource_unrolled_{ node .index } '
116
119
117
120
mult_config = self .mult_template .format (** mult_params )
118
121
@@ -170,7 +173,7 @@ def __init__(self):
170
173
static const unsigned n_partitions = {n_partitions};
171
174
static const unsigned n_pixels = out_height * out_width / n_partitions;
172
175
template<class data_T, class CONFIG_T>
173
- using fill_buffer = nnet:: {fill_fn}<data_T, CONFIG_T>;
176
+ using fill_buffer = {fill_fn}<data_T, CONFIG_T>;
174
177
typedef {accum_t.name} accum_t;
175
178
typedef {bias_t.name} bias_t;
176
179
typedef {weight_t.name} weight_t;
@@ -214,9 +217,10 @@ def format(self, node):
214
217
params ['scale_index_width_type' ] = 'scale_index_regular'
215
218
216
219
if node .model .config .get_config_value ('IOType' ) == 'io_parallel' :
217
- params ['fill_fn' ] = f'fill_buffer_{ node .index } '
220
+ namespace = params ['namespace' ]
221
+ params ['fill_fn' ] = f'{ namespace } ::fill_buffer_{ node .index } '
218
222
else :
219
- params ['fill_fn' ] = 'FillConv2DBuffer'
223
+ params ['fill_fn' ] = 'nnet:: FillConv2DBuffer'
220
224
221
225
conv_config = self .template .format (** params )
222
226
@@ -313,9 +317,10 @@ def format(self, node):
313
317
params ['weight_t' ] = node .get_weights ('depthwise' ).type
314
318
params ['bias_t' ] = node .get_weights ('zero_bias' ).type
315
319
if node .model .config .get_config_value ('IOType' ) == 'io_parallel' :
316
- params ['fill_fn' ] = f'fill_buffer_{ node .index } _dw'
320
+ namespace = params ['namespace' ]
321
+ params ['fill_fn' ] = f'{ namespace } ::fill_buffer_{ node .index } _dw'
317
322
else :
318
- params ['fill_fn' ] = 'FillConv1DBuffer'
323
+ params ['fill_fn' ] = 'nnet:: FillConv1DBuffer'
319
324
320
325
if node .get_attr ('unscaled' ):
321
326
params ['scale_index_type' ] = 'scale_index_unscaled'
@@ -359,9 +364,10 @@ def format(self, node):
359
364
params ['min_width' ] = params ['in_width' ]
360
365
params ['instructions' ] = '0'
361
366
if node .model .config .get_config_value ('IOType' ) == 'io_parallel' :
362
- params ['fill_fn' ] = f'fill_buffer_{ node .index } _pw'
367
+ namespace = params ['namespace' ]
368
+ params ['fill_fn' ] = f'{ namespace } ::fill_buffer_{ node .index } _pw'
363
369
else :
364
- params ['fill_fn' ] = 'FillConv1DBuffer'
370
+ params ['fill_fn' ] = 'nnet:: FillConv1DBuffer'
365
371
366
372
if node .get_attr ('unscaled' ):
367
373
params ['scale_index_type' ] = 'scale_index_unscaled'
@@ -446,9 +452,10 @@ def format(self, node):
446
452
params ['index' ] = str (node .index ) + '_depthwise'
447
453
params ['weight_t' ] = node .get_weights ('depthwise' ).type
448
454
if node .model .config .get_config_value ('IOType' ) == 'io_parallel' :
449
- params ['fill_fn' ] = f'fill_buffer_{ node .index } _dw'
455
+ namespace = params ['namespace' ]
456
+ params ['fill_fn' ] = f'{ namespace } ::fill_buffer_{ node .index } _dw'
450
457
else :
451
- params ['fill_fn' ] = 'FillConv2DBuffer'
458
+ params ['fill_fn' ] = 'nnet:: FillConv2DBuffer'
452
459
453
460
if node .get_attr ('unscaled_h' ):
454
461
params ['scale_index_height_type' ] = 'scale_index_unscaled'
@@ -500,9 +507,10 @@ def format(self, node):
500
507
params ['min_width' ] = params ['in_width' ]
501
508
params ['instructions' ] = '0'
502
509
if node .model .config .get_config_value ('IOType' ) == 'io_parallel' :
503
- params ['fill_fn' ] = f'fill_buffer_{ node .index } _pw'
510
+ namespace = params ['namespace' ]
511
+ params ['fill_fn' ] = f'{ namespace } ::fill_buffer_{ node .index } _pw'
504
512
else :
505
- params ['fill_fn' ] = 'FillConv2DBuffer'
513
+ params ['fill_fn' ] = 'nnet:: FillConv2DBuffer'
506
514
507
515
if node .get_attr ('unscaled_h' ):
508
516
params ['scale_index_height_type' ] = 'scale_index_unscaled'
0 commit comments