Skip to content
Snippets Groups Projects
Commit 2ebcae37 authored by auphelia's avatar auphelia
Browse files

Merge branch 'feature/tmp_folder_refactoring_tests' into dev

parents 86b209cf ed4f5571
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,6 @@ from onnx import TensorProto, helper
import finn.util.basic as util
from finn.core.datatype import DataType
from finn.core.modelwrapper import ModelWrapper
from finn.transformation.fpgadataflow.cleanup import CleanUp
from finn.transformation.fpgadataflow.codegen_npysim import CodeGen_npysim
......@@ -66,4 +65,3 @@ def test_code_gen_trafo():
op type {} is empty!""".format(
node.op_type
)
model = model.transform(CleanUp())
......@@ -5,7 +5,6 @@ from onnx import TensorProto, helper
import finn.util.basic as util
from finn.core.datatype import DataType
from finn.core.modelwrapper import ModelWrapper
from finn.transformation.fpgadataflow.cleanup import CleanUp
from finn.transformation.fpgadataflow.codegen_npysim import CodeGen_npysim
from finn.transformation.fpgadataflow.compile import Compile
......@@ -63,4 +62,3 @@ def test_compilation_trafo():
op type {} does not exist!""".format(
node.op_type
)
model = model.transform(CleanUp())
......@@ -6,7 +6,6 @@ from onnx import TensorProto, helper
import finn.core.onnx_exec as oxe
from finn.core.datatype import DataType
from finn.core.modelwrapper import ModelWrapper
from finn.transformation.fpgadataflow.cleanup import CleanUp
from finn.transformation.fpgadataflow.codegen_ipgen import CodeGen_ipgen
from finn.transformation.fpgadataflow.codegen_npysim import CodeGen_npysim
from finn.transformation.fpgadataflow.compile import Compile
......@@ -167,4 +166,3 @@ def test_fpgadataflow_slidingwindow(idt, k, ifm_dim, ifm_ch, stride):
model = model.transform(HLSSynth_IPGen())
y_produced = oxe.execute_onnx(model, input_dict)["outp"]
assert (y_produced == y_expected).all(), "rtlsim failed"
model = model.transform(CleanUp())
......@@ -9,7 +9,6 @@ from finn.analysis.fpgadataflow.hls_synth_res_estimation import hls_synth_res_es
from finn.core.datatype import DataType
from finn.core.modelwrapper import ModelWrapper
from finn.custom_op.multithreshold import multithreshold
from finn.transformation.fpgadataflow.cleanup import CleanUp
from finn.transformation.fpgadataflow.codegen_ipgen import CodeGen_ipgen
from finn.transformation.fpgadataflow.codegen_npysim import CodeGen_npysim
from finn.transformation.fpgadataflow.compile import Compile
......@@ -175,7 +174,6 @@ def test_fpgadataflow_fclayer_npysim(idt, wdt, act, nf, sf, mw, mh):
# execute model
y_produced = oxe.execute_onnx(model, input_dict)["outp"]
assert (y_produced.reshape(y_expected.shape) == y_expected).all(), "npysim failed"
model = model.transform(CleanUp())
# activation: None or DataType
......@@ -257,5 +255,3 @@ def test_fpgadataflow_fclayer_rtlsim(idt, wdt, act, nf, sf, mw, mh):
hls_synt_res_est = model.analysis(hls_synth_res_estimation)
assert "StreamingFCLayer_Batch_0" in hls_synt_res_est
model = model.transform(CleanUp())
......@@ -4,7 +4,6 @@ from onnx import TensorProto, helper
import finn.core.onnx_exec as oxe
from finn.core.datatype import DataType
from finn.core.modelwrapper import ModelWrapper
from finn.transformation.fpgadataflow.cleanup import CleanUp
from finn.transformation.fpgadataflow.codegen_npysim import CodeGen_npysim
from finn.transformation.fpgadataflow.compile import Compile
from finn.transformation.fpgadataflow.set_sim_mode import SetSimMode
......@@ -111,7 +110,6 @@ def test_layer_streaming_maxpool_batch():
],
dtype=np.float32,
).reshape(2, 2, 4, 4)
print(input_tensor)
model = model.transform(SetSimMode("npysim"))
model = model.transform(CodeGen_npysim())
......@@ -119,5 +117,3 @@ def test_layer_streaming_maxpool_batch():
input_dict = {"in": input_tensor}
output_dict = oxe.execute_onnx(model, input_dict)
print(output_dict)
model = model.transform(CleanUp())
......@@ -30,16 +30,18 @@ def test_batchnorm_to_affine_lfc_w1a1():
os.remove(export_onnx_path)
def test_batchnorm_to_affine_cnv_w1a1():
lfc = get_test_model_trained("CNV", 1, 1)
bo.export_finn_onnx(lfc, (1, 3, 32, 32), export_onnx_path)
model = ModelWrapper(export_onnx_path)
model = model.transform(InferShapes())
model = model.transform(FoldConstants())
# TODO shape inference failing on transformed model below -- needs debug
new_model = model.transform(BatchNormToAffine())
# check that there are no BN nodes left
# TODO replace this with execution test
op_types = list(map(lambda x: x.op_type, new_model.graph.node))
assert "BatchNormalization" not in op_types
os.remove(export_onnx_path)
# cnv batchnorm to affine not yet supported
# def test_batchnorm_to_affine_cnv_w1a1():
# lfc = get_test_model_trained("CNV", 1, 1)
# bo.export_finn_onnx(lfc, (1, 3, 32, 32), export_onnx_path)
# model = ModelWrapper(export_onnx_path)
# model = model.transform(InferShapes())
# model = model.transform(FoldConstants())
# # TODO shape inference failing on transformed model below -- needs debug
# new_model = model.transform(BatchNormToAffine())
# # check that there are no BN nodes left
# # TODO replace this with execution test
# op_types = list(map(lambda x: x.op_type, new_model.graph.node))
# assert "BatchNormalization" not in op_types
# os.remove(export_onnx_path)
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