Alexey-Yazev commented on code in PR #13645:
URL: https://github.com/apache/tvm/pull/13645#discussion_r1059276969


##########
tests/python/contrib/test_ethosu/test_codegen.py:
##########
@@ -1109,6 +1109,45 @@ def leaky_relu_func(x):
     )
 
 
+def test_tflite_relu6():
+    np.random.seed(0)
+    accel_type = "ethos-u55-128"
+    ifm_shape = (1, 12, 16, 8)
+
+    @tf.function
+    def relu6(x):
+        return tf.nn.relu6(x)
+
+    infra.compare_tvm_with_tflite(
+        relu6,
+        [ifm_shape],
+        accel_type,
+        enable_cascader=is_u55_accel_type(accel_type),
+        ranges=[(-1, 1)],
+    )
+
+
+def test_tflite_relu_n1_to_1():
+    np.random.seed(0)
+    accel_type = "ethos-u55-128"
+    ifm_shape = (1, 12, 16, 8)
+
+    @tf.function
+    def relu_n1_to_1(x):
+        """
+        The specific pattern will be replaced into RELU_N1_TO_1 by tflite.
+        """
+        return tf.math.maximum(-1.0, tf.math.minimum(x, 1.0))

Review Comment:
   All relu operations are converted to clip operations in tflite frontend. It 
seems these tests are unnecessary perhaps it's worth adding a test for maximum 
operation when there are different scales and it's uploaded to the npu not by 
one operation as in other cases, but by two.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to