diff options
author | Eric Kunze <eric.kunze@arm.com> | 2022-06-07 05:17:37 +0000 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2022-06-15 08:30:47 -0700 |
commit | bdcc3fee1b8bf55aac50e060115b92a1ccf9741c (patch) | |
tree | 05951f3fd1b9e42f859e999976715e6e673acb15 /python/tosa/PoolAttribute.py | |
parent | a336d54aca08b06953a8b6c49d7e5f6c4899952e (diff) | |
download | serialization_lib-bdcc3fee1b8bf55aac50e060115b92a1ccf9741c.tar.gz |
Remove quantinfo types
Any needed information has been moved into the attributes for each operator.
This aligns with the structure of the attributes in the TOSA
specification, and generally simplifies the code.
Change-Id: I8243e91b09de1a9115f8af09c5e7def7e8f2866b
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Diffstat (limited to 'python/tosa/PoolAttribute.py')
-rw-r--r-- | python/tosa/PoolAttribute.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/python/tosa/PoolAttribute.py b/python/tosa/PoolAttribute.py index f2c12cf..8b6903e 100644 --- a/python/tosa/PoolAttribute.py +++ b/python/tosa/PoolAttribute.py @@ -105,11 +105,27 @@ class PoolAttribute(object): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) return o == 0 -def PoolAttributeStart(builder): builder.StartObject(3) + # PoolAttribute + def InputZp(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + + # PoolAttribute + def OutputZp(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + +def PoolAttributeStart(builder): builder.StartObject(5) def PoolAttributeAddPad(builder, pad): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pad), 0) def PoolAttributeStartPadVector(builder, numElems): return builder.StartVector(4, numElems, 4) def PoolAttributeAddKernel(builder, kernel): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(kernel), 0) def PoolAttributeStartKernelVector(builder, numElems): return builder.StartVector(4, numElems, 4) def PoolAttributeAddStride(builder, stride): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(stride), 0) def PoolAttributeStartStrideVector(builder, numElems): return builder.StartVector(4, numElems, 4) +def PoolAttributeAddInputZp(builder, inputZp): builder.PrependInt32Slot(3, inputZp, 0) +def PoolAttributeAddOutputZp(builder, outputZp): builder.PrependInt32Slot(4, outputZp, 0) def PoolAttributeEnd(builder): return builder.EndObject() |