Unable to convert the final mul, add, topk nodes to HLS #1164
Replies: 1 comment 1 reply
-
|
The issue is likely the final You could try two options now: Add an activation quantizer following you last linear layer, e.g., a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to implement a custom model using FINN.
This is the model:
class QuantWeightActLeNet(Module):
def init(self):
super(QuantWeightActLeNet, self).init()
self.quant_inp = qnn.QuantIdentity(bit_width=4)
self.conv1 = qnn.QuantConv2d(3, 6, 5, bias=True, weight_bit_width=weight_bit_width)
self.relu1 = qnn.QuantReLU(bit_width=act_bit_width)
self.conv2 = qnn.QuantConv2d(6, 16, 5, bias=True, weight_bit_width=weight_bit_width)
self.relu2 = qnn.QuantReLU(bit_width=act_bit_width)
self.fc1 = qnn.QuantLinear(1655, 120, bias=True, weight_bit_width=weight_bit_width)
self.relu3 = qnn.QuantReLU(bit_width=act_bit_width)
self.fc2 = qnn.QuantLinear(120, 84, bias=True, weight_bit_width=weight_bit_width)
self.relu4 = qnn.QuantReLU(bit_width=act_bit_width)
self.fc3 = qnn.QuantLinear(84, 10, bias=True)
model = QuantWeightActLeNet()
While performing streamlining, the final nodes are not getting converted to HLS. I am new to FINN and I tried correcting it as per some of the previous posts, but no luck.
The streamlining code I used is:
model = ModelWrapper("LeNet_WeightAct_tidy_prepost.onnx")
model = model.transform(MoveScalarLinearPastInvariants())
model = model.transform(Streamline())
model = model.transform(LowerConvsToMatMul())
model = model.transform(MakeMaxPoolNHWC())
model = model.transform(absorb.AbsorbTransposeIntoMultiThreshold())
model = model.transform(Streamline())
model = model.transform(MakeMaxPoolNHWC())
model = model.transform(absorb.AbsorbTransposeIntoMultiThreshold())
model = model.transform(Streamline())
model = model.transform(absorb.AbsorbScalarMulAddIntoTopK())
model = model.transform(RoundAndClipThresholds())
model = model.transform(InferDataLayouts())
model = model.transform(RemoveUnusedTensors())
model.save("LeNet_WeightAct_tidy_streamlined.onnx")
Beta Was this translation helpful? Give feedback.
All reactions