Skip to content
Snippets Groups Projects
Commit cd65e038 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Thresholding] enable frp, more test bugfixes

parent 41e3239e
No related merge requests found
...@@ -937,3 +937,8 @@ class Thresholding_Batch(HLSCustomOp): ...@@ -937,3 +937,8 @@ class Thresholding_Batch(HLSCustomOp):
thres_count = out_features * num_steps thres_count = out_features * num_steps
ret_dict[thres_param_type] = thres_count ret_dict[thres_param_type] = thres_count
return ret_dict return ret_dict
def ipgen_extra_directives(self):
"Return a list of extra tcl directives for HLS synthesis."
return ["config_compile -pipeline_style frp"]
...@@ -165,6 +165,8 @@ def test_fpgadataflow_thresholding(idt, act, nf, ich, exec_mode, mem_mode): ...@@ -165,6 +165,8 @@ def test_fpgadataflow_thresholding(idt, act, nf, ich, exec_mode, mem_mode):
# multithreshold util fxn wants NCHW input, not NHWC # multithreshold util fxn wants NCHW input, not NHWC
y = multithreshold(np.transpose(x, (0, 3, 1, 2)), T) y = multithreshold(np.transpose(x, (0, 3, 1, 2)), T)
# convert back to NHWC for comparison to hw outputs
y = np.transpose(y, (0, 2, 3, 1))
if act == DataType["BIPOLAR"]: if act == DataType["BIPOLAR"]:
# binary to bipolar # binary to bipolar
y = 2 * y - 1 y = 2 * y - 1
...@@ -258,7 +260,13 @@ def test_runtime_thresholds_single_layer(): ...@@ -258,7 +260,13 @@ def test_runtime_thresholds_single_layer():
# only use second batch element in output; first will be invalid due to # only use second batch element in output; first will be invalid due to
# old weights (see above) # old weights (see above)
y = exec_ctx["outp"][1] y = exec_ctx["outp"][1]
expected = multithreshold(in_tensor, T)[1]
# multithreshold util fxn wants NCHW input, not NHWC
expected = multithreshold(np.transpose(in_tensor, (0, 3, 1, 2)), T)
# convert back to NHWC for comparison to hw outputs
expected = np.transpose(expected, (0, 2, 3, 1))[1]
# expected = multithreshold(in_tensor, T)[1]
if act == DataType["BIPOLAR"]: if act == DataType["BIPOLAR"]:
# binary to bipolar # binary to bipolar
expected = 2 * expected - 1 expected = 2 * expected - 1
......
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