From 57d781883142db8a45fe98ac1a1dfacc49cba78a Mon Sep 17 00:00:00 2001 From: Tai Ly Date: Tue, 9 Apr 2024 19:31:24 +0000 Subject: [serialization_lib] Remove unused type field from Pad and Clamp This patch removes the "type" field from PadAttribute and ClampAttribute because they are unused and unneeded. Signed-off-by: Tai Ly Change-Id: I378291b340ecee86824f25b3887aa4511207db23 --- python/serializer/tosa_serializer.py | 8 ++------ python/tosa/ClampAttribute.py | 15 +-------------- python/tosa/PadAttribute.py | 15 +-------------- 3 files changed, 4 insertions(+), 34 deletions(-) (limited to 'python') diff --git a/python/serializer/tosa_serializer.py b/python/serializer/tosa_serializer.py index 298907e..bbfb37e 100644 --- a/python/serializer/tosa_serializer.py +++ b/python/serializer/tosa_serializer.py @@ -205,7 +205,7 @@ class TosaSerializerAttribute(TosaSerializerUnion): self.bools.append((a.AddLocalBound, local_bound)) self.ints.append((a.AddAccType, acc_type)) - def PadAttribute(self, serializer_builder, pad_const_val_as_bytes, dtype): + def PadAttribute(self, serializer_builder, pad_const_val_as_bytes): from tosa import PadAttribute as a, Attribute self.utype = Attribute.Attribute().PadAttribute @@ -217,7 +217,6 @@ class TosaSerializerAttribute(TosaSerializerUnion): ) self.floats.append((a.AddPadConst, serialized_pad_const_val)) - self.ints.append((a.AddType, dtype)) def AxisAttribute(self, axis): from tosa import AxisAttribute as a, Attribute @@ -238,9 +237,7 @@ class TosaSerializerAttribute(TosaSerializerUnion): self.int16vecs.append((a.AddBorder, border)) self.ints.append((a.AddMode, mode)) - def ClampAttribute( - self, serializer_builder, min_val_as_bytes, max_val_as_bytes, dtype - ): + def ClampAttribute(self, serializer_builder, min_val_as_bytes, max_val_as_bytes): from tosa import ClampAttribute as a, Attribute self.utype = Attribute.Attribute().ClampAttribute @@ -256,7 +253,6 @@ class TosaSerializerAttribute(TosaSerializerUnion): self.floats.append((a.AddMinVal, serialized_min_val)) self.floats.append((a.AddMaxVal, serialized_max_val)) - self.ints.append((a.AddType, dtype)) def RescaleAttribute( self, diff --git a/python/tosa/ClampAttribute.py b/python/tosa/ClampAttribute.py index 1189acb..6a41498 100644 --- a/python/tosa/ClampAttribute.py +++ b/python/tosa/ClampAttribute.py @@ -82,15 +82,8 @@ class ClampAttribute(object): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) return o == 0 - # ClampAttribute - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) - return 0 - def ClampAttributeStart(builder): - builder.StartObject(3) + builder.StartObject(2) def Start(builder): ClampAttributeStart(builder) @@ -119,12 +112,6 @@ def ClampAttributeStartMaxValVector(builder, numElems): def StartMaxValVector(builder, numElems: int) -> int: return ClampAttributeStartMaxValVector(builder, numElems) -def ClampAttributeAddType(builder, type): - builder.PrependUint32Slot(2, type, 0) - -def AddType(builder, type): - ClampAttributeAddType(builder, type) - def ClampAttributeEnd(builder): return builder.EndObject() diff --git a/python/tosa/PadAttribute.py b/python/tosa/PadAttribute.py index c4084dc..301bf17 100644 --- a/python/tosa/PadAttribute.py +++ b/python/tosa/PadAttribute.py @@ -55,15 +55,8 @@ class PadAttribute(object): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) return o == 0 - # PadAttribute - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) - return 0 - def PadAttributeStart(builder): - builder.StartObject(2) + builder.StartObject(1) def Start(builder): PadAttributeStart(builder) @@ -80,12 +73,6 @@ def PadAttributeStartPadConstVector(builder, numElems): def StartPadConstVector(builder, numElems: int) -> int: return PadAttributeStartPadConstVector(builder, numElems) -def PadAttributeAddType(builder, type): - builder.PrependUint32Slot(1, type, 0) - -def AddType(builder, type): - PadAttributeAddType(builder, type) - def PadAttributeEnd(builder): return builder.EndObject() -- cgit v1.2.1