You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/02/19 05:18:51 UTC
[GitHub] [incubator-mxnet] Alicia1529 opened a new pull request #17624:
[Numpy] add ediff1d
Alicia1529 opened a new pull request #17624: [Numpy] add ediff1d
URL: https://github.com/apache/incubator-mxnet/pull/17624
## Description ##
add numpy operator ediff1d
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request
#17624: [Numpy] add ediff1d
Posted by GitBox <gi...@apache.org>.
haojin2 commented on a change in pull request #17624: [Numpy] add ediff1d
URL: https://github.com/apache/incubator-mxnet/pull/17624#discussion_r381825160
##########
File path: python/mxnet/ndarray/numpy/_op.py
##########
@@ -6758,6 +6758,67 @@ def diff(a, n=1, axis=-1, prepend=None, append=None): # pylint: disable=redefin
return _npi.diff(a, n=n, axis=axis)
+@set_module('mxnet.ndarray.numpy')
+def ediff1d(ary, to_end=None, to_begin=None):
+ """
+ The differences between consecutive elements of an array.
+
+ Parameters
+ ----------
+ ary : ndarray
+ If necessary, will be flattened before the differences are taken.
+ to_end : ndarray or scalar, optional
+ Number(s) to append at the end of the returned differences.
+ to_begin : ndarray or scalar, optional
+ Number(s) to prepend at the beginning of the returned differences.
+
+ Returns
+ -------
+ ediff1d : ndarray
+ The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``.
+
+ See Also
+ --------
+ diff, gradient
Review comment:
get rid of this section in all wrappers.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request
#17624: [Numpy] add ediff1d
Posted by GitBox <gi...@apache.org>.
haojin2 commented on a change in pull request #17624: [Numpy] add ediff1d
URL: https://github.com/apache/incubator-mxnet/pull/17624#discussion_r381825639
##########
File path: src/operator/numpy/np_ediff1d_op-inl.h
##########
@@ -0,0 +1,224 @@
+/*
+ * 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_ediff1d-inl.h
+ * \brief Function definition of numpy-compatible ediff1d operator
+ */
+
+#ifndef MXNET_OPERATOR_NUMPY_NP_EDIFF1D_OP_INL_H_
+#define MXNET_OPERATOR_NUMPY_NP_EDIFF1D_OP_INL_H_
+
+#include <mxnet/base.h>
+#include <mxnet/operator_util.h>
+#include <vector>
+#include "../mxnet_op.h"
+#include "../operator_common.h"
+#include "../elemwise_op_common.h"
+
+namespace mxnet {
+namespace op {
+
+struct EDiff1DParam : public dmlc::Parameter<EDiff1DParam> {
+ bool to_begin_arr_given, to_end_arr_given;
+ dmlc::optional<double> to_begin_scalar;
+ dmlc::optional<double> to_end_scalar;
+ DMLC_DECLARE_PARAMETER(EDiff1DParam) {
+ DMLC_DECLARE_FIELD(to_begin_arr_given).set_default(false).describe(
Review comment:
pay attention to line wraps and indentations:
```c++
DMLC_DECLARE_FIELD(to_begin_arr_given)
.set_default(false)
.describe("blah blah")
```
same for all other parameter fields.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-mxnet] haojin2 merged pull request #17624: [Numpy] add
ediff1d
Posted by GitBox <gi...@apache.org>.
haojin2 merged pull request #17624: [Numpy] add ediff1d
URL: https://github.com/apache/incubator-mxnet/pull/17624
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services