aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tflite_model_semantic.py
diff options
context:
space:
mode:
Diffstat (limited to 'ethosu/vela/tflite_model_semantic.py')
-rw-r--r--ethosu/vela/tflite_model_semantic.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ethosu/vela/tflite_model_semantic.py b/ethosu/vela/tflite_model_semantic.py
index c811a0d4..e0541df5 100644
--- a/ethosu/vela/tflite_model_semantic.py
+++ b/ethosu/vela/tflite_model_semantic.py
@@ -532,10 +532,11 @@ class TFLiteSemantic:
@staticmethod
def constraint_alpha_valid(op):
- "Alpha must not be negative"
+ "Alpha only allowed to be negative if IFM is int8 or uint8"
alpha = op.attrs["alpha"]
- valid = alpha >= 0
- return valid, f"Op has alpha={alpha}"
+ ifm_dtype = op.ifm.dtype
+ valid = ifm_dtype == DataType.int8 or ifm_dtype == DataType.uint8 or alpha >= 0
+ return valid, f"Op has alpha={alpha} and ifm_dtype={ifm_dtype} "
@staticmethod
def constraint_keep_dim_ifm_ofm(op):