benhe2011 commented on a change in pull request #15811: [MXNET-891] Support 
tuple of scales in upsample operator
URL: https://github.com/apache/incubator-mxnet/pull/15811#discussion_r318215704
 
 

 ##########
 File path: tests/python/unittest/test_operator.py
 ##########
 @@ -1597,16 +1605,29 @@ def _init_bilinear(arr, f):
     assert out.shape == data_shape[:2] + target_shape
 
 
+"""
+The test cases include integer, tuple, 
+and empty tuple scales on up to 3 shapes 
+at once with the shapes having various sizes 
+for their heights and widths
+"""
 @with_seed()
 def test_nearest_upsampling():
-    for root_scale in [1,2,3]:
-        for scale in [1,2,3]:
-            for num_shape in [1,2,3]:
-                for base in [1,2,3]:
-                    shapes = 
[(1,3,base*root_scale*scale**(num_shape-1-i),base*root_scale*scale**(num_shape-1-i))
 for i in range(num_shape)]
+    for root_scale in [1, 2, (3), (2,3), (3,2), (1,1), (5,1), (2,2), ()]:
+        for scale in [1, 2, 3]:
+            for num_shape in [1, 2, 3]:
+                for base in [1, 2, 3]:
+                    root_h = root_w = 1
+                    if type(root_scale) is int:
+                        root_h = root_w = root_scale
+                    elif len(root_scale) == 1:
+                        root_h = root_w = root_scale[0]
+                    elif len(root_scale) >= 2:
+                        root_h = root_scale[0]
+                        root_w = root_scale[1]
+                    shapes = [(1, 3, base*root_h*scale**(num_shape-1-i), 
base*root_w*scale**(num_shape-1-i)) for i in range(num_shape)]
                     check_nearest_upsampling_with_shape(shapes, scale, 
root_scale)
 
-
 
 Review comment:
   I see, changes made.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to