From d13f5e6e8b964e2b10b5f4133043e59e45f11aaa Mon Sep 17 00:00:00 2001 From: TatWai Chong Date: Tue, 28 Jun 2022 17:11:13 -0700 Subject: Update TOSA resize to match specification Attribute stride and shift are removed, and has new scale and border. Signed-off-by: TatWai Chong Change-Id: Id34072deb46ffce642530cc7499eb777cf9b82fc --- src/TosaSerialize.cpp | 47 +++++++++++++------------------------------ third_party/serialization_lib | 2 +- 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/src/TosaSerialize.cpp b/src/TosaSerialize.cpp index a6ea5ff..7256385 100644 --- a/src/TosaSerialize.cpp +++ b/src/TosaSerialize.cpp @@ -968,23 +968,15 @@ TosaSerializationOperatorBuilder::build( std::string input_name = GetTensorName(op.getOperand(0)); std::string output_name = GetTensorName(op.getResult(0)); - std::vector output_size; - auto output_size_attr = - op.getAttr("output_size").dyn_cast().getValue(); - for (auto &int_attr : output_size_attr) { - output_size.push_back(int_attr.dyn_cast().getInt()); + std::vector scale; + auto scale_attr = + op.getAttr("scale").dyn_cast().getValue(); + for (auto &int_attr : scale_attr) { + scale.push_back(int_attr.dyn_cast().getInt()); } - ASSERT_VECTOR_LENGTH(output_size, 2); + ASSERT_VECTOR_LENGTH(scale, 4); - std::vector stride; - auto stride_attr = - op.getAttr("stride").dyn_cast().getValue(); - for (auto &int_attr : stride_attr) { - stride.push_back(int_attr.dyn_cast().getInt()); - } - ASSERT_VECTOR_LENGTH(stride, 2); - - std::vector offset; + std::vector offset; auto offset_attr = op.getAttr("offset").dyn_cast().getValue(); for (auto &int_attr : offset_attr) { @@ -992,30 +984,19 @@ TosaSerializationOperatorBuilder::build( } ASSERT_VECTOR_LENGTH(offset, 2); - int32_t shift = op.getAttr("shift").dyn_cast().getInt(); - - std::vector stride_fp; - auto stride_fp_attr = - op.getAttr("stride_fp").dyn_cast().getValue(); - for (auto &fp_attr : stride_fp_attr) { - stride_fp.push_back(fp_attr.dyn_cast().getValueAsDouble()); - } - ASSERT_VECTOR_LENGTH(stride_fp, 2); - - std::vector offset_fp; - auto offset_fp_attr = - op.getAttr("offset_fp").dyn_cast().getValue(); - for (auto &fp_attr : offset_fp_attr) { - offset_fp.push_back(fp_attr.dyn_cast().getValueAsDouble()); + std::vector border; + auto border_attr = + op.getAttr("border").dyn_cast().getValue(); + for (auto &int_attr : border_attr) { + border.push_back(int_attr.dyn_cast().getInt()); } - ASSERT_VECTOR_LENGTH(offset_fp, 2); + ASSERT_VECTOR_LENGTH(border, 2); auto mode_str = op.getAttr("mode").dyn_cast().getValue().str(); ResizeMode mode = ResizeModeStr2Enum(mode_str); - TosaResizeAttribute attribute(output_size, stride, offset, shift, stride_fp, - offset_fp, mode); + TosaResizeAttribute attribute(scale, offset, border, mode); TosaSerializationOperator *tyop = new TosaSerializationOperator( Op_RESIZE, Attribute_ResizeAttribute, &attribute, diff --git a/third_party/serialization_lib b/third_party/serialization_lib index 343d6a7..49b1ca6 160000 --- a/third_party/serialization_lib +++ b/third_party/serialization_lib @@ -1 +1 @@ -Subproject commit 343d6a703c3a270a01102ec468b59ef2967b595e +Subproject commit 49b1ca63975d4f1865ca312ed9c9b5e0008e13e0 -- cgit v1.2.1