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 2021/04/30 19:39:56 UTC

[GitHub] [tvm] AndrewZhaoLuo commented on a change in pull request #7928: [ONNX][TOPI][Relay]Support dilations in pooling operators

AndrewZhaoLuo commented on a change in pull request #7928:
URL: https://github.com/apache/tvm/pull/7928#discussion_r624148384



##########
File path: tests/python/contrib/test_arm_compute_lib/test_pooling.py
##########
@@ -17,30 +17,32 @@
 """Arm Compute Library integration pooling tests."""
 
 import numpy as np
-
 import tvm
-from tvm import relay
-from tvm import testing
+from tvm import relay, testing
 
 from test_arm_compute_lib.infrastructure import (
-    skip_runtime_test,
-    skip_codegen_test,
+    Device,
     build_and_run,
+    skip_codegen_test,
+    skip_runtime_test,
     verify,
     verify_codegen,
 )
-from test_arm_compute_lib.infrastructure import Device
 
 
-def _calculate_output_shape(shape, sizes, padding, strides):
+def _calculate_output_shape(shape, sizes, padding, strides, dilation):
     """Calculate pooling output shape."""
-    output_height = ((shape[1] - sizes[0] + padding[0] + padding[2]) / strides[0]) + 1
-    output_width = ((shape[2] - sizes[1] + padding[1] + padding[3]) / strides[1]) + 1
+    output_height = (
+        (shape[1] - (sizes[0] - 1) * dilation[0] - 1 + padding[0] + padding[2]) / strides[0]
+    ) + 1
+    output_width = (
+        (shape[2] - (sizes[1] - 1) * dilation[1] - 1 + padding[1] + padding[3]) / strides[1]
+    ) + 1

Review comment:
       I've factored out some terms into a "receptive_field" variable. It was the prettiest way I could figure out.




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