arcadiaphy commented on a change in pull request #14879: Add cpu implementation
for Deformable Convolution
URL: https://github.com/apache/incubator-mxnet/pull/14879#discussion_r286557019
##########
File path: src/operator/contrib/nn/deformable_im2col.h
##########
@@ -65,11 +65,197 @@
#include <mxnet/operator.h>
#include <cstring>
#include <vector>
+#include <algorithm>
#include "../../mxnet_op.h"
namespace mxnet {
namespace op {
+template <typename DType>
+inline DType im2col_bilinear_cpu(const DType* data,
+ const int height,
+ const int width,
+ DType h, DType w) {
+ int h_low = floor(h);
+ int w_low = floor(w);
+ int h_high;
+ int w_high;
+
+ if (h_low >= height - 1) {
+ h_high = height - 1;
+ h = static_cast<DType>(h_low);
Review comment:
Right, I'll look into the code in the perspective of overflow and change the
type of int used in indexing and tensor size to index_t.
For int to float conversion, I think the overflow can't happens in float32
or float64.
----------------------------------------------------------------
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