@@ -22,7 +22,7 @@ def forward(self, x):
22
22
return self .linear (x )
23
23
24
24
25
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
25
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
26
26
@pytest .mark .parametrize ('io_type' , ['io_parallel' , 'io_stream' ])
27
27
def test_linear (backend , io_type ):
28
28
model = LinearModel ()
@@ -73,7 +73,7 @@ def test_linear(backend, io_type):
73
73
nn .Threshold (threshold = 1.0 , value = 0.0 ),
74
74
],
75
75
)
76
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
76
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
77
77
@pytest .mark .parametrize ('io_type' , ['io_parallel' , 'io_stream' ])
78
78
def test_activations (activation_function , backend , io_type ):
79
79
model = torch .nn .Sequential (nn .Linear (1 , 1 ), activation_function ).to ()
@@ -164,7 +164,7 @@ def forward(self, x):
164
164
ThresholdModel (),
165
165
],
166
166
)
167
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
167
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
168
168
@pytest .mark .parametrize ('io_type' , ['io_parallel' , 'io_stream' ])
169
169
def test_activation_functionals (activation_function , backend , io_type ):
170
170
model = activation_function
@@ -201,7 +201,7 @@ def test_activation_functionals(activation_function, backend, io_type):
201
201
202
202
203
203
@pytest .mark .parametrize ('padds' , padds_options )
204
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
204
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
205
205
@pytest .mark .parametrize ('io_type' , ['io_parallel' , 'io_stream' ])
206
206
def test_conv1d (padds , backend , io_type ):
207
207
n_in = 2
@@ -242,7 +242,7 @@ def test_conv1d(padds, backend, io_type):
242
242
243
243
if io_type == 'io_stream' :
244
244
# Vivado inserts and additional layer for 'same' padding in io_stream
245
- if backend == "Vivado" and padds == 1 :
245
+ if ( backend == "Vivado" or backend == "Vitis" ) and padds == 1 :
246
246
assert nNodes == len (hls_model .get_layers ())
247
247
else :
248
248
assert nNodes - 1 == len (hls_model .get_layers ())
@@ -269,13 +269,13 @@ def test_conv1d(padds, backend, io_type):
269
269
# if not (backend == 'Vivado' and io_type == 'io_stream' and padds == 1):
270
270
conv_index = 2
271
271
act_index = 3
272
- if io_type == "io_stream" and not (backend == "Vivado" and padds == 1 ):
272
+ if io_type == "io_stream" and not (( backend == "Vivado" or backend == "Vitis" ) and padds == 1 ):
273
273
conv_index = 1
274
274
act_index = 2
275
275
assert list (hls_model .get_layers ())[conv_index ].attributes ['name' ] == convNode .name
276
276
assert list (hls_model .get_layers ())[conv_index ].attributes ['class_name' ] == 'Conv1D'
277
277
assert list (hls_model .get_layers ())[act_index ].attributes ['activation' ] == class_object_relu .__class__ .__name__
278
- if io_type == "io_stream" and backend == "Vivado" and padds == 1 :
278
+ if io_type == "io_stream" and ( backend == "Vivado" or backend == "Vitis" ) and padds == 1 :
279
279
assert list (hls_model .get_layers ())[conv_index ].attributes ["in_width" ] == size_in + 2
280
280
else :
281
281
assert list (hls_model .get_layers ())[conv_index ].attributes ["in_width" ] == size_in
@@ -287,7 +287,7 @@ def test_conv1d(padds, backend, io_type):
287
287
padding = 0
288
288
else :
289
289
padding = 1
290
- if io_type == "io_stream" and backend == "Vivado" and padds == 1 :
290
+ if io_type == "io_stream" and ( backend == "Vivado" or backend == "Vitis" ) and padds == 1 :
291
291
padding = 1
292
292
padds = 0
293
293
@@ -311,7 +311,7 @@ def test_conv1d(padds, backend, io_type):
311
311
312
312
313
313
@pytest .mark .parametrize ('padds' , padds_options )
314
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
314
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
315
315
@pytest .mark .parametrize ('io_type' , ['io_parallel' , 'io_stream' ])
316
316
def test_conv2d (padds , backend , io_type ):
317
317
n_in = 2
@@ -409,7 +409,7 @@ def test_conv2d(padds, backend, io_type):
409
409
# results are not very good at the moment
410
410
np .testing .assert_allclose (hls_prediction , pytorch_prediction , rtol = 0 , atol = 5e-2 )
411
411
412
- if not (backend == 'Vivado' and io_type == 'io_stream' and padds == 1 ):
412
+ if not (( backend == 'Vivado' or backend == 'Vitis' ) and io_type == 'io_stream' and padds == 1 ):
413
413
# Vivado inserts and additional layer for 'same' padding in io_stream
414
414
conv_index = 2
415
415
act_index = 3
@@ -464,7 +464,7 @@ def test_conv2d(padds, backend, io_type):
464
464
465
465
@pytest .mark .parametrize ('pooling' , pooling_layers )
466
466
@pytest .mark .parametrize ('padds' , padds_options )
467
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
467
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
468
468
def test_pooling (pooling , padds , backend ):
469
469
assert '1d' in pooling .__name__ or '2d' in pooling .__name__
470
470
@@ -588,7 +588,7 @@ def forward(self, x):
588
588
return self .bn (x )
589
589
590
590
591
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
591
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
592
592
@pytest .mark .parametrize ('io_type' , ['io_parallel' , 'io_stream' ])
593
593
def test_bn (backend , io_type ):
594
594
model = BatchNormModel ()
@@ -631,7 +631,7 @@ def forward(self, x):
631
631
return x
632
632
633
633
634
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
634
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
635
635
@pytest .mark .parametrize ('io_type' , ['io_parallel' , 'io_stream' ])
636
636
def test_squeeze (backend , io_type ):
637
637
model = SqueezeModel ()
@@ -667,7 +667,7 @@ def test_squeeze(backend, io_type):
667
667
assert list (hls_model .get_layers ())[3 ].attributes ['target_shape' ] == [3 ]
668
668
669
669
670
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
670
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
671
671
def test_flatten (backend ):
672
672
input = torch .randn (1 , 1 , 5 , 5 )
673
673
model = nn .Sequential (nn .Conv2d (1 , 32 , 5 , 1 , 1 ), nn .Flatten (), nn .ReLU ())
@@ -711,7 +711,7 @@ def forward(self, x):
711
711
return x
712
712
713
713
714
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
714
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
715
715
@pytest .mark .parametrize ('io_type' , ['io_parallel' , 'io_stream' ])
716
716
def test_skipped_layers (backend , io_type ):
717
717
model = ModelSkippedLayers ()
@@ -742,7 +742,7 @@ def test_skipped_layers(backend, io_type):
742
742
np .testing .assert_allclose (hls_prediction , pytorch_prediction , rtol = 0 , atol = 5e-2 )
743
743
744
744
745
- @pytest .mark .parametrize ('backend' , ['Vivado' , 'Quartus' ])
745
+ @pytest .mark .parametrize ('backend' , ['Vivado' , 'Vitis' , ' Quartus' ])
746
746
@pytest .mark .parametrize ('io_type' , ['io_parallel' ]) # Only io_parallel for now
747
747
@pytest .mark .parametrize ('tensor_rank' , [2 , 3 ])
748
748
def test_remove_transpose (backend , io_type , tensor_rank ):
0 commit comments