diff options
author | Jerry Ge <jerry.ge@arm.com> | 2023-08-11 16:43:30 +0000 |
---|---|---|
committer | Jerry Ge <jerry.ge@arm.com> | 2023-08-11 16:43:47 +0000 |
commit | 0fc278bbd87827875ef4add9cfd46aea0d787b31 (patch) | |
tree | ac1bd06e51730239befc88895cb2db0bca49bc23 /tools | |
parent | 12ab5da01cbc152ed14f00fccdf94815dd1512d2 (diff) | |
download | specification-0fc278bbd87827875ef4add9cfd46aea0d787b31.tar.gz |
Add StatefulOps to TOSA specification
Signed-off-by: Jerry Ge <jerry.ge@arm.com>
Change-Id: I63a4c1202a1eddcdedb222e64cac34557647ff21
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dictionary.dic | 1 | ||||
-rw-r--r-- | tools/tosa.py | 17 |
2 files changed, 16 insertions, 2 deletions
diff --git a/tools/dictionary.dic b/tools/dictionary.dic index 70e556a..e2e1a58 100644 --- a/tools/dictionary.dic +++ b/tools/dictionary.dic @@ -82,3 +82,4 @@ TPUs ulp unary Unary +uid diff --git a/tools/tosa.py b/tools/tosa.py index 26e501f..803e478 100644 --- a/tools/tosa.py +++ b/tools/tosa.py @@ -4,6 +4,7 @@ import re import xml.etree.ElementTree as ET + # possible shapes: shape1, [2], [N,H,W,C] # returns (checkable, rank) # checkable is false if shape doesn't contain [] @@ -46,8 +47,18 @@ class TOSALevel: class TOSAOperatorArgument: def __init__( - self, name, description, categories, ty, elty, shape, levellimits, rank + self, + name, + description, + categories, + ty, + elty, + shape, + levellimits, + rank, + optional=False, ): + assert isinstance(optional, bool) self.name = name self.description = description self.categories = categories @@ -56,6 +67,7 @@ class TOSAOperatorArgument: self.shape = shape self.levellimits = levellimits self.rank = rank + self.optional = optional class TOSAOperatorDataTypeSupport: @@ -161,6 +173,7 @@ class TOSASpec: shape = arg.get("shape") levellimits = [] rank = [] + optional = arg.get("optional", "false") == "true" r = arg.find("rank") if r is not None: rank = [r.get("min"), r.get("max")] @@ -194,7 +207,7 @@ class TOSASpec: argcats.append(TOSAOperatorArgumentCategory(cat[0], cat[1].split(","))) return TOSAOperatorArgument( - name, desc, argcats, argtype, argtelty, shape, levellimits, rank + name, desc, argcats, argtype, argtelty, shape, levellimits, rank, optional ) def __load_enum(self, arg): |