[incubator-mxnet] 19/42: [numpy] Fix d2l chapter8 (#15237)

2019-07-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a commit to branch numpy
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git

commit a402c0c8879a4ac034362b901ece7f356ee9396b
Author: reminisce 
AuthorDate: Thu Jun 13 14:42:34 2019 -0700

[numpy] Fix d2l chapter8 (#15237)

* Add np op doc

* Fix several issues

* Add a N-D dot b 2D support

* Simplify array creation api

* Add swapaxes

* Fix rnn gluon

* More fix

* Fix pylint

* Delete

* Fix mp windows
---
 python/mxnet/_numpy_op_doc.py  |  88 +++
 python/mxnet/base.py   |   4 ++
 python/mxnet/gluon/data/dataloader.py  |   3 -
 python/mxnet/gluon/nn/basic_layers.py  |   3 +-
 python/mxnet/gluon/rnn/rnn_layer.py|  33 +
 python/mxnet/ndarray/ndarray.py|   4 +-
 python/mxnet/ndarray/numpy/_op.py  |  45 +++-
 python/mxnet/numpy/__init__.py |   2 -
 python/mxnet/numpy/multiarray.py   | 126 -
 python/mxnet/symbol/numpy/_symbol.py   |  86 +-
 src/ndarray/ndarray.cc |   2 +-
 src/operator/nn/concat.cc  |   1 +
 src/operator/numpy/np_dot-inl.h|  32 +++--
 src/operator/numpy/np_dot.cc   |  18 -
 src/operator/numpy/np_matrix_op.cc |  63 +
 src/operator/numpy/np_matrix_op.cu |   3 +
 src/operator/rnn.cc|   1 +
 src/operator/sequence_mask.cc  |   3 +
 src/operator/swapaxis-inl.h|  42 +--
 src/operator/swapaxis.cc   |   2 +-
 src/operator/tensor/indexing_op.cc |   2 +
 src/operator/tensor/matrix_op-inl.h|   8 +--
 src/operator/tensor/matrix_op.cc   |   1 +
 tests/python/unittest/test_numpy_op.py |  68 ++
 24 files changed, 549 insertions(+), 91 deletions(-)

diff --git a/python/mxnet/_numpy_op_doc.py b/python/mxnet/_numpy_op_doc.py
new file mode 100644
index 000..17f92ce
--- /dev/null
+++ b/python/mxnet/_numpy_op_doc.py
@@ -0,0 +1,88 @@
+# 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.
+
+# pylint: skip-file
+
+"""Doc placeholder for numpy ops with prefix _np."""
+
+
+def _np_reshape(a, newshape, order='C'):
+"""Gives a new shape to an array without changing its data.
+
+Parameters
+--
+a : ndarray
+Array to be reshaped.
+newshape : int or tuple of ints
+The new shape should be compatible with the original shape. If
+an integer, then the result will be a 1-D array of that length.
+One shape dimension can be -1. In this case, the value is
+inferred from the length of the array and remaining dimensions.
+order : {'C'}, optional
+Read the elements of `a` using this index order, and place the
+elements into the reshaped array using this index order.  'C'
+means to read / write the elements using C-like index order,
+with the last axis index changing fastest, back to the first
+axis index changing slowest. Other order types such as 'F'/'A'
+may be added in the future.
+
+Returns
+---
+reshaped_array : ndarray
+It will be always a copy of the original array. This behavior is 
different
+from the official NumPy package where views of the original array may 
be
+generated.
+
+See Also
+
+ndarray.reshape : Equivalent method.
+"""
+pass
+
+
+def _np_ones_like(a):
+"""Return an array of ones with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+Array of ones with the same shape and type as `a`.
+"""
+pass
+
+
+def _np_zeros_like(a):
+"""Return an array of zeros with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+

[incubator-mxnet] 19/42: [numpy] Fix d2l chapter8 (#15237)

2019-07-24 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a commit to branch numpy
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git

commit f249ed44d5db8fa20e0eb7f112549b1f4c8b62a6
Author: reminisce 
AuthorDate: Thu Jun 13 14:42:34 2019 -0700

[numpy] Fix d2l chapter8 (#15237)

* Add np op doc

* Fix several issues

* Add a N-D dot b 2D support

* Simplify array creation api

* Add swapaxes

* Fix rnn gluon

* More fix

* Fix pylint

* Delete

* Fix mp windows
---
 python/mxnet/_numpy_op_doc.py  |  88 +++
 python/mxnet/base.py   |   4 ++
 python/mxnet/gluon/data/dataloader.py  |   3 -
 python/mxnet/gluon/nn/basic_layers.py  |   3 +-
 python/mxnet/gluon/rnn/rnn_layer.py|  33 +
 python/mxnet/ndarray/ndarray.py|   4 +-
 python/mxnet/ndarray/numpy/_op.py  |  45 +++-
 python/mxnet/numpy/__init__.py |   2 -
 python/mxnet/numpy/multiarray.py   | 126 -
 python/mxnet/symbol/numpy/_symbol.py   |  86 +-
 src/ndarray/ndarray.cc |   2 +-
 src/operator/nn/concat.cc  |   1 +
 src/operator/numpy/np_dot-inl.h|  32 +++--
 src/operator/numpy/np_dot.cc   |  18 -
 src/operator/numpy/np_matrix_op.cc |  63 +
 src/operator/numpy/np_matrix_op.cu |   3 +
 src/operator/rnn.cc|   1 +
 src/operator/sequence_mask.cc  |   3 +
 src/operator/swapaxis-inl.h|  42 +--
 src/operator/swapaxis.cc   |   2 +-
 src/operator/tensor/indexing_op.cc |   2 +
 src/operator/tensor/matrix_op-inl.h|   8 +--
 src/operator/tensor/matrix_op.cc   |   1 +
 tests/python/unittest/test_numpy_op.py |  68 ++
 24 files changed, 549 insertions(+), 91 deletions(-)

diff --git a/python/mxnet/_numpy_op_doc.py b/python/mxnet/_numpy_op_doc.py
new file mode 100644
index 000..17f92ce
--- /dev/null
+++ b/python/mxnet/_numpy_op_doc.py
@@ -0,0 +1,88 @@
+# 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.
+
+# pylint: skip-file
+
+"""Doc placeholder for numpy ops with prefix _np."""
+
+
+def _np_reshape(a, newshape, order='C'):
+"""Gives a new shape to an array without changing its data.
+
+Parameters
+--
+a : ndarray
+Array to be reshaped.
+newshape : int or tuple of ints
+The new shape should be compatible with the original shape. If
+an integer, then the result will be a 1-D array of that length.
+One shape dimension can be -1. In this case, the value is
+inferred from the length of the array and remaining dimensions.
+order : {'C'}, optional
+Read the elements of `a` using this index order, and place the
+elements into the reshaped array using this index order.  'C'
+means to read / write the elements using C-like index order,
+with the last axis index changing fastest, back to the first
+axis index changing slowest. Other order types such as 'F'/'A'
+may be added in the future.
+
+Returns
+---
+reshaped_array : ndarray
+It will be always a copy of the original array. This behavior is 
different
+from the official NumPy package where views of the original array may 
be
+generated.
+
+See Also
+
+ndarray.reshape : Equivalent method.
+"""
+pass
+
+
+def _np_ones_like(a):
+"""Return an array of ones with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+Array of ones with the same shape and type as `a`.
+"""
+pass
+
+
+def _np_zeros_like(a):
+"""Return an array of zeros with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+

[incubator-mxnet] 19/42: [numpy] Fix d2l chapter8 (#15237)

2019-07-22 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a commit to branch numpy
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git

commit dca5a4fe203f34515adaa4bc84be099a60bacde1
Author: reminisce 
AuthorDate: Thu Jun 13 14:42:34 2019 -0700

[numpy] Fix d2l chapter8 (#15237)

* Add np op doc

* Fix several issues

* Add a N-D dot b 2D support

* Simplify array creation api

* Add swapaxes

* Fix rnn gluon

* More fix

* Fix pylint

* Delete

* Fix mp windows
---
 python/mxnet/_numpy_op_doc.py  |  88 +++
 python/mxnet/base.py   |   4 ++
 python/mxnet/gluon/data/dataloader.py  |   3 -
 python/mxnet/gluon/nn/basic_layers.py  |   3 +-
 python/mxnet/gluon/rnn/rnn_layer.py|  33 +
 python/mxnet/ndarray/ndarray.py|   4 +-
 python/mxnet/ndarray/numpy/_op.py  |  45 +++-
 python/mxnet/numpy/__init__.py |   2 -
 python/mxnet/numpy/multiarray.py   | 126 -
 python/mxnet/symbol/numpy/_symbol.py   |  86 +-
 src/ndarray/ndarray.cc |   2 +-
 src/operator/nn/concat.cc  |   1 +
 src/operator/numpy/np_dot-inl.h|  32 +++--
 src/operator/numpy/np_dot.cc   |  18 -
 src/operator/numpy/np_matrix_op.cc |  63 +
 src/operator/numpy/np_matrix_op.cu |   3 +
 src/operator/rnn.cc|   1 +
 src/operator/sequence_mask.cc  |   3 +
 src/operator/swapaxis-inl.h|  42 +--
 src/operator/swapaxis.cc   |   2 +-
 src/operator/tensor/indexing_op.cc |   2 +
 src/operator/tensor/matrix_op-inl.h|   8 +--
 src/operator/tensor/matrix_op.cc   |   1 +
 tests/python/unittest/test_numpy_op.py |  68 ++
 24 files changed, 549 insertions(+), 91 deletions(-)

diff --git a/python/mxnet/_numpy_op_doc.py b/python/mxnet/_numpy_op_doc.py
new file mode 100644
index 000..17f92ce
--- /dev/null
+++ b/python/mxnet/_numpy_op_doc.py
@@ -0,0 +1,88 @@
+# 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.
+
+# pylint: skip-file
+
+"""Doc placeholder for numpy ops with prefix _np."""
+
+
+def _np_reshape(a, newshape, order='C'):
+"""Gives a new shape to an array without changing its data.
+
+Parameters
+--
+a : ndarray
+Array to be reshaped.
+newshape : int or tuple of ints
+The new shape should be compatible with the original shape. If
+an integer, then the result will be a 1-D array of that length.
+One shape dimension can be -1. In this case, the value is
+inferred from the length of the array and remaining dimensions.
+order : {'C'}, optional
+Read the elements of `a` using this index order, and place the
+elements into the reshaped array using this index order.  'C'
+means to read / write the elements using C-like index order,
+with the last axis index changing fastest, back to the first
+axis index changing slowest. Other order types such as 'F'/'A'
+may be added in the future.
+
+Returns
+---
+reshaped_array : ndarray
+It will be always a copy of the original array. This behavior is 
different
+from the official NumPy package where views of the original array may 
be
+generated.
+
+See Also
+
+ndarray.reshape : Equivalent method.
+"""
+pass
+
+
+def _np_ones_like(a):
+"""Return an array of ones with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+Array of ones with the same shape and type as `a`.
+"""
+pass
+
+
+def _np_zeros_like(a):
+"""Return an array of zeros with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+

[incubator-mxnet] 19/42: [numpy] Fix d2l chapter8 (#15237)

2019-07-18 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a commit to branch numpy
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git

commit af9d82b01e8c9ec5091e4954763dd416585192d3
Author: reminisce 
AuthorDate: Thu Jun 13 14:42:34 2019 -0700

[numpy] Fix d2l chapter8 (#15237)

* Add np op doc

* Fix several issues

* Add a N-D dot b 2D support

* Simplify array creation api

* Add swapaxes

* Fix rnn gluon

* More fix

* Fix pylint

* Delete

* Fix mp windows
---
 python/mxnet/_numpy_op_doc.py  |  88 +++
 python/mxnet/base.py   |   4 ++
 python/mxnet/gluon/data/dataloader.py  |   3 -
 python/mxnet/gluon/nn/basic_layers.py  |   3 +-
 python/mxnet/gluon/rnn/rnn_layer.py|  33 +
 python/mxnet/ndarray/ndarray.py|   4 +-
 python/mxnet/ndarray/numpy/_op.py  |  45 +++-
 python/mxnet/numpy/__init__.py |   2 -
 python/mxnet/numpy/multiarray.py   | 126 -
 python/mxnet/symbol/numpy/_symbol.py   |  86 +-
 src/ndarray/ndarray.cc |   2 +-
 src/operator/nn/concat.cc  |   1 +
 src/operator/numpy/np_dot-inl.h|  32 +++--
 src/operator/numpy/np_dot.cc   |  18 -
 src/operator/numpy/np_matrix_op.cc |  63 +
 src/operator/numpy/np_matrix_op.cu |   3 +
 src/operator/rnn.cc|   1 +
 src/operator/sequence_mask.cc  |   3 +
 src/operator/swapaxis-inl.h|  42 +--
 src/operator/swapaxis.cc   |   2 +-
 src/operator/tensor/indexing_op.cc |   2 +
 src/operator/tensor/matrix_op-inl.h|   8 +--
 src/operator/tensor/matrix_op.cc   |   1 +
 tests/python/unittest/test_numpy_op.py |  68 ++
 24 files changed, 549 insertions(+), 91 deletions(-)

diff --git a/python/mxnet/_numpy_op_doc.py b/python/mxnet/_numpy_op_doc.py
new file mode 100644
index 000..17f92ce
--- /dev/null
+++ b/python/mxnet/_numpy_op_doc.py
@@ -0,0 +1,88 @@
+# 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.
+
+# pylint: skip-file
+
+"""Doc placeholder for numpy ops with prefix _np."""
+
+
+def _np_reshape(a, newshape, order='C'):
+"""Gives a new shape to an array without changing its data.
+
+Parameters
+--
+a : ndarray
+Array to be reshaped.
+newshape : int or tuple of ints
+The new shape should be compatible with the original shape. If
+an integer, then the result will be a 1-D array of that length.
+One shape dimension can be -1. In this case, the value is
+inferred from the length of the array and remaining dimensions.
+order : {'C'}, optional
+Read the elements of `a` using this index order, and place the
+elements into the reshaped array using this index order.  'C'
+means to read / write the elements using C-like index order,
+with the last axis index changing fastest, back to the first
+axis index changing slowest. Other order types such as 'F'/'A'
+may be added in the future.
+
+Returns
+---
+reshaped_array : ndarray
+It will be always a copy of the original array. This behavior is 
different
+from the official NumPy package where views of the original array may 
be
+generated.
+
+See Also
+
+ndarray.reshape : Equivalent method.
+"""
+pass
+
+
+def _np_ones_like(a):
+"""Return an array of ones with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+Array of ones with the same shape and type as `a`.
+"""
+pass
+
+
+def _np_zeros_like(a):
+"""Return an array of zeros with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+

[incubator-mxnet] 19/42: [numpy] Fix d2l chapter8 (#15237)

2019-07-17 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a commit to branch numpy
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git

commit d5537d41460cdbee8010f1c48d9acb41f2a983e0
Author: reminisce 
AuthorDate: Thu Jun 13 14:42:34 2019 -0700

[numpy] Fix d2l chapter8 (#15237)

* Add np op doc

* Fix several issues

* Add a N-D dot b 2D support

* Simplify array creation api

* Add swapaxes

* Fix rnn gluon

* More fix

* Fix pylint

* Delete

* Fix mp windows
---
 python/mxnet/_numpy_op_doc.py  |  88 +++
 python/mxnet/base.py   |   4 ++
 python/mxnet/gluon/data/dataloader.py  |   3 -
 python/mxnet/gluon/nn/basic_layers.py  |   3 +-
 python/mxnet/gluon/rnn/rnn_layer.py|  33 +
 python/mxnet/ndarray/ndarray.py|   4 +-
 python/mxnet/ndarray/numpy/_op.py  |  45 +++-
 python/mxnet/numpy/__init__.py |   2 -
 python/mxnet/numpy/multiarray.py   | 126 -
 python/mxnet/symbol/numpy/_symbol.py   |  86 +-
 src/ndarray/ndarray.cc |   2 +-
 src/operator/nn/concat.cc  |   1 +
 src/operator/numpy/np_dot-inl.h|  32 +++--
 src/operator/numpy/np_dot.cc   |  18 -
 src/operator/numpy/np_matrix_op.cc |  63 +
 src/operator/numpy/np_matrix_op.cu |   3 +
 src/operator/rnn.cc|   1 +
 src/operator/sequence_mask.cc  |   3 +
 src/operator/swapaxis-inl.h|  42 +--
 src/operator/swapaxis.cc   |   2 +-
 src/operator/tensor/indexing_op.cc |   2 +
 src/operator/tensor/matrix_op-inl.h|   8 +--
 src/operator/tensor/matrix_op.cc   |   1 +
 tests/python/unittest/test_numpy_op.py |  68 ++
 24 files changed, 549 insertions(+), 91 deletions(-)

diff --git a/python/mxnet/_numpy_op_doc.py b/python/mxnet/_numpy_op_doc.py
new file mode 100644
index 000..17f92ce
--- /dev/null
+++ b/python/mxnet/_numpy_op_doc.py
@@ -0,0 +1,88 @@
+# 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.
+
+# pylint: skip-file
+
+"""Doc placeholder for numpy ops with prefix _np."""
+
+
+def _np_reshape(a, newshape, order='C'):
+"""Gives a new shape to an array without changing its data.
+
+Parameters
+--
+a : ndarray
+Array to be reshaped.
+newshape : int or tuple of ints
+The new shape should be compatible with the original shape. If
+an integer, then the result will be a 1-D array of that length.
+One shape dimension can be -1. In this case, the value is
+inferred from the length of the array and remaining dimensions.
+order : {'C'}, optional
+Read the elements of `a` using this index order, and place the
+elements into the reshaped array using this index order.  'C'
+means to read / write the elements using C-like index order,
+with the last axis index changing fastest, back to the first
+axis index changing slowest. Other order types such as 'F'/'A'
+may be added in the future.
+
+Returns
+---
+reshaped_array : ndarray
+It will be always a copy of the original array. This behavior is 
different
+from the official NumPy package where views of the original array may 
be
+generated.
+
+See Also
+
+ndarray.reshape : Equivalent method.
+"""
+pass
+
+
+def _np_ones_like(a):
+"""Return an array of ones with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+Array of ones with the same shape and type as `a`.
+"""
+pass
+
+
+def _np_zeros_like(a):
+"""Return an array of zeros with the same shape and type as a given array.
+
+Parameters
+--
+a : ndarray
+The shape and data-type of `a` define these same attributes of
+the returned array.
+
+Returns
+---
+out : ndarray
+