haojin2 commented on a change in pull request #15987: Numpy add numpy op rot90
URL: https://github.com/apache/incubator-mxnet/pull/15987#discussion_r318874396
 
 

 ##########
 File path: src/operator/numpy/np_matrix_op-inl.h
 ##########
 @@ -60,6 +60,246 @@ void NumpyTranspose(const nnvm::NodeAttrs& attrs,
   }
 }
 
+struct NumpyRot90Param : public dmlc::Parameter<NumpyRot90Param> {
+  int k;
+  dmlc::optional<mxnet::TShape> axes;
+  DMLC_DECLARE_PARAMETER(NumpyRot90Param) {
+    DMLC_DECLARE_FIELD(k)
+    .set_default(1)
+    .describe("Number of times the array is rotated by 90 degrees.");
+    DMLC_DECLARE_FIELD(axes)
+    .set_default(dmlc::optional<mxnet::TShape>())
+    .describe(" The array is rotated in the plane defined by the axes. Axes 
must be different.");
+  }
+};
+
+struct rot90reverse {
+  MSHADOW_XINLINE static index_t ReverseIndex(index_t idx,
+                                              index_t nreversedim,
+                                              const index_t * stride_,
+                                              const index_t * trailing_) {
+    index_t outputIndex = idx;
+    for (index_t i = 0; i < nreversedim; ++i) {
+      const index_t low = outputIndex % trailing_[i];
+      index_t high = outputIndex / trailing_[i];
+      const index_t x = high % stride_[i];
+      high /= stride_[i];
+      outputIndex = (high * stride_[i] + stride_[i] - 1 - x) * trailing_[i] + 
low;
+    }
+    return outputIndex;
+  }
+  template<typename DType>
+  MSHADOW_XINLINE  static void Map(index_t index, index_t nreversedim, const 
DType *src, DType *dst,
 
 Review comment:
   should have only 1 space after `MSHADOW_XINLINE`

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