aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/numeric_util.py
diff options
context:
space:
mode:
authorDwight Lidman <dwight.lidman@arm.com>2020-09-28 15:53:40 +0200
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2020-10-12 07:02:26 +0000
commit8359a474e4f125382fd7b7d5431a612f6013f107 (patch)
tree50c5fc46f0b6117af77722a61edce19131b35e11 /ethosu/vela/numeric_util.py
parent04f8c009d17e339d5afd515a57f98c31e4297fe8 (diff)
downloadethos-u-vela-8359a474e4f125382fd7b7d5431a612f6013f107.tar.gz
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
Diffstat (limited to 'ethosu/vela/numeric_util.py')
-rw-r--r--ethosu/vela/numeric_util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ethosu/vela/numeric_util.py b/ethosu/vela/numeric_util.py
index 4ebef8e5..20aa4a05 100644
--- a/ethosu/vela/numeric_util.py
+++ b/ethosu/vela/numeric_util.py
@@ -93,3 +93,13 @@ def full_shape(dim, shape, fill):
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