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

[Thresholding] switch to single spatial size

parent 650b18e5
No related branches found
No related tags found
No related merge requests found
...@@ -660,34 +660,25 @@ class Thresholding_Batch(HLSCustomOp): ...@@ -660,34 +660,25 @@ class Thresholding_Batch(HLSCustomOp):
# TODO: why put some template parameters into defines and not others? # TODO: why put some template parameters into defines and not others?
# should ImgDim be defined or just filled in here like we do now? # should ImgDim be defined or just filled in here like we do now?
node = self.onnx_node node = self.onnx_node
ishape = self.get_folded_input_shape() inp_vecs = self.get_nodeattr("numInputVectors")
if len(ishape) == 3: total_spatial_size = int(np.prod(inp_vecs))
imgdimh = 1
imgdimw = 1
elif len(ishape) == 5:
imgdimh = ishape[1]
imgdimw = ishape[2]
else:
raise Exception("""Unexpected input shape""")
mem_mode = self.get_nodeattr("mem_mode") mem_mode = self.get_nodeattr("mem_mode")
if mem_mode == "const": if mem_mode == "const":
self.code_gen_dict["$DOCOMPUTE$"] = [ self.code_gen_dict["$DOCOMPUTE$"] = [
"""{}<{}, {}, NumChannels1, PE1, {}, {}> """{}<{}, NumChannels1, PE1, {}, {}>
(in0, out, threshs, numReps);""".format( (in0, out, threshs, numReps);""".format(
node.op_type, node.op_type,
imgdimh, total_spatial_size,
imgdimw,
tmpl_args["TSrcI"], tmpl_args["TSrcI"],
tmpl_args["TDstI"], tmpl_args["TDstI"],
) )
] ]
elif mem_mode == "decoupled": elif mem_mode == "decoupled":
self.code_gen_dict["$DOCOMPUTE$"] = [ self.code_gen_dict["$DOCOMPUTE$"] = [
"""{}<{}, {}, NumChannels1, PE1, {}, {}, ActVal1, ThresType1, NumSteps1> """{}<{}, NumChannels1, PE1, {}, {}, ActVal1, ThresType1, NumSteps1>
(in0, out, weights, numReps);""".format( (in0, out, weights, numReps);""".format(
"Thresholding_Stream_Batch", "Thresholding_Stream_Batch",
imgdimh, total_spatial_size,
imgdimw,
tmpl_args["TSrcI"], tmpl_args["TSrcI"],
tmpl_args["TDstI"], tmpl_args["TDstI"],
) )
......
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