MLBEDSW-3061: Update supported_operators.py
This commit changes and amends some parts of the
restriction functions in order to make sure
operators are correctly placed.
Signed-off-by: Dwight Lidman <dwight.lidman@arm.com>
Change-Id: I336cf33a874c9078a5bbf81ce129ff917dbc5e9a
diff --git a/ethosu/vela/numeric_util.py b/ethosu/vela/numeric_util.py
index 4ebef8e..20aa4a0 100644
--- a/ethosu/vela/numeric_util.py
+++ b/ethosu/vela/numeric_util.py
@@ -93,3 +93,13 @@
def overlaps(start1, end1, start2, end2):
return start1 < end2 and start2 < end1
+
+
+def is_integer(num):
+ if isinstance(num, (int, np.integer)):
+ return True
+ if type(num) is float and num.is_integer():
+ return True
+ if isinstance(num, np.inexact) and np.mod(num, 1) == 0:
+ return True
+ return False