diff options
author | Eric Kunze <eric.kunze@arm.com> | 2023-02-13 16:19:34 -0800 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2023-04-14 16:13:27 -0700 |
commit | 544227ef40dc226707d2c97b41cf0ee0b6111d39 (patch) | |
tree | 871a149f9e7c686a5c18e61ac5194d6eee5f970d /tools/tosa.py | |
parent | 9bb5f5dd6b3999e46eb32ee2a897cc643c86c96d (diff) | |
download | specification-544227ef40dc226707d2c97b41cf0ee0b6111d39.tar.gz |
Add enumerations to TOSA specification
Currently used by RESIZE and AVG_POOL2D
Change-Id: I4f401ac092fcf426e6d57b3729943135f634a31e
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Diffstat (limited to 'tools/tosa.py')
-rw-r--r-- | tools/tosa.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/tosa.py b/tools/tosa.py index 74d43d6..9af0756 100644 --- a/tools/tosa.py +++ b/tools/tosa.py @@ -7,6 +7,12 @@ class TOSAOperatorArgumentCategory: self.name = name self.profiles = profiles +class TOSAEnum: + def __init__(self, name, description, values): + self.name = name + self.description = description + self.values = values + class TOSAOperatorArgument: def __init__(self, name, description, categories, ty, shape, levellimits): @@ -44,12 +50,15 @@ class TOSASpec: tree = ET.parse(xmlpath) self.xmlroot = tree.getroot() self.operatorgroups = [] + self.enums = [] self.__load_spec() def __load_spec(self): self.__load_version() 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)) def __load_version(self): version = self.xmlroot.find("./version") @@ -112,3 +121,11 @@ class TOSASpec: argcats.append(TOSAOperatorArgumentCategory(cat[0], cat[1].split(","))) return TOSAOperatorArgument(name, desc, argcats, argtype, shape, levellimits) + + 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)
\ No newline at end of file |