aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Petit <kevin.petit@arm.com>2023-04-27 17:28:16 +0100
committerKevin Petit <kevin.petit@arm.com>2023-04-28 17:25:25 +0100
commit53e76592361df8c33a6d9580f0170a335c1a15fd (patch)
treec7db37962f7ddb9a4da9fef30827544f492855dd
parentbc72ba8ec128dc8c851455300085961d6e716959 (diff)
downloadspecification-53e76592361df8c33a6d9580f0170a335c1a15fd.tar.gz
Fix resize_t enum name
resize_t is already used in the type support table for RESIZE, rename the mode enum to resize_mode_t. Also add a python function to get an enum object by name to the spec object. Change-Id: Id12c10929beda469c6e3714518d6e26f18ddd440 Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-rw-r--r--tools/tosa.py9
-rw-r--r--tosa.xml4
2 files changed, 9 insertions, 4 deletions
diff --git a/tools/tosa.py b/tools/tosa.py
index 52fda3e..bc6faa6 100644
--- a/tools/tosa.py
+++ b/tools/tosa.py
@@ -66,7 +66,7 @@ class TOSASpec:
for group in self.xmlroot.findall("./operators/operatorgroup"):
self.operatorgroups.append(self.__load_operator_group(group))
for enum in self.xmlroot.findall("./enum"):
- self.enums.append(self.load_enum(enum))
+ self.enums.append(self.__load_enum(enum))
def __load_version(self):
version = self.xmlroot.find("./version")
@@ -142,10 +142,15 @@ class TOSASpec:
return TOSAOperatorArgument(name, desc, argcats, argtype, shape, levellimits)
- def load_enum(self, arg):
+ def __load_enum(self, arg):
name = arg.get("name")
desc = arg.get("description").strip()
values = []
for val in arg.findall("enumval"):
values.append((val.get("name"), val.get("value"), val.get("description")))
return TOSAEnum(name, desc, values)
+
+ def get_enum_by_name(self, name):
+ for e in self.enums:
+ if e.name == name:
+ return e
diff --git a/tosa.xml b/tosa.xml
index fa45c99..7810127 100644
--- a/tosa.xml
+++ b/tosa.xml
@@ -1977,7 +1977,7 @@ used.</description>
<argument category="attribute" name="border" type="int16_t*" shape="[2]">
<description>[border_y, border_x]</description>
</argument>
- <argument category="attribute" name="mode" type="resize_t" shape="-">
+ <argument category="attribute" name="mode" type="resize_mode_t" shape="-">
<description>BILINEAR or NEAREST</description>
</argument>
<argument category="output" name="output" type="out_t*" shape="[N,OH,OW,C]">
@@ -2284,7 +2284,7 @@ used.</description>
</operatorgroup>
</operators>
- <enum name="resize_t" description="Valid resize types">
+ <enum name="resize_mode_t" description="Valid resize types">
<enumval value="0" name="NEAREST_NEIGHBOR" description="Nearest neighbor resize"/>
<enumval value="1" name="BILINEAR" description="Bilinear resize"/>
</enum>