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
diff --git a/ethosu/vela/api.py b/ethosu/vela/api.py
index 06de0d9..0799ab1 100644
--- a/ethosu/vela/api.py
+++ b/ethosu/vela/api.py
@@ -23,6 +23,10 @@
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 @@
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