inadob commented on a change in pull request #5041: [TFLITE]DepthToSpace and 
SpaceToDepth support
URL: https://github.com/apache/incubator-tvm/pull/5041#discussion_r391550645
 
 

 ##########
 File path: tests/python/frontend/tflite/test_forward.py
 ##########
 @@ -1420,6 +1420,43 @@ def test_forward_prelu():
     _test_prelu(np.random.uniform(-5, 5, size=(1, 32, 32, 
3)).astype("float32"), np.full((3,), 0.2, dtype="float32"))
     _test_prelu(np.random.uniform(-5, 5, size=(1, 32, 32, 
3)).astype("float32"), np.full((1, 1, 3), 0.2, dtype="float32"))
 
+#######################################################################
+# DepthToSpace
+# ------------
+
+def _test_depthtospace(data, block_size):
+    """ One iteration of depth_to_space operation with given data and block 
size """
+
+    with tf.Graph().as_default():
+        in_data = array_ops.placeholder(shape=data.shape, dtype=data.dtype)
+        out = array_ops.depth_to_space(in_data, block_size)
+        compare_tflite_with_tvm(data, 'Placeholder:0', [in_data], [out])
+
+
+def test_forward_depthtospace():
+    if package_version.parse(tf.VERSION) >= package_version.parse('1.15.0'):
+        _test_depthtospace(np.random.normal(size=[1, 32, 32, 
4]).astype("float32"), 2)
+        _test_depthtospace(np.random.normal(size=[1, 16, 8, 
32]).astype("float32"), 4)
+
+#######################################################################
+# SpaceToDepth
+# ------------
+
+def _test_spacetodepth(data, block_size):
+    """ One iteration of space_to_depth operation with given data and block 
size """
+
+    with tf.Graph().as_default():
+        in_data = array_ops.placeholder(shape=data.shape, dtype=data.dtype)
+        out = array_ops.space_to_depth(in_data, block_size)
+        compare_tflite_with_tvm(data, 'Placeholder:0', [in_data], [out])
+
+
+
+def test_forward_spacetodepth():
+    if package_version.parse(tf.VERSION) >= package_version.parse('1.14.0'):
 
 Review comment:
   Why we need this check here

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to