From 8833846f0ad7852bb0c57cc4938e086c8d7b8737 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Fri, 8 Sep 2023 17:50:11 +0000 Subject: Update to handle unsigned attributes for RESCALE Check the operand data types to determine whether the RESCALE is operating on signed or unsigned values for the signless type. Signed-off-by: Eric Kunze Change-Id: Ie6fb4f4c128598dccefdded10774a0af0238eede --- src/TosaSerialize.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/TosaSerialize.cpp') diff --git a/src/TosaSerialize.cpp b/src/TosaSerialize.cpp index 941a75e..b894383 100644 --- a/src/TosaSerialize.cpp +++ b/src/TosaSerialize.cpp @@ -1392,11 +1392,17 @@ TosaSerializationOperatorBuilder::build( op.getAttr("multiplier").dyn_cast().asArrayRef(); auto shift = getDenseI8ArrayAttr(op.getAttr("shift")); - std::string input_name = GetTensorName(op.getOperand(0)); - std::string output_name = GetTensorName(op.getResult(0)); + auto input = op.getOperand(0); + auto input_ty = input.getType().cast(); + auto output = op.getResult(0); + auto output_ty = output.getType().cast(); + + std::string input_name = GetTensorName(input); + std::string output_name = GetTensorName(output); - TosaRescaleAttribute attribute(input_zp, output_zp, multiplier, shift, - scale32, double_round, per_channel); + TosaRescaleAttribute attribute( + input_zp, output_zp, multiplier, shift, scale32, double_round, + per_channel, input_ty.isUnsignedInteger(), output_ty.isUnsignedInteger()); TosaSerializationOperator *tyop = new TosaSerializationOperator( Op_RESCALE, Attribute_RescaleAttribute, &attribute, -- cgit v1.2.1