javelinjs commented on a change in pull request #8759: image flip op
URL: https://github.com/apache/incubator-mxnet/pull/8759#discussion_r152729081
 
 

 ##########
 File path: src/operator/image/image_random-inl.h
 ##########
 @@ -144,6 +151,45 @@ static void Normalize(const nnvm::NodeAttrs &attrs,
   });
 }
 
+inline static int FlipIndex(int idx, const int stride, const int trailing) {
+  const int low = idx % trailing;
+  int high = idx / trailing;
+  const int x = high % stride;
+  high /= stride;
+
+  return (high * stride + stride - 1 - x) * trailing + low;
+}
+
+template<typename DType>
+static void FlipImpl(const int size, DType *src, DType *dst,
+                     const int stride, const int trailing) {
+  for (int idx = 0; idx < size; ++idx) {
+    int new_idx = FlipIndex(idx, stride, trailing);
 
 Review comment:
   how's it now?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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