From 81db8ee8f580d30ec0ca53067df32ef046e6f09e Mon Sep 17 00:00:00 2001 From: Tai Ly Date: Wed, 14 Feb 2024 19:57:38 +0000 Subject: [serialization_lib] Align to Tosa Spec removed attributes for Reshape, Slice and Tile Ops renamed field accum_dtype to acc_type, renamed then_branch/else_branch to then_graph/else_graph renamed cond_branch/body_branch to cond_graph/body_graph Signed-off-by: Tai Ly Change-Id: I2001f19519987d9e64c18b1f11762f9d3b9be4ec --- python/serializer/tosa_serializer.py | 41 +++++++----------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) (limited to 'python/serializer/tosa_serializer.py') diff --git a/python/serializer/tosa_serializer.py b/python/serializer/tosa_serializer.py index 1aadbff..546de7d 100644 --- a/python/serializer/tosa_serializer.py +++ b/python/serializer/tosa_serializer.py @@ -159,7 +159,7 @@ class TosaSerializerAttribute(TosaSerializerUnion): pad, input_zp, output_zp, - accum_dtype, + acc_type, ): from tosa import PoolAttribute as a, Attribute @@ -171,7 +171,7 @@ class TosaSerializerAttribute(TosaSerializerUnion): self.intvecs.append((a.AddStride, stride)) self.ints.append((a.AddInputZp, input_zp)) self.ints.append((a.AddOutputZp, output_zp)) - self.ints.append((a.AddAccumDtype, accum_dtype)) + self.ints.append((a.AddAccType, acc_type)) def ConvAttribute(self, pad, stride, dilation, input_zp, weight_zp, local_bound): from tosa import ConvAttribute as a, Attribute @@ -226,31 +226,6 @@ class TosaSerializerAttribute(TosaSerializerUnion): self.ints.append((a.AddAxis, axis)) - def ReshapeAttribute(self, new_shape): - from tosa import ReshapeAttribute as a, Attribute - - self.utype = Attribute.Attribute().ReshapeAttribute - self.optFcns = (a.Start, a.End) - - self.intvecs.append((a.AddNewShape, new_shape)) - - def SliceAttribute(self, start, size): - from tosa import SliceAttribute as a, Attribute - - self.utype = Attribute.Attribute().SliceAttribute - self.optFcns = (a.Start, a.End) - - self.intvecs.append((a.AddStart, start)) - self.intvecs.append((a.AddSize, size)) - - def TileAttribute(self, multiples): - from tosa import TileAttribute as a, Attribute - - self.utype = Attribute.Attribute().TileAttribute - self.optFcns = (a.Start, a.End) - - self.intvecs.append((a.AddMultiples, multiples)) - def ResizeAttribute(self, scale, offset, border, mode): from tosa import ResizeAttribute as a, Attribute @@ -330,23 +305,23 @@ class TosaSerializerAttribute(TosaSerializerUnion): self.bools.append((a.AddRound, round)) - def CondIfAttribute(self, then_branch, else_branch): + def CondIfAttribute(self, then_graph, else_graph): from tosa import CondIfAttribute as a, Attribute self.utype = Attribute.Attribute().CondIfAttribute self.optFcns = (a.Start, a.End) - self.strings.append((a.AddThenBranch, then_branch)) - self.strings.append((a.AddElseBranch, else_branch)) + self.strings.append((a.AddThenGraph, then_graph)) + self.strings.append((a.AddElseGraph, else_graph)) - def WhileLoopAttribute(self, cond_branch, body_branch): + def WhileLoopAttribute(self, cond_graph, body_graph): from tosa import WhileLoopAttribute as a, Attribute self.utype = Attribute.Attribute().WhileLoopAttribute self.optFcns = (a.Start, a.End) - self.strings.append((a.AddCondBranch, cond_branch)) - self.strings.append((a.AddBodyBranch, body_branch)) + self.strings.append((a.AddCondGraph, cond_graph)) + self.strings.append((a.AddBodyGraph, body_graph)) def TransposeAttribute(self, perms): from tosa import TransposeAttribute as a, Attribute -- cgit v1.2.1