aboutsummaryrefslogtreecommitdiff
path: root/src/TosaDeserialize.cpp
diff options
context:
space:
mode:
authorTai Ly <tai.ly@arm.com>2024-02-29 18:53:35 +0000
committerTai Ly <tai.ly@arm.com>2024-03-06 09:12:32 -0800
commiteecc90165c5d37b75aca83f4d00cb4481872b238 (patch)
treec007ab2961c99d32b54f6fafaba363567065c133 /src/TosaDeserialize.cpp
parentbffbb131352491f2eaaaa7a6aca3f860a4a09f02 (diff)
downloadtosa_mlir_translator-eecc90165c5d37b75aca83f4d00cb4481872b238.tar.gz
[tosa_mlir_translator] change rescale attrs to inputs
This patch is for RescaleOp multiplier/shift changing from attributes to inputs Signed-off-by: Tai Ly <tai.ly@arm.com> Change-Id: I2fe3aa3cd37134f36873240c92b387b9610e3f9d
Diffstat (limited to 'src/TosaDeserialize.cpp')
-rw-r--r--src/TosaDeserialize.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/TosaDeserialize.cpp b/src/TosaDeserialize.cpp
index 5ad7e6e..9660833 100644
--- a/src/TosaDeserialize.cpp
+++ b/src/TosaDeserialize.cpp
@@ -1174,9 +1174,6 @@ TosaMlirOperatorBuilder::build<Op_SLICE>(TosaSerializationOperator *op) const {
mlir::RankedTensorType output_type =
tensor_type_map->at(op->GetOutputTensorNames()[0]);
- assert(op->GetAttributeType() ==
- Attribute_SliceAttribute); // double check attribute type
-
mlir::Value start = tensor_map->at(op->GetInputTensorNames()[1]);
mlir::Value size = tensor_map->at(op->GetInputTensorNames()[2]);
@@ -1336,6 +1333,8 @@ template <>
std::vector<mlir::Value> TosaMlirOperatorBuilder::build<Op_RESCALE>(
TosaSerializationOperator *op) const {
mlir::Value input_val = tensor_map->at(op->GetInputTensorNames()[0]);
+ mlir::Value multiplier_val = tensor_map->at(op->GetInputTensorNames()[1]);
+ mlir::Value shift_val = tensor_map->at(op->GetInputTensorNames()[2]);
mlir::RankedTensorType output_type =
tensor_type_map->at(op->GetOutputTensorNames()[0]);
@@ -1347,9 +1346,6 @@ std::vector<mlir::Value> TosaMlirOperatorBuilder::build<Op_RESCALE>(
auto input_zp = op_builder->getI32IntegerAttr(attr->input_zp());
auto output_zp = op_builder->getI32IntegerAttr(attr->output_zp());
- auto multiplier = BuildDenseI32ArrayAttr(op_builder, attr->multiplier());
- auto shift = BuildDenseI8ArrayAttr(op_builder, attr->shift());
-
auto scale32 = op_builder->getBoolAttr(attr->scale32());
auto double_round = op_builder->getBoolAttr(attr->double_round());
auto per_channel = op_builder->getBoolAttr(attr->per_channel());
@@ -1358,8 +1354,9 @@ std::vector<mlir::Value> TosaMlirOperatorBuilder::build<Op_RESCALE>(
auto output_unsigned = op_builder->getBoolAttr(attr->output_unsigned());
mlir::Operation *mlir_op = op_builder->create<mlir::tosa::RescaleOp>(
- loc, output_type, input_val, input_zp, output_zp, multiplier, shift,
- scale32, double_round, per_channel, input_unsigned, output_unsigned);
+ loc, output_type, input_val, multiplier_val, shift_val, input_zp,
+ output_zp, scale32, double_round, per_channel, input_unsigned,
+ output_unsigned);
block->push_back(mlir_op);
return std::vector<mlir::Value>({mlir_op->getResult(0)});
}