masahi commented on a change in pull request #4584: [TOPI] add 3D upsampling Op.
URL: https://github.com/apache/incubator-tvm/pull/4584#discussion_r361604783
 
 

 ##########
 File path: topi/python/topi/testing/trilinear_resize3d_python.py
 ##########
 @@ -43,34 +43,40 @@ def trilinear_resize3d_python(data_in, out_size, layout,
         raise ValueError("Unsupported coordinate_transformation_mode: 
{}".format(
             coordinate_transformation_mode))
 
+    def _lerp(A, B, t):
+        return A * (1.0 - t) + B * t
+
     for b in range(batch):
         for i in range(channel):
             for m in range(new_d):
                 for j in range(new_h):
                     for k in range(new_w):
-                        in_z = m * depth_scale
-                        z0 = math.floor(in_z)
-                        z1 = min(math.ceil(in_z), d - 1)
-                        z_lerp = in_z - z0
-
-                        z0 = int(z0)
-                        z1 = int(z1)
-
-                        in_y = j * height_scale
-                        y0 = math.floor(in_y)
-                        y1 = min(math.ceil(in_y), h - 1)
-                        y_lerp = in_y - y0
-
-                        y0 = int(y0)
-                        y1 = int(y1)
+                        if coordinate_transformation_mode == "half_pixel":
 
 Review comment:
   please make a simple function and clean up L54 to L79

----------------------------------------------------------------
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