ehsanmok commented on code in PR #13163:
URL: https://github.com/apache/tvm/pull/13163#discussion_r1002119311


##########
python/tvm/topi/image/grid_sample.py:
##########
@@ -200,13 +200,13 @@ def _bilinear_sample(n, c, h, w):
 
     def _nearest_sample(n, c, h, w):
         y, x = _compute_source_index(n, h, w)
-        y_new = te.round(y).astype("int32")
-        x_new = te.round(x).astype("int32")
+        y_new = te.nearbyint(y).astype("int32")

Review Comment:
   The `round` fails as for `nearest` interpolation for cpu as onnx uses 
[`std::nearbyintf`](https://github.com/microsoft/onnxruntime/blob/62cc927f05580a8875af1fc93363d4b6d34bc2c6/onnxruntime/core/providers/cpu/tensor/grid_sample.cc#L189-L192)
 and but 
[`nearbyint`](https://github.com/microsoft/onnxruntime/blob/62cc927f05580a8875af1fc93363d4b6d34bc2c6/onnxruntime/contrib_ops/cuda/grid_sample_impl.cu#L131-L134)
 for cuda.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to