aboutsummaryrefslogtreecommitdiff
path: root/src/TosaSerialize.cpp
diff options
context:
space:
mode:
authorTai Ly <tai.ly@arm.com>2024-02-22 22:22:24 +0000
committerTai Ly <tai.ly@arm.com>2024-02-23 14:56:11 -0800
commit150bc9bcdea84f8c24a17d5f2fcb38128afe50ab (patch)
treef25ca6459504eee81c7a3b3a9022a846f481138b /src/TosaSerialize.cpp
parent3bdc1904e7fef906f030ca61f81b1371ba528c0d (diff)
downloadtosa_mlir_translator-150bc9bcdea84f8c24a17d5f2fcb38128afe50ab.tar.gz
[tosa_mlir_translator] Change resize attrs to inputs
This patch changes tosa resize op's scale/offset/border from attributes to inputs of tosa.shape type Signed-off-by: Tai Ly <tai.ly@arm.com> Change-Id: I04750e25f4b01067418eb6123201e845c00ce8d8
Diffstat (limited to 'src/TosaSerialize.cpp')
-rw-r--r--src/TosaSerialize.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/TosaSerialize.cpp b/src/TosaSerialize.cpp
index 3569893..9a6cf84 100644
--- a/src/TosaSerialize.cpp
+++ b/src/TosaSerialize.cpp
@@ -1238,26 +1238,21 @@ TosaSerializationOperator *
TosaSerializationOperatorBuilder::build<mlir::tosa::ResizeOp>(
mlir::Operation &op) const {
std::string input_name = GetTensorName(op.getOperand(0));
+ std::string scale_name = GetTensorName(op.getOperand(1));
+ std::string offset_name = GetTensorName(op.getOperand(2));
+ std::string border_name = GetTensorName(op.getOperand(3));
std::string output_name = GetTensorName(op.getResult(0));
- auto scale = getDenseI64ArrayAttr<int16_t>(op.getAttr("scale"));
- ASSERT_VECTOR_LENGTH(scale, 4);
-
- auto offset = getDenseI64ArrayAttr<int16_t>(op.getAttr("offset"));
- ASSERT_VECTOR_LENGTH(offset, 2);
-
- auto border = getDenseI64ArrayAttr<int16_t>(op.getAttr("border"));
- ASSERT_VECTOR_LENGTH(border, 2);
-
auto mode_str =
op.getAttr("mode").dyn_cast<mlir::StringAttr>().getValue().str();
ResizeMode mode = ResizeModeStr2Enum(mode_str);
- TosaResizeAttribute attribute(scale, offset, border, mode);
+ TosaResizeAttribute attribute({}, {}, {}, mode);
TosaSerializationOperator *tyop = new TosaSerializationOperator(
Op_RESIZE, Attribute_ResizeAttribute, &attribute,
- std::vector<std::string>{input_name},
+ std::vector<std::string>{input_name, scale_name, offset_name,
+ border_name},
std::vector<std::string>{output_name});
return tyop;