You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/12/30 07:44:35 UTC

[GitHub] [tvm] Alexey-Yazev commented on a diff in pull request #13645: [microNPU] Add relu6 relu_n1_to_1 test cases for Ethos-U

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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org