diff options
author | Patrik Gustavsson <patrik.gustavsson@arm.com> | 2020-11-18 17:05:50 +0100 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2020-11-19 12:12:07 +0000 |
commit | c8a22f198c4fb23735962fee00c062b0325ca6a6 (patch) | |
tree | e9a99cb102d43471a6454267170aa7e5ba3b541f /ethosu/vela/api.py | |
parent | bdf09f9eca75fab14298a94a5402efc15f698e68 (diff) | |
download | ethos-u-vela-c8a22f198c4fb23735962fee00c062b0325ca6a6.tar.gz |
MLBEDSW-3251 Add version to external API
Added version to the external API
-Added CLI-option --api_version
-Added API function to get the API version
Signed-off-by: Patrik Gustavsson <patrik.gustavsson@arm.com>
Change-Id: I0143b50adf884a2b05145912a1c7bef8cecc5f02
Diffstat (limited to 'ethosu/vela/api.py')
-rw-r--r-- | ethosu/vela/api.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ethosu/vela/api.py b/ethosu/vela/api.py index 06de0d9a..0799ab1c 100644 --- a/ethosu/vela/api.py +++ b/ethosu/vela/api.py @@ -23,6 +23,10 @@ from typing import NamedTuple from typing import Optional from typing import Tuple +API_version_major = 1 +API_version_minor = 0 +api_version = f"{API_version_major}.{API_version_minor}" + class NpuElementWiseOp(Enum): """ @@ -367,3 +371,13 @@ class NpuElementWiseOperation(NpuBlockOperation): self.reversed_operands: bool = False # Set to a tuple (scale, shift) for explicit rescale, else to None self.rescale: Optional[Tuple] = None + + +def npu_get_API_version(): + """ + Public facing API to get the API version + :return: int, the 16 most significant bits, corresponding to major version + the 16 least significant bits, corresponding to minor version + """ + version = (API_version_major << 16) | (API_version_minor & 0xFFFF) + return version |