Skip to content
Snippets Groups Projects
Commit 4d5e0458 authored by auphelia's avatar auphelia
Browse files

[MVAU] Update minimize accumulator width for bipolar case

parent 10f4630b
No related branches found
No related tags found
No related merge requests found
...@@ -576,6 +576,10 @@ class MatrixVectorActivation(HLSCustomOp): ...@@ -576,6 +576,10 @@ class MatrixVectorActivation(HLSCustomOp):
def minimize_accumulator_width(self, model): def minimize_accumulator_width(self, model):
weights = model.get_initializer(self.onnx_node.input[1]) weights = model.get_initializer(self.onnx_node.input[1])
# since in the calculation the values of the weight matrix are used,
# for the bipolar case they need to be converted to bipolar
if self.get_nodeattr("binaryXnorMode"):
weights = 2 * weights - 1
if len(self.onnx_node.input) > 2: if len(self.onnx_node.input) > 2:
thresholds = model.get_initializer(self.onnx_node.input[2]) thresholds = model.get_initializer(self.onnx_node.input[2])
else: else:
......
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