xiezhq-hermann commented on a change in pull request #15906: [Numpy] Numpy 
operator diff
URL: https://github.com/apache/incubator-mxnet/pull/15906#discussion_r317920191
 
 

 ##########
 File path: src/operator/numpy/np_diff-inl.h
 ##########
 @@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file np_diff-inl.h
+ * \brief Function definition of numpy-compatible diff operator
+ */
+
+#ifndef MXNET_OPERATOR_NUMPY_NP_DIFF_INL_H_
+#define MXNET_OPERATOR_NUMPY_NP_DIFF_INL_H_
+
+#include <mxnet/base.h>
+#include <mxnet/operator_util.h>
+#include <vector>
+#include "../mxnet_op.h"
+#include "../operator_common.h"
+#include "../tensor/broadcast_reduce_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct DiffParam : public dmlc::Parameter<DiffParam> {
+  int n, axis;
+  dmlc::optional<mxnet::TShape> prepend;
+  dmlc::optional<mxnet::TShape> append;
+  DMLC_DECLARE_PARAMETER(DiffParam) {
+    DMLC_DECLARE_FIELD(n).set_default(1).describe(
+        "The number of times values are differenced."
+        " If zero, the input is returned as-is.");
+    DMLC_DECLARE_FIELD(axis).set_default(-1).describe(
+        "Axis along which the cumulative sum is computed."
+        " The default (None) is to compute the diff over the flattened 
array.");
+  }
+};
+
+inline void YanghuiTri(std::vector<int>* buffer, int n) {
 
 Review comment:
   The `inline` is finally kept since the function here is really concise and 
no need to be put in .cc

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


With regards,
Apache Git Services

Reply via email to