From 8359a474e4f125382fd7b7d5431a612f6013f107 Mon Sep 17 00:00:00 2001 From: Dwight Lidman Date: Mon, 28 Sep 2020 15:53:40 +0200 Subject: 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 Change-Id: I336cf33a874c9078a5bbf81ce129ff917dbc5e9a --- ethosu/vela/numeric_util.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ethosu/vela/numeric_util.py') 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 -- cgit v1.2.1